@w5s/managed-script 1.0.0-alpha.2 → 1.0.0-alpha.5

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/ManagedScript-B8d632d3.js +321 -0
  4. package/dist/ManagedScript-B8d632d3.js.map +1 -0
  5. package/dist/cli.js +27 -43
  6. package/dist/cli.js.map +1 -1
  7. package/dist/defaultContext-Xl2iA7UM.js +91 -0
  8. package/dist/defaultContext-Xl2iA7UM.js.map +1 -0
  9. package/dist/index.d.ts +27 -54
  10. package/dist/index.js +27 -12
  11. package/dist/index.js.map +1 -1
  12. package/dist/type-hvsy_R0f.d.ts +103 -0
  13. package/dist/zx.d.ts +45 -14
  14. package/dist/zx.js +67 -26
  15. package/dist/zx.js.map +1 -1
  16. package/package.json +4 -2
  17. package/src/ManagedScript/defaultContext.ts +2 -4
  18. package/src/ManagedScript/execute.ts +48 -25
  19. package/src/ManagedScript/resolveScripts.ts +52 -5
  20. package/src/cli/RootCommand.ts +2 -3
  21. package/src/internal/Executor.ts +27 -10
  22. package/src/internal/Logger.ts +25 -7
  23. package/src/internal/PackageScriptOverride.ts +43 -0
  24. package/src/internal/ScriptInvocation.ts +55 -0
  25. package/src/internal/ScriptNameResolver.ts +5 -4
  26. package/src/internal/Stdio.ts +41 -0
  27. package/src/internal/lazy.ts +7 -0
  28. package/src/mergeConfig.ts +28 -0
  29. package/src/type/CommandContext.ts +6 -7
  30. package/src/type/ResolvedConfig.ts +27 -8
  31. package/src/type/StdOptions.ts +1 -0
  32. package/src/type/UserConfig.ts +38 -1
  33. package/src/type.ts +1 -0
  34. package/src/zx/ZXOptions.ts +73 -1
  35. package/src/zx/ZXShell.ts +18 -1
  36. package/src/zx/defaults.ts +6 -0
  37. package/src/zx/isCI.ts +26 -0
  38. package/src/zx/zx.ts +7 -13
  39. package/src/zx.ts +2 -0
  40. package/dist/ManagedScript-DIacNHCc.js +0 -149
  41. package/dist/ManagedScript-DIacNHCc.js.map +0 -1
  42. package/dist/defaultContext-D_QWP9aF.js +0 -98
  43. package/dist/defaultContext-D_QWP9aF.js.map +0 -1
  44. package/dist/type-DQiyX1q_.d.ts +0 -53
  45. package/src/zx/defaultZXOptions.ts +0 -37
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":["HelpCommand","HelpCommand","String","isEnum","Option.String","Option.Boolean","Option.Rest","Builtins.HelpCommand","Builtins.VersionCommand"],"sources":["../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/constants.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/errors.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/utils.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/Command.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/platform/node.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/core.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/format.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/HelpCommand.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/Cli.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/builtins/help.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/builtins/version.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/Boolean.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/Rest.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/String.mjs","../../../node_modules/.pnpm/typanion@3.14.0/node_modules/typanion/lib/index.js","../src/cli/RootCommand.ts","../src/cli/runCLI.ts","../src/cli.ts"],"sourcesContent":["var SpecialToken;\n(function (SpecialToken) {\n SpecialToken[\"StartOfInput\"] = \"\\0\";\n SpecialToken[\"EndOfInput\"] = \"\\u0001\";\n SpecialToken[\"EndOfPartialInput\"] = \"\\u0002\";\n})(SpecialToken || (SpecialToken = {}));\nvar NodeType;\n(function (NodeType) {\n NodeType[NodeType[\"InitialNode\"] = 0] = \"InitialNode\";\n NodeType[NodeType[\"SuccessNode\"] = 1] = \"SuccessNode\";\n NodeType[NodeType[\"ErrorNode\"] = 2] = \"ErrorNode\";\n NodeType[NodeType[\"CustomNode\"] = 3] = \"CustomNode\";\n})(NodeType || (NodeType = {}));\nconst HELP_COMMAND_INDEX = -1;\nconst HELP_REGEX = /^(-h|--help)(?:=([0-9]+))?$/;\nconst OPTION_REGEX = /^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/;\nconst BATCH_REGEX = /^-[a-zA-Z]{2,}$/;\nconst BINDING_REGEX = /^([^=]+)=([\\s\\S]*)$/;\nconst IS_DEBUG = process.env.DEBUG_CLI === `1`;\n\nexport { BATCH_REGEX, BINDING_REGEX, HELP_COMMAND_INDEX, HELP_REGEX, IS_DEBUG, NodeType, OPTION_REGEX, SpecialToken };\n","import { SpecialToken } from './constants.mjs';\n\n/**\n * A generic usage error with the name `UsageError`.\n *\n * It should be used over `Error` only when it's the user's fault.\n */\nclass UsageError extends Error {\n constructor(message) {\n super(message);\n this.clipanion = { type: `usage` };\n this.name = `UsageError`;\n }\n}\nclass UnknownSyntaxError extends Error {\n constructor(input, candidates) {\n super();\n this.input = input;\n this.candidates = candidates;\n this.clipanion = { type: `none` };\n this.name = `UnknownSyntaxError`;\n if (this.candidates.length === 0) {\n this.message = `Command not found, but we're not sure what's the alternative.`;\n }\n else if (this.candidates.every(candidate => candidate.reason !== null && candidate.reason === candidates[0].reason)) {\n const [{ reason }] = this.candidates;\n this.message = `${reason}\\n\\n${this.candidates.map(({ usage }) => `$ ${usage}`).join(`\\n`)}`;\n }\n else if (this.candidates.length === 1) {\n const [{ usage }] = this.candidates;\n this.message = `Command not found; did you mean:\\n\\n$ ${usage}\\n${whileRunning(input)}`;\n }\n else {\n this.message = `Command not found; did you mean one of:\\n\\n${this.candidates.map(({ usage }, index) => {\n return `${`${index}.`.padStart(4)} ${usage}`;\n }).join(`\\n`)}\\n\\n${whileRunning(input)}`;\n }\n }\n}\nclass AmbiguousSyntaxError extends Error {\n constructor(input, usages) {\n super();\n this.input = input;\n this.usages = usages;\n this.clipanion = { type: `none` };\n this.name = `AmbiguousSyntaxError`;\n this.message = `Cannot find which to pick amongst the following alternatives:\\n\\n${this.usages.map((usage, index) => {\n return `${`${index}.`.padStart(4)} ${usage}`;\n }).join(`\\n`)}\\n\\n${whileRunning(input)}`;\n }\n}\nconst whileRunning = (input) => `While running ${input.filter(token => {\n return token !== SpecialToken.EndOfInput && token !== SpecialToken.EndOfPartialInput;\n}).map(token => {\n const json = JSON.stringify(token);\n if (token.match(/\\s/) || token.length === 0 || json !== `\"${token}\"`) {\n return json;\n }\n else {\n return token;\n }\n}).join(` `)}`;\n\nexport { AmbiguousSyntaxError, UnknownSyntaxError, UsageError };\n","import { UsageError } from '../../errors.mjs';\n\nconst isOptionSymbol = Symbol(`clipanion/isOption`);\nfunction makeCommandOption(spec) {\n // We lie! But it's for the good cause: the cli engine will turn the specs into proper values after instantiation.\n return { ...spec, [isOptionSymbol]: true };\n}\nfunction rerouteArguments(a, b) {\n if (typeof a === `undefined`)\n return [a, b];\n if (typeof a === `object` && a !== null && !Array.isArray(a)) {\n return [undefined, a];\n }\n else {\n return [a, b];\n }\n}\nfunction cleanValidationError(message, { mergeName = false } = {}) {\n const match = message.match(/^([^:]+): (.*)$/m);\n if (!match)\n return `validation failed`;\n let [, path, line] = match;\n if (mergeName)\n line = line[0].toLowerCase() + line.slice(1);\n line = path !== `.` || !mergeName\n ? `${path.replace(/^\\.(\\[|$)/, `$1`)}: ${line}`\n : `: ${line}`;\n return line;\n}\nfunction formatError(message, errors) {\n if (errors.length === 1) {\n return new UsageError(`${message}${cleanValidationError(errors[0], { mergeName: true })}`);\n }\n else {\n return new UsageError(`${message}:\\n${errors.map(error => `\\n- ${cleanValidationError(error)}`).join(``)}`);\n }\n}\nfunction applyValidator(name, value, validator) {\n if (typeof validator === `undefined`)\n return value;\n const errors = [];\n const coercions = [];\n const coercion = (v) => {\n const orig = value;\n value = v;\n return coercion.bind(null, orig);\n };\n const check = validator(value, { errors, coercions, coercion });\n if (!check)\n throw formatError(`Invalid value for ${name}`, errors);\n for (const [, op] of coercions)\n op();\n return value;\n}\n\nexport { applyValidator, cleanValidationError, formatError, isOptionSymbol, makeCommandOption, rerouteArguments };\n","import { formatError, isOptionSymbol } from './options/utils.mjs';\n\n/**\n * Base abstract class for CLI commands. The main thing to remember is to\n * declare an async `execute` member function that will be called when the\n * command is invoked from the CLI, and optionally a `paths` property to\n * declare the set of paths under which the command should be exposed.\n */\nclass Command {\n constructor() {\n /**\n * Predefined that will be set to true if `-h,--help` has been used, in\n * which case `Command#execute` won't be called.\n */\n this.help = false;\n }\n /**\n * Defines the usage information for the given command.\n */\n static Usage(usage) {\n return usage;\n }\n /**\n * Standard error handler which will simply rethrow the error. Can be used\n * to add custom logic to handle errors from the command or simply return\n * the parent class error handling.\n */\n async catch(error) {\n throw error;\n }\n async validateAndExecute() {\n const commandClass = this.constructor;\n const cascade = commandClass.schema;\n if (Array.isArray(cascade)) {\n const { isDict, isUnknown, applyCascade } = await import('typanion');\n const schema = applyCascade(isDict(isUnknown()), cascade);\n const errors = [];\n const coercions = [];\n const check = schema(this, { errors, coercions });\n if (!check)\n throw formatError(`Invalid option schema`, errors);\n for (const [, op] of coercions) {\n op();\n }\n }\n else if (cascade != null) {\n throw new Error(`Invalid command schema`);\n }\n const exitCode = await this.execute();\n if (typeof exitCode !== `undefined`) {\n return exitCode;\n }\n else {\n return 0;\n }\n }\n}\n/**\n * Used to detect option definitions.\n */\nCommand.isOption = isOptionSymbol;\n/**\n * Just an helper to use along with the `paths` fields, to make it\n * clearer that a command is the default one.\n *\n * @example\n * class MyCommand extends Command {\n * static paths = [Command.Default];\n * }\n */\nCommand.Default = [];\n\nexport { Command };\n","import tty from 'tty';\n\nfunction getDefaultColorDepth() {\n if (tty && `getColorDepth` in tty.WriteStream.prototype)\n return tty.WriteStream.prototype.getColorDepth();\n if (process.env.FORCE_COLOR === `0`)\n return 1;\n if (process.env.FORCE_COLOR === `1`)\n return 8;\n if (typeof process.stdout !== `undefined` && process.stdout.isTTY)\n return 8;\n return 1;\n}\nlet gContextStorage;\nfunction getCaptureActivator(context) {\n let contextStorage = gContextStorage;\n if (typeof contextStorage === `undefined`) {\n if (context.stdout === process.stdout && context.stderr === process.stderr)\n return null;\n const { AsyncLocalStorage: LazyAsyncLocalStorage } = require(`async_hooks`);\n contextStorage = gContextStorage = new LazyAsyncLocalStorage();\n const origStdoutWrite = process.stdout._write;\n process.stdout._write = function (chunk, encoding, cb) {\n const context = contextStorage.getStore();\n if (typeof context === `undefined`)\n return origStdoutWrite.call(this, chunk, encoding, cb);\n return context.stdout.write(chunk, encoding, cb);\n };\n const origStderrWrite = process.stderr._write;\n process.stderr._write = function (chunk, encoding, cb) {\n const context = contextStorage.getStore();\n if (typeof context === `undefined`)\n return origStderrWrite.call(this, chunk, encoding, cb);\n return context.stderr.write(chunk, encoding, cb);\n };\n }\n return (fn) => {\n return contextStorage.run(context, fn);\n };\n}\n\nexport { getCaptureActivator, getDefaultColorDepth };\n","import { IS_DEBUG, NodeType, SpecialToken, HELP_COMMAND_INDEX, BATCH_REGEX, BINDING_REGEX, OPTION_REGEX, HELP_REGEX } from './constants.mjs';\nimport { UnknownSyntaxError, AmbiguousSyntaxError } from './errors.mjs';\n\n// ------------------------------------------------------------------------\nfunction debug(str) {\n if (IS_DEBUG) {\n console.log(str);\n }\n}\nconst basicHelpState = {\n candidateUsage: null,\n requiredOptions: [],\n errorMessage: null,\n ignoreOptions: false,\n path: [],\n positionals: [],\n options: [],\n remainder: null,\n selectedIndex: HELP_COMMAND_INDEX,\n tokens: [],\n};\nfunction makeStateMachine() {\n const stateMachine = {\n nodes: [],\n };\n for (let t = 0; t < NodeType.CustomNode; ++t)\n stateMachine.nodes.push(makeNode());\n return stateMachine;\n}\nfunction makeAnyOfMachine(inputs) {\n const output = makeStateMachine();\n const heads = [];\n let offset = output.nodes.length;\n for (const input of inputs) {\n heads.push(offset);\n for (let t = 0; t < input.nodes.length; ++t)\n if (!isTerminalNode(t))\n output.nodes.push(cloneNode(input.nodes[t], offset));\n offset += input.nodes.length - NodeType.CustomNode + 1;\n }\n for (const head of heads)\n registerShortcut(output, NodeType.InitialNode, head);\n return output;\n}\nfunction injectNode(machine, node) {\n machine.nodes.push(node);\n return machine.nodes.length - 1;\n}\nfunction simplifyMachine(input) {\n const visited = new Set();\n const process = (node) => {\n if (visited.has(node))\n return;\n visited.add(node);\n const nodeDef = input.nodes[node];\n for (const transitions of Object.values(nodeDef.statics))\n for (const { to } of transitions)\n process(to);\n for (const [, { to }] of nodeDef.dynamics)\n process(to);\n for (const { to } of nodeDef.shortcuts)\n process(to);\n const shortcuts = new Set(nodeDef.shortcuts.map(({ to }) => to));\n while (nodeDef.shortcuts.length > 0) {\n const { to } = nodeDef.shortcuts.shift();\n const toDef = input.nodes[to];\n for (const [segment, transitions] of Object.entries(toDef.statics)) {\n const store = !Object.prototype.hasOwnProperty.call(nodeDef.statics, segment)\n ? nodeDef.statics[segment] = []\n : nodeDef.statics[segment];\n for (const transition of transitions) {\n if (!store.some(({ to }) => transition.to === to)) {\n store.push(transition);\n }\n }\n }\n for (const [test, transition] of toDef.dynamics)\n if (!nodeDef.dynamics.some(([otherTest, { to }]) => test === otherTest && transition.to === to))\n nodeDef.dynamics.push([test, transition]);\n for (const transition of toDef.shortcuts) {\n if (!shortcuts.has(transition.to)) {\n nodeDef.shortcuts.push(transition);\n shortcuts.add(transition.to);\n }\n }\n }\n };\n process(NodeType.InitialNode);\n}\nfunction debugMachine(machine, { prefix = `` } = {}) {\n // Don't iterate unless it's needed\n if (IS_DEBUG) {\n debug(`${prefix}Nodes are:`);\n for (let t = 0; t < machine.nodes.length; ++t) {\n debug(`${prefix} ${t}: ${JSON.stringify(machine.nodes[t])}`);\n }\n }\n}\nfunction runMachineInternal(machine, input, partial = false) {\n debug(`Running a vm on ${JSON.stringify(input)}`);\n let branches = [{\n node: NodeType.InitialNode,\n state: {\n candidateUsage: null,\n requiredOptions: [],\n errorMessage: null,\n ignoreOptions: false,\n options: [],\n path: [],\n positionals: [],\n remainder: null,\n selectedIndex: null,\n tokens: [],\n },\n }];\n debugMachine(machine, { prefix: ` ` });\n const tokens = [SpecialToken.StartOfInput, ...input];\n for (let t = 0; t < tokens.length; ++t) {\n const segment = tokens[t];\n const isEOI = segment === SpecialToken.EndOfInput || segment === SpecialToken.EndOfPartialInput;\n // The -1 is because we added a START_OF_INPUT token\n const segmentIndex = t - 1;\n debug(` Processing ${JSON.stringify(segment)}`);\n const nextBranches = [];\n for (const { node, state } of branches) {\n debug(` Current node is ${node}`);\n const nodeDef = machine.nodes[node];\n if (node === NodeType.ErrorNode) {\n nextBranches.push({ node, state });\n continue;\n }\n console.assert(nodeDef.shortcuts.length === 0, `Shortcuts should have been eliminated by now`);\n const hasExactMatch = Object.prototype.hasOwnProperty.call(nodeDef.statics, segment);\n if (!partial || t < tokens.length - 1 || hasExactMatch) {\n if (hasExactMatch) {\n const transitions = nodeDef.statics[segment];\n for (const { to, reducer } of transitions) {\n nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment, segmentIndex) : state });\n debug(` Static transition to ${to} found`);\n }\n }\n else {\n debug(` No static transition found`);\n }\n }\n else {\n let hasMatches = false;\n for (const candidate of Object.keys(nodeDef.statics)) {\n if (!candidate.startsWith(segment))\n continue;\n if (segment === candidate) {\n for (const { to, reducer } of nodeDef.statics[candidate]) {\n nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment, segmentIndex) : state });\n debug(` Static transition to ${to} found`);\n }\n }\n else {\n for (const { to } of nodeDef.statics[candidate]) {\n nextBranches.push({ node: to, state: { ...state, remainder: candidate.slice(segment.length) } });\n debug(` Static transition to ${to} found (partial match)`);\n }\n }\n hasMatches = true;\n }\n if (!hasMatches) {\n debug(` No partial static transition found`);\n }\n }\n if (!isEOI) {\n for (const [test, { to, reducer }] of nodeDef.dynamics) {\n if (execute(tests, test, state, segment, segmentIndex)) {\n nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment, segmentIndex) : state });\n debug(` Dynamic transition to ${to} found (via ${test})`);\n }\n }\n }\n }\n if (nextBranches.length === 0 && isEOI && input.length === 1) {\n return [{\n node: NodeType.InitialNode,\n state: basicHelpState,\n }];\n }\n if (nextBranches.length === 0) {\n throw new UnknownSyntaxError(input, branches.filter(({ node }) => {\n return node !== NodeType.ErrorNode;\n }).map(({ state }) => {\n return { usage: state.candidateUsage, reason: null };\n }));\n }\n if (nextBranches.every(({ node }) => node === NodeType.ErrorNode)) {\n throw new UnknownSyntaxError(input, nextBranches.map(({ state }) => {\n return { usage: state.candidateUsage, reason: state.errorMessage };\n }));\n }\n branches = trimSmallerBranches(nextBranches);\n }\n if (branches.length > 0) {\n debug(` Results:`);\n for (const branch of branches) {\n debug(` - ${branch.node} -> ${JSON.stringify(branch.state)}`);\n }\n }\n else {\n debug(` No results`);\n }\n return branches;\n}\nfunction runMachine(machine, input, { endToken = SpecialToken.EndOfInput } = {}) {\n const branches = runMachineInternal(machine, [...input, endToken]);\n return selectBestState(input, branches.map(({ state }) => {\n return state;\n }));\n}\nfunction trimSmallerBranches(branches) {\n let maxPathSize = 0;\n for (const { state } of branches)\n if (state.path.length > maxPathSize)\n maxPathSize = state.path.length;\n return branches.filter(({ state }) => {\n return state.path.length === maxPathSize;\n });\n}\nfunction selectBestState(input, states) {\n const terminalStates = states.filter(state => {\n return state.selectedIndex !== null;\n });\n if (terminalStates.length === 0)\n throw new Error();\n const requiredOptionsSetStates = terminalStates.filter(state => state.selectedIndex === HELP_COMMAND_INDEX || state.requiredOptions.every(names => names.some(name => state.options.find(opt => opt.name === name))));\n if (requiredOptionsSetStates.length === 0) {\n throw new UnknownSyntaxError(input, terminalStates.map(state => ({\n usage: state.candidateUsage,\n reason: null,\n })));\n }\n let maxPathSize = 0;\n for (const state of requiredOptionsSetStates)\n if (state.path.length > maxPathSize)\n maxPathSize = state.path.length;\n const bestPathBranches = requiredOptionsSetStates.filter(state => {\n return state.path.length === maxPathSize;\n });\n const getPositionalCount = (state) => state.positionals.filter(({ extra }) => {\n return !extra;\n }).length + state.options.length;\n const statesWithPositionalCount = bestPathBranches.map(state => {\n return { state, positionalCount: getPositionalCount(state) };\n });\n let maxPositionalCount = 0;\n for (const { positionalCount } of statesWithPositionalCount)\n if (positionalCount > maxPositionalCount)\n maxPositionalCount = positionalCount;\n const bestPositionalStates = statesWithPositionalCount.filter(({ positionalCount }) => {\n return positionalCount === maxPositionalCount;\n }).map(({ state }) => {\n return state;\n });\n const fixedStates = aggregateHelpStates(bestPositionalStates);\n if (fixedStates.length > 1)\n throw new AmbiguousSyntaxError(input, fixedStates.map(state => state.candidateUsage));\n return fixedStates[0];\n}\nfunction aggregateHelpStates(states) {\n const notHelps = [];\n const helps = [];\n for (const state of states) {\n if (state.selectedIndex === HELP_COMMAND_INDEX) {\n helps.push(state);\n }\n else {\n notHelps.push(state);\n }\n }\n if (helps.length > 0) {\n notHelps.push({\n ...basicHelpState,\n path: findCommonPrefix(...helps.map(state => state.path)),\n options: helps.reduce((options, state) => options.concat(state.options), []),\n });\n }\n return notHelps;\n}\nfunction findCommonPrefix(firstPath, secondPath, ...rest) {\n if (secondPath === undefined)\n return Array.from(firstPath);\n return findCommonPrefix(firstPath.filter((segment, i) => segment === secondPath[i]), ...rest);\n}\nfunction makeNode() {\n return {\n dynamics: [],\n shortcuts: [],\n statics: {},\n };\n}\nfunction isTerminalNode(node) {\n return node === NodeType.SuccessNode || node === NodeType.ErrorNode;\n}\nfunction cloneTransition(input, offset = 0) {\n const to = !isTerminalNode(input.to)\n ? input.to >= NodeType.CustomNode\n ? input.to + offset - NodeType.CustomNode + 1\n : input.to + offset\n : input.to;\n return {\n to,\n reducer: input.reducer,\n };\n}\nfunction cloneNode(input, offset = 0) {\n const output = makeNode();\n for (const [test, transition] of input.dynamics)\n output.dynamics.push([test, cloneTransition(transition, offset)]);\n for (const transition of input.shortcuts)\n output.shortcuts.push(cloneTransition(transition, offset));\n for (const [segment, transitions] of Object.entries(input.statics))\n output.statics[segment] = transitions.map(transition => cloneTransition(transition, offset));\n return output;\n}\nfunction registerDynamic(machine, from, test, to, reducer) {\n machine.nodes[from].dynamics.push([\n test,\n { to, reducer: reducer },\n ]);\n}\nfunction registerShortcut(machine, from, to, reducer) {\n machine.nodes[from].shortcuts.push({ to, reducer: reducer });\n}\nfunction registerStatic(machine, from, test, to, reducer) {\n const store = !Object.prototype.hasOwnProperty.call(machine.nodes[from].statics, test)\n ? machine.nodes[from].statics[test] = []\n : machine.nodes[from].statics[test];\n store.push({ to, reducer: reducer });\n}\nfunction execute(store, callback, state, segment, segmentIndex) {\n // TypeScript's control flow can't properly narrow\n // generic conditionals for some mysterious reason\n if (Array.isArray(callback)) {\n const [name, ...args] = callback;\n return store[name](state, segment, segmentIndex, ...args);\n }\n else {\n return store[callback](state, segment, segmentIndex);\n }\n}\nconst tests = {\n always: () => {\n return true;\n },\n isOptionLike: (state, segment) => {\n return !state.ignoreOptions && (segment !== `-` && segment.startsWith(`-`));\n },\n isNotOptionLike: (state, segment) => {\n return state.ignoreOptions || segment === `-` || !segment.startsWith(`-`);\n },\n isOption: (state, segment, segmentIndex, name) => {\n return !state.ignoreOptions && segment === name;\n },\n isBatchOption: (state, segment, segmentIndex, names) => {\n return !state.ignoreOptions && BATCH_REGEX.test(segment) && [...segment.slice(1)].every(name => names.has(`-${name}`));\n },\n isBoundOption: (state, segment, segmentIndex, names, options) => {\n const optionParsing = segment.match(BINDING_REGEX);\n return !state.ignoreOptions && !!optionParsing && OPTION_REGEX.test(optionParsing[1]) && names.has(optionParsing[1])\n // Disallow bound options with no arguments (i.e. booleans)\n && options.filter(opt => opt.nameSet.includes(optionParsing[1])).every(opt => opt.allowBinding);\n },\n isNegatedOption: (state, segment, segmentIndex, name) => {\n return !state.ignoreOptions && segment === `--no-${name.slice(2)}`;\n },\n isHelp: (state, segment) => {\n return !state.ignoreOptions && HELP_REGEX.test(segment);\n },\n isUnsupportedOption: (state, segment, segmentIndex, names) => {\n return !state.ignoreOptions && segment.startsWith(`-`) && OPTION_REGEX.test(segment) && !names.has(segment);\n },\n isInvalidOption: (state, segment) => {\n return !state.ignoreOptions && segment.startsWith(`-`) && !OPTION_REGEX.test(segment);\n },\n};\nconst reducers = {\n setCandidateState: (state, segment, segmentIndex, candidateState) => {\n return { ...state, ...candidateState };\n },\n setSelectedIndex: (state, segment, segmentIndex, index) => {\n return { ...state, selectedIndex: index };\n },\n pushBatch: (state, segment, segmentIndex, names) => {\n const options = state.options.slice();\n const tokens = state.tokens.slice();\n for (let t = 1; t < segment.length; ++t) {\n const name = names.get(`-${segment[t]}`);\n const slice = t === 1 ? [0, 2] : [t, t + 1];\n options.push({ name, value: true });\n tokens.push({ segmentIndex, type: `option`, option: name, slice });\n }\n return { ...state, options, tokens };\n },\n pushBound: (state, segment, segmentIndex) => {\n const [, name, value] = segment.match(BINDING_REGEX);\n const options = state.options.concat({ name, value });\n const tokens = state.tokens.concat([\n { segmentIndex, type: `option`, slice: [0, name.length], option: name },\n { segmentIndex, type: `assign`, slice: [name.length, name.length + 1] },\n { segmentIndex, type: `value`, slice: [name.length + 1, name.length + value.length + 1] },\n ]);\n return { ...state, options, tokens };\n },\n pushPath: (state, segment, segmentIndex) => {\n const path = state.path.concat(segment);\n const tokens = state.tokens.concat({ segmentIndex, type: `path` });\n return { ...state, path, tokens };\n },\n pushPositional: (state, segment, segmentIndex) => {\n const positionals = state.positionals.concat({ value: segment, extra: false });\n const tokens = state.tokens.concat({ segmentIndex, type: `positional` });\n return { ...state, positionals, tokens };\n },\n pushExtra: (state, segment, segmentIndex) => {\n const positionals = state.positionals.concat({ value: segment, extra: true });\n const tokens = state.tokens.concat({ segmentIndex, type: `positional` });\n return { ...state, positionals, tokens };\n },\n pushExtraNoLimits: (state, segment, segmentIndex) => {\n const positionals = state.positionals.concat({ value: segment, extra: NoLimits });\n const tokens = state.tokens.concat({ segmentIndex, type: `positional` });\n return { ...state, positionals, tokens };\n },\n pushTrue: (state, segment, segmentIndex, name) => {\n const options = state.options.concat({ name, value: true });\n const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: name });\n return { ...state, options, tokens };\n },\n pushFalse: (state, segment, segmentIndex, name) => {\n const options = state.options.concat({ name, value: false });\n const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: name });\n return { ...state, options, tokens };\n },\n pushUndefined: (state, segment, segmentIndex, name) => {\n const options = state.options.concat({ name: segment, value: undefined });\n const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: segment });\n return { ...state, options, tokens };\n },\n pushStringValue: (state, segment, segmentIndex) => {\n var _a;\n const lastOption = state.options[state.options.length - 1];\n const options = state.options.slice();\n const tokens = state.tokens.concat({ segmentIndex, type: `value` });\n lastOption.value = ((_a = lastOption.value) !== null && _a !== void 0 ? _a : []).concat([segment]);\n return { ...state, options, tokens };\n },\n setStringValue: (state, segment, segmentIndex) => {\n const lastOption = state.options[state.options.length - 1];\n const options = state.options.slice();\n const tokens = state.tokens.concat({ segmentIndex, type: `value` });\n lastOption.value = segment;\n return { ...state, options, tokens };\n },\n inhibateOptions: (state) => {\n return { ...state, ignoreOptions: true };\n },\n useHelp: (state, segment, segmentIndex, command) => {\n const [, /* name */ , index] = segment.match(HELP_REGEX);\n if (typeof index !== `undefined`) {\n return { ...state, options: [{ name: `-c`, value: String(command) }, { name: `-i`, value: index }] };\n }\n else {\n return { ...state, options: [{ name: `-c`, value: String(command) }] };\n }\n },\n setError: (state, segment, segmentIndex, errorMessage) => {\n if (segment === SpecialToken.EndOfInput || segment === SpecialToken.EndOfPartialInput) {\n return { ...state, errorMessage: `${errorMessage}.` };\n }\n else {\n return { ...state, errorMessage: `${errorMessage} (\"${segment}\").` };\n }\n },\n setOptionArityError: (state, segment) => {\n const lastOption = state.options[state.options.length - 1];\n return { ...state, errorMessage: `Not enough arguments to option ${lastOption.name}.` };\n },\n};\n// ------------------------------------------------------------------------\nconst NoLimits = Symbol();\nclass CommandBuilder {\n constructor(cliIndex, cliOpts) {\n this.allOptionNames = new Map();\n this.arity = { leading: [], trailing: [], extra: [], proxy: false };\n this.options = [];\n this.paths = [];\n this.cliIndex = cliIndex;\n this.cliOpts = cliOpts;\n }\n addPath(path) {\n this.paths.push(path);\n }\n setArity({ leading = this.arity.leading, trailing = this.arity.trailing, extra = this.arity.extra, proxy = this.arity.proxy }) {\n Object.assign(this.arity, { leading, trailing, extra, proxy });\n }\n addPositional({ name = `arg`, required = true } = {}) {\n if (!required && this.arity.extra === NoLimits)\n throw new Error(`Optional parameters cannot be declared when using .rest() or .proxy()`);\n if (!required && this.arity.trailing.length > 0)\n throw new Error(`Optional parameters cannot be declared after the required trailing positional arguments`);\n if (!required && this.arity.extra !== NoLimits) {\n this.arity.extra.push(name);\n }\n else if (this.arity.extra !== NoLimits && this.arity.extra.length === 0) {\n this.arity.leading.push(name);\n }\n else {\n this.arity.trailing.push(name);\n }\n }\n addRest({ name = `arg`, required = 0 } = {}) {\n if (this.arity.extra === NoLimits)\n throw new Error(`Infinite lists cannot be declared multiple times in the same command`);\n if (this.arity.trailing.length > 0)\n throw new Error(`Infinite lists cannot be declared after the required trailing positional arguments`);\n for (let t = 0; t < required; ++t)\n this.addPositional({ name });\n this.arity.extra = NoLimits;\n }\n addProxy({ required = 0 } = {}) {\n this.addRest({ required });\n this.arity.proxy = true;\n }\n addOption({ names: nameSet, description, arity = 0, hidden = false, required = false, allowBinding = true }) {\n if (!allowBinding && arity > 1)\n throw new Error(`The arity cannot be higher than 1 when the option only supports the --arg=value syntax`);\n if (!Number.isInteger(arity))\n throw new Error(`The arity must be an integer, got ${arity}`);\n if (arity < 0)\n throw new Error(`The arity must be positive, got ${arity}`);\n const preferredName = nameSet.reduce((longestName, name) => {\n return name.length > longestName.length ? name : longestName;\n }, ``);\n for (const name of nameSet)\n this.allOptionNames.set(name, preferredName);\n this.options.push({ preferredName, nameSet, description, arity, hidden, required, allowBinding });\n }\n setContext(context) {\n this.context = context;\n }\n usage({ detailed = true, inlineOptions = true } = {}) {\n const segments = [this.cliOpts.binaryName];\n const detailedOptionList = [];\n if (this.paths.length > 0)\n segments.push(...this.paths[0]);\n if (detailed) {\n for (const { preferredName, nameSet, arity, hidden, description, required } of this.options) {\n if (hidden)\n continue;\n const args = [];\n for (let t = 0; t < arity; ++t)\n args.push(` #${t}`);\n const definition = `${nameSet.join(`,`)}${args.join(``)}`;\n if (!inlineOptions && description) {\n detailedOptionList.push({ preferredName, nameSet, definition, description, required });\n }\n else {\n segments.push(required ? `<${definition}>` : `[${definition}]`);\n }\n }\n segments.push(...this.arity.leading.map(name => `<${name}>`));\n if (this.arity.extra === NoLimits)\n segments.push(`...`);\n else\n segments.push(...this.arity.extra.map(name => `[${name}]`));\n segments.push(...this.arity.trailing.map(name => `<${name}>`));\n }\n const usage = segments.join(` `);\n return { usage, options: detailedOptionList };\n }\n compile() {\n if (typeof this.context === `undefined`)\n throw new Error(`Assertion failed: No context attached`);\n const machine = makeStateMachine();\n let firstNode = NodeType.InitialNode;\n const candidateUsage = this.usage().usage;\n const requiredOptions = this.options\n .filter(opt => opt.required)\n .map(opt => opt.nameSet);\n firstNode = injectNode(machine, makeNode());\n registerStatic(machine, NodeType.InitialNode, SpecialToken.StartOfInput, firstNode, [`setCandidateState`, { candidateUsage, requiredOptions }]);\n const positionalArgument = this.arity.proxy\n ? `always`\n : `isNotOptionLike`;\n const paths = this.paths.length > 0\n ? this.paths\n : [[]];\n for (const path of paths) {\n let lastPathNode = firstNode;\n // We allow options to be specified before the path. Note that we\n // only do this when there is a path, otherwise there would be\n // some redundancy with the options attached later.\n if (path.length > 0) {\n const optionPathNode = injectNode(machine, makeNode());\n registerShortcut(machine, lastPathNode, optionPathNode);\n this.registerOptions(machine, optionPathNode);\n lastPathNode = optionPathNode;\n }\n for (let t = 0; t < path.length; ++t) {\n const nextPathNode = injectNode(machine, makeNode());\n registerStatic(machine, lastPathNode, path[t], nextPathNode, `pushPath`);\n lastPathNode = nextPathNode;\n if (t + 1 < path.length) {\n // Allow to pass `-h` (without anything after it) after each part of a path.\n // Note that we do not do this for the last part, otherwise there would be\n // some redundancy with the `useHelp` attached later.\n const helpNode = injectNode(machine, makeNode());\n registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);\n registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);\n }\n }\n if (this.arity.leading.length > 0 || !this.arity.proxy) {\n const helpNode = injectNode(machine, makeNode());\n registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);\n registerDynamic(machine, helpNode, `always`, helpNode, `pushExtra`);\n registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);\n this.registerOptions(machine, lastPathNode);\n }\n if (this.arity.leading.length > 0) {\n registerStatic(machine, lastPathNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, lastPathNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n let lastLeadingNode = lastPathNode;\n for (let t = 0; t < this.arity.leading.length; ++t) {\n const nextLeadingNode = injectNode(machine, makeNode());\n if (!this.arity.proxy || t + 1 !== this.arity.leading.length)\n this.registerOptions(machine, nextLeadingNode);\n if (this.arity.trailing.length > 0 || t + 1 !== this.arity.leading.length) {\n registerStatic(machine, nextLeadingNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, nextLeadingNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n registerDynamic(machine, lastLeadingNode, `isNotOptionLike`, nextLeadingNode, `pushPositional`);\n lastLeadingNode = nextLeadingNode;\n }\n let lastExtraNode = lastLeadingNode;\n if (this.arity.extra === NoLimits || this.arity.extra.length > 0) {\n const extraShortcutNode = injectNode(machine, makeNode());\n registerShortcut(machine, lastLeadingNode, extraShortcutNode);\n if (this.arity.extra === NoLimits) {\n const extraNode = injectNode(machine, makeNode());\n if (!this.arity.proxy)\n this.registerOptions(machine, extraNode);\n registerDynamic(machine, lastLeadingNode, positionalArgument, extraNode, `pushExtraNoLimits`);\n registerDynamic(machine, extraNode, positionalArgument, extraNode, `pushExtraNoLimits`);\n registerShortcut(machine, extraNode, extraShortcutNode);\n }\n else {\n for (let t = 0; t < this.arity.extra.length; ++t) {\n const nextExtraNode = injectNode(machine, makeNode());\n if (!this.arity.proxy || t > 0)\n this.registerOptions(machine, nextExtraNode);\n registerDynamic(machine, lastExtraNode, positionalArgument, nextExtraNode, `pushExtra`);\n registerShortcut(machine, nextExtraNode, extraShortcutNode);\n lastExtraNode = nextExtraNode;\n }\n }\n lastExtraNode = extraShortcutNode;\n }\n if (this.arity.trailing.length > 0) {\n registerStatic(machine, lastExtraNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, lastExtraNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n let lastTrailingNode = lastExtraNode;\n for (let t = 0; t < this.arity.trailing.length; ++t) {\n const nextTrailingNode = injectNode(machine, makeNode());\n if (!this.arity.proxy)\n this.registerOptions(machine, nextTrailingNode);\n if (t + 1 < this.arity.trailing.length) {\n registerStatic(machine, nextTrailingNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, nextTrailingNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n registerDynamic(machine, lastTrailingNode, `isNotOptionLike`, nextTrailingNode, `pushPositional`);\n lastTrailingNode = nextTrailingNode;\n }\n registerDynamic(machine, lastTrailingNode, positionalArgument, NodeType.ErrorNode, [`setError`, `Extraneous positional argument`]);\n registerStatic(machine, lastTrailingNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n registerStatic(machine, lastTrailingNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n return {\n machine,\n context: this.context,\n };\n }\n registerOptions(machine, node) {\n registerDynamic(machine, node, [`isOption`, `--`], node, `inhibateOptions`);\n registerDynamic(machine, node, [`isBatchOption`, this.allOptionNames], node, [`pushBatch`, this.allOptionNames]);\n registerDynamic(machine, node, [`isBoundOption`, this.allOptionNames, this.options], node, `pushBound`);\n registerDynamic(machine, node, [`isUnsupportedOption`, this.allOptionNames], NodeType.ErrorNode, [`setError`, `Unsupported option name`]);\n registerDynamic(machine, node, [`isInvalidOption`], NodeType.ErrorNode, [`setError`, `Invalid option name`]);\n for (const option of this.options) {\n if (option.arity === 0) {\n for (const name of option.nameSet) {\n registerDynamic(machine, node, [`isOption`, name], node, [`pushTrue`, option.preferredName]);\n if (name.startsWith(`--`) && !name.startsWith(`--no-`)) {\n registerDynamic(machine, node, [`isNegatedOption`, name], node, [`pushFalse`, option.preferredName]);\n }\n }\n }\n else {\n // We inject a new node at the end of the state machine\n let lastNode = injectNode(machine, makeNode());\n // We register transitions from the starting node to this new node\n for (const name of option.nameSet)\n registerDynamic(machine, node, [`isOption`, name], lastNode, [`pushUndefined`, option.preferredName]);\n // For each argument, we inject a new node at the end and we\n // register a transition from the current node to this new node\n for (let t = 0; t < option.arity; ++t) {\n const nextNode = injectNode(machine, makeNode());\n // We can provide better errors when another option or EndOfInput is encountered\n registerStatic(machine, lastNode, SpecialToken.EndOfInput, NodeType.ErrorNode, `setOptionArityError`);\n registerStatic(machine, lastNode, SpecialToken.EndOfPartialInput, NodeType.ErrorNode, `setOptionArityError`);\n registerDynamic(machine, lastNode, `isOptionLike`, NodeType.ErrorNode, `setOptionArityError`);\n // If the option has a single argument, no need to store it in an array\n const action = option.arity === 1\n ? `setStringValue`\n : `pushStringValue`;\n registerDynamic(machine, lastNode, `isNotOptionLike`, nextNode, action);\n lastNode = nextNode;\n }\n // In the end, we register a shortcut from\n // the last node back to the starting node\n registerShortcut(machine, lastNode, node);\n }\n }\n }\n}\nclass CliBuilder {\n static build(cbs, opts = {}) {\n return new CliBuilder(opts).commands(cbs).compile();\n }\n constructor({ binaryName = `...` } = {}) {\n this.builders = [];\n this.opts = { binaryName };\n }\n getBuilderByIndex(n) {\n if (!(n >= 0 && n < this.builders.length))\n throw new Error(`Assertion failed: Out-of-bound command index (${n})`);\n return this.builders[n];\n }\n commands(cbs) {\n for (const cb of cbs)\n cb(this.command());\n return this;\n }\n command() {\n const builder = new CommandBuilder(this.builders.length, this.opts);\n this.builders.push(builder);\n return builder;\n }\n compile() {\n const machines = [];\n const contexts = [];\n for (const builder of this.builders) {\n const { machine, context } = builder.compile();\n machines.push(machine);\n contexts.push(context);\n }\n const machine = makeAnyOfMachine(machines);\n simplifyMachine(machine);\n return {\n machine,\n contexts,\n process: (input, { partial } = {}) => {\n const endToken = partial\n ? SpecialToken.EndOfPartialInput\n : SpecialToken.EndOfInput;\n return runMachine(machine, input, { endToken });\n },\n };\n }\n}\n\nexport { CliBuilder, CommandBuilder, NoLimits, aggregateHelpStates, cloneNode, cloneTransition, debug, debugMachine, execute, injectNode, isTerminalNode, makeAnyOfMachine, makeNode, makeStateMachine, reducers, registerDynamic, registerShortcut, registerStatic, runMachineInternal, selectBestState, simplifyMachine, tests, trimSmallerBranches };\n","const MAX_LINE_LENGTH = 80;\nconst richLine = Array(MAX_LINE_LENGTH).fill(`━`);\nfor (let t = 0; t <= 24; ++t)\n richLine[richLine.length - t] = `\\x1b[38;5;${232 + t}m━`;\nconst richFormat = {\n header: str => `\\x1b[1m━━━ ${str}${str.length < MAX_LINE_LENGTH - 5 ? ` ${richLine.slice(str.length + 5).join(``)}` : `:`}\\x1b[0m`,\n bold: str => `\\x1b[1m${str}\\x1b[22m`,\n error: str => `\\x1b[31m\\x1b[1m${str}\\x1b[22m\\x1b[39m`,\n code: str => `\\x1b[36m${str}\\x1b[39m`,\n};\nconst textFormat = {\n header: str => str,\n bold: str => str,\n error: str => str,\n code: str => str,\n};\nfunction dedent(text) {\n const lines = text.split(`\\n`);\n const nonEmptyLines = lines.filter(line => line.match(/\\S/));\n const indent = nonEmptyLines.length > 0 ? nonEmptyLines.reduce((minLength, line) => Math.min(minLength, line.length - line.trimStart().length), Number.MAX_VALUE) : 0;\n return lines\n .map(line => line.slice(indent).trimRight())\n .join(`\\n`);\n}\n/**\n * Formats markdown text to be displayed to the console. Not all markdown features are supported.\n *\n * @param text The markdown text to format.\n * @param opts.format The format to use.\n * @param opts.paragraphs Whether to cut the text into paragraphs of 80 characters at most.\n */\nfunction formatMarkdownish(text, { format, paragraphs }) {\n // Enforce \\n as newline character\n text = text.replace(/\\r\\n?/g, `\\n`);\n // Remove the indentation, since it got messed up with the JS indentation\n text = dedent(text);\n // Remove surrounding newlines, since they got added for JS formatting\n text = text.replace(/^\\n+|\\n+$/g, ``);\n // List items always end with at least two newlines (in order to not be collapsed)\n text = text.replace(/^(\\s*)-([^\\n]*?)\\n+/gm, `$1-$2\\n\\n`);\n // Single newlines are removed; larger than that are collapsed into one\n text = text.replace(/\\n(\\n)?\\n*/g, ($0, $1) => $1 ? $1 : ` `);\n if (paragraphs) {\n text = text.split(/\\n/).map(paragraph => {\n // Does the paragraph starts with a list?\n const bulletMatch = paragraph.match(/^\\s*[*-][\\t ]+(.*)/);\n if (!bulletMatch)\n // No, cut the paragraphs into segments of 80 characters\n return paragraph.match(/(.{1,80})(?: |$)/g).join(`\\n`);\n const indent = paragraph.length - paragraph.trimStart().length;\n // Yes, cut the paragraphs into segments of (78 - indent) characters (to account for the prefix)\n return bulletMatch[1].match(new RegExp(`(.{1,${78 - indent}})(?: |$)`, `g`)).map((line, index) => {\n return ` `.repeat(indent) + (index === 0 ? `- ` : ` `) + line;\n }).join(`\\n`);\n }).join(`\\n\\n`);\n }\n // Highlight the code segments\n text = text.replace(/(`+)((?:.|[\\n])*?)\\1/g, ($0, $1, $2) => {\n return format.code($1 + $2 + $1);\n });\n // Highlight the bold segments\n text = text.replace(/(\\*\\*)((?:.|[\\n])*?)\\1/g, ($0, $1, $2) => {\n return format.bold($1 + $2 + $1);\n });\n return text ? `${text}\\n` : ``;\n}\n\nexport { formatMarkdownish, richFormat, textFormat };\n","import { Command } from './Command.mjs';\n\nclass HelpCommand extends Command {\n static from(state, contexts) {\n const command = new HelpCommand(contexts);\n command.path = state.path;\n for (const opt of state.options) {\n switch (opt.name) {\n case `-c`:\n {\n command.commands.push(Number(opt.value));\n }\n break;\n case `-i`:\n {\n command.index = Number(opt.value);\n }\n break;\n }\n }\n return command;\n }\n constructor(contexts) {\n super();\n this.contexts = contexts;\n this.commands = [];\n }\n async execute() {\n let commands = this.commands;\n if (typeof this.index !== `undefined` && this.index >= 0 && this.index < commands.length)\n commands = [commands[this.index]];\n if (commands.length === 0) {\n this.context.stdout.write(this.cli.usage());\n }\n else if (commands.length === 1) {\n this.context.stdout.write(this.cli.usage(this.contexts[commands[0]].commandClass, { detailed: true }));\n }\n else if (commands.length > 1) {\n this.context.stdout.write(`Multiple commands match your selection:\\n`);\n this.context.stdout.write(`\\n`);\n let index = 0;\n for (const command of this.commands)\n this.context.stdout.write(this.cli.usage(this.contexts[command].commandClass, { prefix: `${index++}. `.padStart(5) }));\n this.context.stdout.write(`\\n`);\n this.context.stdout.write(`Run again with -h=<index> to see the longer details of any of those commands.\\n`);\n }\n }\n}\n\nexport { HelpCommand };\n","import { getDefaultColorDepth, getCaptureActivator } from '../platform/node.mjs';\nimport { HELP_COMMAND_INDEX } from '../constants.mjs';\nimport { CliBuilder } from '../core.mjs';\nimport { formatMarkdownish, richFormat, textFormat } from '../format.mjs';\nimport { Command } from './Command.mjs';\nimport { HelpCommand } from './HelpCommand.mjs';\n\nconst errorCommandSymbol = Symbol(`clipanion/errorCommand`);\nasync function runExit(...args) {\n const { resolvedOptions, resolvedCommandClasses, resolvedArgv, resolvedContext, } = resolveRunParameters(args);\n const cli = Cli.from(resolvedCommandClasses, resolvedOptions);\n return cli.runExit(resolvedArgv, resolvedContext);\n}\nasync function run(...args) {\n const { resolvedOptions, resolvedCommandClasses, resolvedArgv, resolvedContext, } = resolveRunParameters(args);\n const cli = Cli.from(resolvedCommandClasses, resolvedOptions);\n return cli.run(resolvedArgv, resolvedContext);\n}\nfunction resolveRunParameters(args) {\n let resolvedOptions;\n let resolvedCommandClasses;\n let resolvedArgv;\n let resolvedContext;\n if (typeof process !== `undefined` && typeof process.argv !== `undefined`)\n resolvedArgv = process.argv.slice(2);\n switch (args.length) {\n case 1:\n {\n resolvedCommandClasses = args[0];\n }\n break;\n case 2:\n {\n if (args[0] && (args[0].prototype instanceof Command) || Array.isArray(args[0])) {\n resolvedCommandClasses = args[0];\n if (Array.isArray(args[1])) {\n resolvedArgv = args[1];\n }\n else {\n resolvedContext = args[1];\n }\n }\n else {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n }\n }\n break;\n case 3:\n {\n if (Array.isArray(args[2])) {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n resolvedArgv = args[2];\n }\n else if (args[0] && (args[0].prototype instanceof Command) || Array.isArray(args[0])) {\n resolvedCommandClasses = args[0];\n resolvedArgv = args[1];\n resolvedContext = args[2];\n }\n else {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n resolvedContext = args[2];\n }\n }\n break;\n default:\n {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n resolvedArgv = args[2];\n resolvedContext = args[3];\n }\n break;\n }\n if (typeof resolvedArgv === `undefined`)\n throw new Error(`The argv parameter must be provided when running Clipanion outside of a Node context`);\n return {\n resolvedOptions,\n resolvedCommandClasses,\n resolvedArgv,\n resolvedContext,\n };\n}\n/**\n * @template Context The context shared by all commands. Contexts are a set of values, defined when calling the `run`/`runExit` functions from the CLI instance, that will be made available to the commands via `this.context`.\n */\nclass Cli {\n /**\n * Creates a new Cli and registers all commands passed as parameters.\n *\n * @param commandClasses The Commands to register\n * @returns The created `Cli` instance\n */\n static from(commandClasses, options = {}) {\n const cli = new Cli(options);\n const resolvedCommandClasses = Array.isArray(commandClasses)\n ? commandClasses\n : [commandClasses];\n for (const commandClass of resolvedCommandClasses)\n cli.register(commandClass);\n return cli;\n }\n constructor({ binaryLabel, binaryName: binaryNameOpt = `...`, binaryVersion, enableCapture = false, enableColors } = {}) {\n this.registrations = new Map();\n this.builder = new CliBuilder({ binaryName: binaryNameOpt });\n this.binaryLabel = binaryLabel;\n this.binaryName = binaryNameOpt;\n this.binaryVersion = binaryVersion;\n this.enableCapture = enableCapture;\n this.enableColors = enableColors;\n }\n /**\n * Registers a command inside the CLI.\n */\n register(commandClass) {\n var _a;\n if (this.registrations.has(commandClass))\n throw new RangeError(`${commandClass.name} has already been registered`);\n const specs = new Map();\n const command = new commandClass();\n for (const key in command) {\n const value = command[key];\n if (typeof value === `object` && value !== null && value[Command.isOption]) {\n specs.set(key, value);\n }\n }\n const builder = this.builder.command();\n const index = builder.cliIndex;\n const paths = (_a = commandClass.paths) !== null && _a !== void 0 ? _a : command.paths;\n if (typeof paths !== `undefined`)\n for (const path of paths)\n builder.addPath(path);\n this.registrations.set(commandClass, { specs, builder, index });\n for (const [key, { definition }] of specs.entries())\n definition(builder, key);\n builder.setContext({\n commandClass,\n });\n }\n process(opts, contextArg) {\n const { input, context: userContext, partial } = typeof opts === `object` && Array.isArray(opts)\n ? { input: opts, context: contextArg }\n : opts;\n const { contexts, process } = this.builder.compile();\n const state = process(input, { partial });\n const context = {\n ...Cli.defaultContext,\n ...userContext,\n };\n switch (state.selectedIndex) {\n case HELP_COMMAND_INDEX:\n {\n const command = HelpCommand.from(state, contexts);\n command.context = context;\n command.tokens = state.tokens;\n return command;\n }\n default:\n {\n const { commandClass } = contexts[state.selectedIndex];\n const record = this.registrations.get(commandClass);\n if (typeof record === `undefined`)\n throw new Error(`Assertion failed: Expected the command class to have been registered.`);\n const command = new commandClass();\n command.context = context;\n command.tokens = state.tokens;\n command.path = state.path;\n try {\n for (const [key, { transformer }] of record.specs.entries())\n command[key] = transformer(record.builder, key, state, context);\n return command;\n }\n catch (error) {\n error[errorCommandSymbol] = command;\n throw error;\n }\n }\n break;\n }\n }\n async run(input, userContext) {\n var _a, _b;\n let command;\n const context = {\n ...Cli.defaultContext,\n ...userContext,\n };\n const colored = (_a = this.enableColors) !== null && _a !== void 0 ? _a : context.colorDepth > 1;\n if (!Array.isArray(input)) {\n command = input;\n }\n else {\n try {\n command = this.process(input, context);\n }\n catch (error) {\n context.stdout.write(this.error(error, { colored }));\n return 1;\n }\n }\n if (command.help) {\n context.stdout.write(this.usage(command, { colored, detailed: true }));\n return 0;\n }\n command.context = context;\n command.cli = {\n binaryLabel: this.binaryLabel,\n binaryName: this.binaryName,\n binaryVersion: this.binaryVersion,\n enableCapture: this.enableCapture,\n enableColors: this.enableColors,\n definitions: () => this.definitions(),\n definition: command => this.definition(command),\n error: (error, opts) => this.error(error, opts),\n format: colored => this.format(colored),\n process: (input, subContext) => this.process(input, { ...context, ...subContext }),\n run: (input, subContext) => this.run(input, { ...context, ...subContext }),\n usage: (command, opts) => this.usage(command, opts),\n };\n const activate = this.enableCapture\n ? (_b = getCaptureActivator(context)) !== null && _b !== void 0 ? _b : noopCaptureActivator\n : noopCaptureActivator;\n let exitCode;\n try {\n exitCode = await activate(() => command.validateAndExecute().catch(error => command.catch(error).then(() => 0)));\n }\n catch (error) {\n context.stdout.write(this.error(error, { colored, command }));\n return 1;\n }\n return exitCode;\n }\n async runExit(input, context) {\n process.exitCode = await this.run(input, context);\n }\n definition(commandClass, { colored = false } = {}) {\n if (!commandClass.usage)\n return null;\n const { usage: path } = this.getUsageByRegistration(commandClass, { detailed: false });\n const { usage, options } = this.getUsageByRegistration(commandClass, { detailed: true, inlineOptions: false });\n const category = typeof commandClass.usage.category !== `undefined`\n ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false })\n : undefined;\n const description = typeof commandClass.usage.description !== `undefined`\n ? formatMarkdownish(commandClass.usage.description, { format: this.format(colored), paragraphs: false })\n : undefined;\n const details = typeof commandClass.usage.details !== `undefined`\n ? formatMarkdownish(commandClass.usage.details, { format: this.format(colored), paragraphs: true })\n : undefined;\n const examples = typeof commandClass.usage.examples !== `undefined`\n ? commandClass.usage.examples.map(([label, cli]) => [formatMarkdownish(label, { format: this.format(colored), paragraphs: false }), cli.replace(/\\$0/g, this.binaryName)])\n : undefined;\n return { path, usage, category, description, details, examples, options };\n }\n definitions({ colored = false } = {}) {\n const data = [];\n for (const commandClass of this.registrations.keys()) {\n const usage = this.definition(commandClass, { colored });\n if (!usage)\n continue;\n data.push(usage);\n }\n return data;\n }\n usage(command = null, { colored, detailed = false, prefix = `$ ` } = {}) {\n var _a;\n // In case the default command is the only one, we can just show the command help rather than the general one\n if (command === null) {\n for (const commandClass of this.registrations.keys()) {\n const paths = commandClass.paths;\n const isDocumented = typeof commandClass.usage !== `undefined`;\n const isExclusivelyDefault = !paths || paths.length === 0 || (paths.length === 1 && paths[0].length === 0);\n const isDefault = isExclusivelyDefault || ((_a = paths === null || paths === void 0 ? void 0 : paths.some(path => path.length === 0)) !== null && _a !== void 0 ? _a : false);\n if (isDefault) {\n if (command) {\n command = null;\n break;\n }\n else {\n command = commandClass;\n }\n }\n else {\n if (isDocumented) {\n command = null;\n continue;\n }\n }\n }\n if (command) {\n detailed = true;\n }\n }\n // @ts-ignore\n const commandClass = command !== null && command instanceof Command\n ? command.constructor\n : command;\n let result = ``;\n if (!commandClass) {\n const commandsByCategories = new Map();\n for (const [commandClass, { index }] of this.registrations.entries()) {\n if (typeof commandClass.usage === `undefined`)\n continue;\n const category = typeof commandClass.usage.category !== `undefined`\n ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false })\n : null;\n let categoryCommands = commandsByCategories.get(category);\n if (typeof categoryCommands === `undefined`)\n commandsByCategories.set(category, categoryCommands = []);\n const { usage } = this.getUsageByIndex(index);\n categoryCommands.push({ commandClass, usage });\n }\n const categoryNames = Array.from(commandsByCategories.keys()).sort((a, b) => {\n if (a === null)\n return -1;\n if (b === null)\n return +1;\n return a.localeCompare(b, `en`, { usage: `sort`, caseFirst: `upper` });\n });\n const hasLabel = typeof this.binaryLabel !== `undefined`;\n const hasVersion = typeof this.binaryVersion !== `undefined`;\n if (hasLabel || hasVersion) {\n if (hasLabel && hasVersion)\n result += `${this.format(colored).header(`${this.binaryLabel} - ${this.binaryVersion}`)}\\n\\n`;\n else if (hasLabel)\n result += `${this.format(colored).header(`${this.binaryLabel}`)}\\n`;\n else\n result += `${this.format(colored).header(`${this.binaryVersion}`)}\\n`;\n result += ` ${this.format(colored).bold(prefix)}${this.binaryName} <command>\\n`;\n }\n else {\n result += `${this.format(colored).bold(prefix)}${this.binaryName} <command>\\n`;\n }\n for (const categoryName of categoryNames) {\n const commands = commandsByCategories.get(categoryName).slice().sort((a, b) => {\n return a.usage.localeCompare(b.usage, `en`, { usage: `sort`, caseFirst: `upper` });\n });\n const header = categoryName !== null\n ? categoryName.trim()\n : `General commands`;\n result += `\\n`;\n result += `${this.format(colored).header(`${header}`)}\\n`;\n for (const { commandClass, usage } of commands) {\n const doc = commandClass.usage.description || `undocumented`;\n result += `\\n`;\n result += ` ${this.format(colored).bold(usage)}\\n`;\n result += ` ${formatMarkdownish(doc, { format: this.format(colored), paragraphs: false })}`;\n }\n }\n result += `\\n`;\n result += formatMarkdownish(`You can also print more details about any of these commands by calling them with the \\`-h,--help\\` flag right after the command name.`, { format: this.format(colored), paragraphs: true });\n }\n else {\n if (!detailed) {\n const { usage } = this.getUsageByRegistration(commandClass);\n result += `${this.format(colored).bold(prefix)}${usage}\\n`;\n }\n else {\n const { description = ``, details = ``, examples = [], } = commandClass.usage || {};\n if (description !== ``) {\n result += formatMarkdownish(description, { format: this.format(colored), paragraphs: false }).replace(/^./, $0 => $0.toUpperCase());\n result += `\\n`;\n }\n if (details !== `` || examples.length > 0) {\n result += `${this.format(colored).header(`Usage`)}\\n`;\n result += `\\n`;\n }\n const { usage, options } = this.getUsageByRegistration(commandClass, { inlineOptions: false });\n result += `${this.format(colored).bold(prefix)}${usage}\\n`;\n if (options.length > 0) {\n result += `\\n`;\n result += `${this.format(colored).header(`Options`)}\\n`;\n const maxDefinitionLength = options.reduce((length, option) => {\n return Math.max(length, option.definition.length);\n }, 0);\n result += `\\n`;\n for (const { definition, description } of options) {\n result += ` ${this.format(colored).bold(definition.padEnd(maxDefinitionLength))} ${formatMarkdownish(description, { format: this.format(colored), paragraphs: false })}`;\n }\n }\n if (details !== ``) {\n result += `\\n`;\n result += `${this.format(colored).header(`Details`)}\\n`;\n result += `\\n`;\n result += formatMarkdownish(details, { format: this.format(colored), paragraphs: true });\n }\n if (examples.length > 0) {\n result += `\\n`;\n result += `${this.format(colored).header(`Examples`)}\\n`;\n for (const [description, example] of examples) {\n result += `\\n`;\n result += formatMarkdownish(description, { format: this.format(colored), paragraphs: false });\n result += `${example\n .replace(/^/m, ` ${this.format(colored).bold(prefix)}`)\n .replace(/\\$0/g, this.binaryName)}\\n`;\n }\n }\n }\n }\n return result;\n }\n error(error, _a) {\n var _b;\n var { colored, command = (_b = error[errorCommandSymbol]) !== null && _b !== void 0 ? _b : null } = _a === void 0 ? {} : _a;\n if (!error || typeof error !== `object` || !(`stack` in error))\n error = new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(error)})`);\n let result = ``;\n let name = error.name.replace(/([a-z])([A-Z])/g, `$1 $2`);\n if (name === `Error`)\n name = `Internal Error`;\n result += `${this.format(colored).error(name)}: ${error.message}\\n`;\n const meta = error.clipanion;\n if (typeof meta !== `undefined`) {\n if (meta.type === `usage`) {\n result += `\\n`;\n result += this.usage(command);\n }\n }\n else {\n if (error.stack) {\n result += `${error.stack.replace(/^.*\\n/, ``)}\\n`;\n }\n }\n return result;\n }\n format(colored) {\n var _a;\n return ((_a = colored !== null && colored !== void 0 ? colored : this.enableColors) !== null && _a !== void 0 ? _a : Cli.defaultContext.colorDepth > 1) ? richFormat : textFormat;\n }\n getUsageByRegistration(klass, opts) {\n const record = this.registrations.get(klass);\n if (typeof record === `undefined`)\n throw new Error(`Assertion failed: Unregistered command`);\n return this.getUsageByIndex(record.index, opts);\n }\n getUsageByIndex(n, opts) {\n return this.builder.getBuilderByIndex(n).usage(opts);\n }\n}\n/**\n * The default context of the CLI.\n *\n * Contains the stdio of the current `process`.\n */\nCli.defaultContext = {\n env: process.env,\n stdin: process.stdin,\n stdout: process.stdout,\n stderr: process.stderr,\n colorDepth: getDefaultColorDepth(),\n};\nfunction noopCaptureActivator(fn) {\n return fn();\n}\n\nexport { Cli, run, runExit };\n","import { Command } from '../Command.mjs';\n\n/**\n * A command that prints the usage of all commands.\n *\n * Paths: `-h`, `--help`\n */\nclass HelpCommand extends Command {\n async execute() {\n this.context.stdout.write(this.cli.usage());\n }\n}\nHelpCommand.paths = [[`-h`], [`--help`]];\n\nexport { HelpCommand };\n","import { Command } from '../Command.mjs';\n\n/**\n * A command that prints the version of the binary (`cli.binaryVersion`).\n *\n * Paths: `-v`, `--version`\n */\nclass VersionCommand extends Command {\n async execute() {\n var _a;\n this.context.stdout.write(`${(_a = this.cli.binaryVersion) !== null && _a !== void 0 ? _a : `<unknown>`}\\n`);\n }\n}\nVersionCommand.paths = [[`-v`], [`--version`]];\n\nexport { VersionCommand };\n","import { makeCommandOption, rerouteArguments } from './utils.mjs';\n\nfunction Boolean(descriptor, initialValueBase, optsBase) {\n const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {});\n const optNames = descriptor.split(`,`);\n const nameSet = new Set(optNames);\n return makeCommandOption({\n definition(builder) {\n builder.addOption({\n names: optNames,\n allowBinding: false,\n arity: 0,\n hidden: opts.hidden,\n description: opts.description,\n required: opts.required,\n });\n },\n transformer(builer, key, state) {\n let currentValue = initialValue;\n for (const { name, value } of state.options) {\n if (!nameSet.has(name))\n continue;\n currentValue = value;\n }\n return currentValue;\n },\n });\n}\n\nexport { Boolean };\n","import { NoLimits } from '../../core.mjs';\nimport { makeCommandOption } from './utils.mjs';\n\n/**\n * Used to annotate that the command supports any number of positional\n * arguments.\n *\n * Be careful: this function is order-dependent! Make sure to define it\n * after any positional argument you want to declare.\n *\n * This function is mutually exclusive with Option.Proxy.\n *\n * @example\n * yarn add hello world\n * ► rest = [\"hello\", \"world\"]\n */\nfunction Rest(opts = {}) {\n return makeCommandOption({\n definition(builder, key) {\n var _a;\n builder.addRest({\n name: (_a = opts.name) !== null && _a !== void 0 ? _a : key,\n required: opts.required,\n });\n },\n transformer(builder, key, state) {\n // The builder's arity.extra will always be NoLimits,\n // because it is set when we call registerDefinition\n const isRestPositional = (index) => {\n const positional = state.positionals[index];\n // A NoLimits extra (i.e. an optional rest argument)\n if (positional.extra === NoLimits)\n return true;\n // A leading positional (i.e. a required rest argument)\n if (positional.extra === false && index < builder.arity.leading.length)\n return true;\n return false;\n };\n let count = 0;\n while (count < state.positionals.length && isRestPositional(count))\n count += 1;\n return state.positionals.splice(0, count).map(({ value }) => value);\n },\n });\n}\n\nexport { Rest };\n","import { NoLimits } from '../../core.mjs';\nimport { makeCommandOption, applyValidator, rerouteArguments } from './utils.mjs';\n\nfunction StringOption(descriptor, initialValueBase, optsBase) {\n const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {});\n const { arity = 1 } = opts;\n const optNames = descriptor.split(`,`);\n const nameSet = new Set(optNames);\n return makeCommandOption({\n definition(builder) {\n builder.addOption({\n names: optNames,\n arity: opts.tolerateBoolean ? 0 : arity,\n hidden: opts.hidden,\n description: opts.description,\n required: opts.required,\n });\n },\n transformer(builder, key, state, context) {\n let usedName;\n let currentValue = initialValue;\n if (typeof opts.env !== `undefined` && context.env[opts.env]) {\n usedName = opts.env;\n currentValue = context.env[opts.env];\n }\n for (const { name, value } of state.options) {\n if (!nameSet.has(name))\n continue;\n usedName = name;\n currentValue = value;\n }\n if (typeof currentValue === `string`) {\n return applyValidator(usedName !== null && usedName !== void 0 ? usedName : key, currentValue, opts.validator);\n }\n else {\n return currentValue;\n }\n },\n });\n}\nfunction StringPositional(opts = {}) {\n const { required = true } = opts;\n return makeCommandOption({\n definition(builder, key) {\n var _a;\n builder.addPositional({\n name: (_a = opts.name) !== null && _a !== void 0 ? _a : key,\n required: opts.required,\n });\n },\n transformer(builder, key, state) {\n var _a;\n for (let i = 0; i < state.positionals.length; ++i) {\n // We skip NoLimits extras. We only care about\n // required and optional finite positionals.\n if (state.positionals[i].extra === NoLimits)\n continue;\n // We skip optional positionals when we only\n // care about required positionals.\n if (required && state.positionals[i].extra === true)\n continue;\n // We skip required positionals when we only\n // care about optional positionals.\n if (!required && state.positionals[i].extra === false)\n continue;\n // We remove the positional from the list\n const [positional] = state.positionals.splice(i, 1);\n return applyValidator((_a = opts.name) !== null && _a !== void 0 ? _a : key, positional.value, opts.validator);\n }\n return undefined;\n },\n });\n}\n// This function is badly typed, but it doesn't matter because the overloads provide the true public typings\nfunction String(descriptor, ...args) {\n if (typeof descriptor === `string`) {\n return StringOption(descriptor, ...args);\n }\n else {\n return StringPositional(descriptor);\n }\n}\n\nexport { String };\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst simpleKeyRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\nfunction getPrintable(value) {\n if (value === null)\n return `null`;\n if (value === undefined)\n return `undefined`;\n if (value === ``)\n return `an empty string`;\n if (typeof value === 'symbol')\n return `<${value.toString()}>`;\n if (Array.isArray(value))\n return `an array`;\n return JSON.stringify(value);\n}\nfunction getPrintableArray(value, conjunction) {\n if (value.length === 0)\n return `nothing`;\n if (value.length === 1)\n return getPrintable(value[0]);\n const rest = value.slice(0, -1);\n const trailing = value[value.length - 1];\n const separator = value.length > 2\n ? `, ${conjunction} `\n : ` ${conjunction} `;\n return `${rest.map(value => getPrintable(value)).join(`, `)}${separator}${getPrintable(trailing)}`;\n}\nfunction computeKey(state, key) {\n var _a, _b, _c;\n if (typeof key === `number`) {\n return `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}[${key}]`;\n }\n else if (simpleKeyRegExp.test(key)) {\n return `${(_b = state === null || state === void 0 ? void 0 : state.p) !== null && _b !== void 0 ? _b : ``}.${key}`;\n }\n else {\n return `${(_c = state === null || state === void 0 ? void 0 : state.p) !== null && _c !== void 0 ? _c : `.`}[${JSON.stringify(key)}]`;\n }\n}\nfunction plural(n, singular, plural) {\n return n === 1 ? singular : plural;\n}\n\nconst colorStringRegExp = /^#[0-9a-f]{6}$/i;\nconst colorStringAlphaRegExp = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;\n// https://stackoverflow.com/a/475217/880703\nconst base64RegExp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\n// https://stackoverflow.com/a/14166194/880703\nconst uuid4RegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i;\n// https://stackoverflow.com/a/28022901/880703 + https://www.debuggex.com/r/bl8J35wMKk48a7u_\nconst iso8601RegExp = /^(?:[1-9]\\d{3}(-?)(?:(?:0[1-9]|1[0-2])\\1(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])\\1(?:29|30)|(?:0[13578]|1[02])(?:\\1)31|00[1-9]|0[1-9]\\d|[12]\\d{2}|3(?:[0-5]\\d|6[0-5]))|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\\2)29|-?366))T(?:[01]\\d|2[0-3])(:?)[0-5]\\d(?:\\3[0-5]\\d)?(?:Z|[+-][01]\\d(?:\\3[0-5]\\d)?)$/;\n\nfunction pushError({ errors, p } = {}, message) {\n errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message}`);\n return false;\n}\nfunction makeSetter(target, key) {\n return (v) => {\n target[key] = v;\n };\n}\nfunction makeCoercionFn(target, key) {\n return (v) => {\n const previous = target[key];\n target[key] = v;\n return makeCoercionFn(target, key).bind(null, previous);\n };\n}\nfunction makeLazyCoercionFn(fn, orig, generator) {\n const commit = () => {\n fn(generator());\n return revert;\n };\n const revert = () => {\n fn(orig);\n return commit;\n };\n return commit;\n}\n\n/**\n * Create a validator that always returns true and never refines the type.\n */\nfunction isUnknown() {\n return makeValidator({\n test: (value, state) => {\n return true;\n },\n });\n}\nfunction isLiteral(expected) {\n return makeValidator({\n test: (value, state) => {\n if (value !== expected)\n return pushError(state, `Expected ${getPrintable(expected)} (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a string.\n * Refines the type to `string`.\n */\nfunction isString() {\n return makeValidator({\n test: (value, state) => {\n if (typeof value !== `string`)\n return pushError(state, `Expected a string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\nfunction isEnum(enumSpec) {\n const valuesArray = Array.isArray(enumSpec) ? enumSpec : Object.values(enumSpec);\n const isAlphaNum = valuesArray.every(item => typeof item === 'string' || typeof item === 'number');\n const values = new Set(valuesArray);\n if (values.size === 1)\n return isLiteral([...values][0]);\n return makeValidator({\n test: (value, state) => {\n if (!values.has(value)) {\n if (isAlphaNum) {\n return pushError(state, `Expected one of ${getPrintableArray(valuesArray, `or`)} (got ${getPrintable(value)})`);\n }\n else {\n return pushError(state, `Expected a valid enumeration value (got ${getPrintable(value)})`);\n }\n }\n return true;\n },\n });\n}\nconst BOOLEAN_COERCIONS = new Map([\n [`true`, true],\n [`True`, true],\n [`1`, true],\n [1, true],\n [`false`, false],\n [`False`, false],\n [`0`, false],\n [0, false],\n]);\n/**\n * Create a validator that only returns true when the tested value is a\n * boolean. Refines the type to `boolean`.\n *\n * Supports coercion:\n * - 'true' / 'True' / '1' / 1 will turn to `true`\n * - 'false' / 'False' / '0' / 0 will turn to `false`\n */\nfunction isBoolean() {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof value !== `boolean`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const coercion = BOOLEAN_COERCIONS.get(value);\n if (typeof coercion !== `undefined`) {\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);\n return true;\n }\n }\n return pushError(state, `Expected a boolean (got ${getPrintable(value)})`);\n }\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a\n * number (including floating numbers; use `cascade` and `isInteger` to\n * restrict the range further). Refines the type to `number`.\n *\n * Supports coercion.\n */\nfunction isNumber() {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof value !== `number`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n let coercion;\n if (typeof value === `string`) {\n let val;\n try {\n val = JSON.parse(value);\n }\n catch (_b) { }\n // We check against JSON.stringify that the output is the same to ensure that the number can be safely represented in JS\n if (typeof val === `number`) {\n if (JSON.stringify(val) === value) {\n coercion = val;\n }\n else {\n return pushError(state, `Received a number that can't be safely represented by the runtime (${value})`);\n }\n }\n }\n if (typeof coercion !== `undefined`) {\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);\n return true;\n }\n }\n return pushError(state, `Expected a number (got ${getPrintable(value)})`);\n }\n return true;\n },\n });\n}\n/**\n * Important: This validator only makes sense when used in conjunction with\n * coercion! It will always error when used without.\n *\n * Create a validator that only returns true when the tested value is a\n * JSON representation of the expected type. Refines the type to the\n * expected type, and casts the value into its inner value.\n */\nfunction isPayload(spec) {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) === `undefined`)\n return pushError(state, `The isPayload predicate can only be used with coercion enabled`);\n if (typeof state.coercion === `undefined`)\n return pushError(state, `Unbound coercion result`);\n if (typeof value !== `string`)\n return pushError(state, `Expected a string (got ${getPrintable(value)})`);\n let inner;\n try {\n inner = JSON.parse(value);\n }\n catch (_b) {\n return pushError(state, `Expected a JSON string (got ${getPrintable(value)})`);\n }\n const wrapper = { value: inner };\n if (!spec(inner, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(wrapper, `value`) })))\n return false;\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, wrapper.value)]);\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a\n * valid date. Refines the type to `Date`.\n *\n * Supports coercion via one of the following formats:\n * - ISO86001 strings\n * - Unix timestamps\n */\nfunction isDate() {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (!(value instanceof Date)) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n let coercion;\n if (typeof value === `string` && iso8601RegExp.test(value)) {\n coercion = new Date(value);\n }\n else {\n let timestamp;\n if (typeof value === `string`) {\n let val;\n try {\n val = JSON.parse(value);\n }\n catch (_b) { }\n if (typeof val === `number`) {\n timestamp = val;\n }\n }\n else if (typeof value === `number`) {\n timestamp = value;\n }\n if (typeof timestamp !== `undefined`) {\n if (Number.isSafeInteger(timestamp) || !Number.isSafeInteger(timestamp * 1000)) {\n coercion = new Date(timestamp * 1000);\n }\n else {\n return pushError(state, `Received a timestamp that can't be safely represented by the runtime (${value})`);\n }\n }\n }\n if (typeof coercion !== `undefined`) {\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);\n return true;\n }\n }\n return pushError(state, `Expected a date (got ${getPrintable(value)})`);\n }\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * array whose all values match the provided subspec. Refines the type to\n * `Array<T>`, with `T` being the subspec inferred type.\n *\n * Supports coercion if the `delimiter` option is set, in which case strings\n * will be split accordingly.\n */\nfunction isArray(spec, { delimiter } = {}) {\n return makeValidator({\n test: (value, state) => {\n var _a;\n const originalValue = value;\n if (typeof value === `string` && typeof delimiter !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n value = value.split(delimiter);\n }\n }\n if (!Array.isArray(value))\n return pushError(state, `Expected an array (got ${getPrintable(value)})`);\n let valid = true;\n for (let t = 0, T = value.length; t < T; ++t) {\n valid = spec(value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n if (value !== originalValue)\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);\n return valid;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * set whose all values match the provided subspec. Refines the type to\n * `Set<T>`, with `T` being the subspec inferred type.\n *\n * Supports coercion from arrays (or anything that can be coerced into an\n * array).\n */\nfunction isSet(spec, { delimiter } = {}) {\n const isArrayValidator = isArray(spec, { delimiter });\n return makeValidator({\n test: (value, state) => {\n var _a, _b;\n if (Object.getPrototypeOf(value).toString() === `[object Set]`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const originalValues = [...value];\n const coercedValues = [...value];\n if (!isArrayValidator(coercedValues, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n const updateValue = () => coercedValues.some((val, t) => val !== originalValues[t])\n ? new Set(coercedValues)\n : value;\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, makeLazyCoercionFn(state.coercion, value, updateValue)]);\n return true;\n }\n else {\n let valid = true;\n for (const subValue of value) {\n valid = spec(subValue, Object.assign({}, state)) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n return valid;\n }\n }\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const store = { value };\n if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(store, `value`) })))\n return false;\n state.coercions.push([(_b = state.p) !== null && _b !== void 0 ? _b : `.`, makeLazyCoercionFn(state.coercion, value, () => new Set(store.value))]);\n return true;\n }\n return pushError(state, `Expected a set (got ${getPrintable(value)})`);\n }\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * map whose all values match the provided subspecs. Refines the type to\n * `Map<U, V>`, with `U` being the key subspec inferred type and `V` being\n * the value subspec inferred type.\n *\n * Supports coercion from array of tuples (or anything that can be coerced into\n * an array of tuples).\n */\nfunction isMap(keySpec, valueSpec) {\n const isArrayValidator = isArray(isTuple([keySpec, valueSpec]));\n const isRecordValidator = isRecord(valueSpec, { keys: keySpec });\n return makeValidator({\n test: (value, state) => {\n var _a, _b, _c;\n if (Object.getPrototypeOf(value).toString() === `[object Map]`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const originalValues = [...value];\n const coercedValues = [...value];\n if (!isArrayValidator(coercedValues, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n const updateValue = () => coercedValues.some((val, t) => val[0] !== originalValues[t][0] || val[1] !== originalValues[t][1])\n ? new Map(coercedValues)\n : value;\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, makeLazyCoercionFn(state.coercion, value, updateValue)]);\n return true;\n }\n else {\n let valid = true;\n for (const [key, subValue] of value) {\n valid = keySpec(key, Object.assign({}, state)) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n valid = valueSpec(subValue, Object.assign(Object.assign({}, state), { p: computeKey(state, key) })) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n return valid;\n }\n }\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const store = { value };\n if (Array.isArray(value)) {\n if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n state.coercions.push([(_b = state.p) !== null && _b !== void 0 ? _b : `.`, makeLazyCoercionFn(state.coercion, value, () => new Map(store.value))]);\n return true;\n }\n else {\n if (!isRecordValidator(value, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(store, `value`) })))\n return false;\n state.coercions.push([(_c = state.p) !== null && _c !== void 0 ? _c : `.`, makeLazyCoercionFn(state.coercion, value, () => new Map(Object.entries(store.value)))]);\n return true;\n }\n }\n return pushError(state, `Expected a map (got ${getPrintable(value)})`);\n }\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a\n * tuple whose each value matches the corresponding subspec. Refines the type\n * into a tuple whose each item has the type inferred by the corresponding\n * tuple.\n *\n * Supports coercion if the `delimiter` option is set, in which case strings\n * will be split accordingly.\n */\nfunction isTuple(spec, { delimiter } = {}) {\n const lengthValidator = hasExactLength(spec.length);\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof value === `string` && typeof delimiter !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n value = value.split(delimiter);\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);\n }\n }\n if (!Array.isArray(value))\n return pushError(state, `Expected a tuple (got ${getPrintable(value)})`);\n let valid = lengthValidator(value, Object.assign({}, state));\n for (let t = 0, T = value.length; t < T && t < spec.length; ++t) {\n valid = spec[t](value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n return valid;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object with any amount of properties that must all match the provided\n * subspec. Refines the type to `Record<string, T>`, with `T` being the\n * subspec inferred type.\n *\n * Keys can be optionally validated as well by using the `keys` optional\n * subspec parameter.\n */\nfunction isRecord(spec, { keys: keySpec = null, } = {}) {\n const isArrayValidator = isArray(isTuple([keySpec !== null && keySpec !== void 0 ? keySpec : isString(), spec]));\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (Array.isArray(value)) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n value = Object.fromEntries(value);\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);\n return true;\n }\n }\n if (typeof value !== `object` || value === null)\n return pushError(state, `Expected an object (got ${getPrintable(value)})`);\n const keys = Object.keys(value);\n let valid = true;\n for (let t = 0, T = keys.length; t < T && (valid || (state === null || state === void 0 ? void 0 : state.errors) != null); ++t) {\n const key = keys[t];\n const sub = value[key];\n if (key === `__proto__` || key === `constructor`) {\n valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Unsafe property name`);\n continue;\n }\n if (keySpec !== null && !keySpec(key, state)) {\n valid = false;\n continue;\n }\n if (!spec(sub, Object.assign(Object.assign({}, state), { p: computeKey(state, key), coercion: makeCoercionFn(value, key) }))) {\n valid = false;\n continue;\n }\n }\n return valid;\n },\n });\n}\n/**\n * @deprecated Replace `isDict` by `isRecord`\n */\nfunction isDict(spec, opts = {}) {\n return isRecord(spec, opts);\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object whose all properties match their corresponding subspec. Refines\n * the type into an object whose each property has the type inferred by the\n * corresponding subspec.\n *\n * Unlike `t.isPartial`, `t.isObject` doesn't allow extraneous properties by\n * default. This behaviour can be altered by using the `extra` optional\n * subspec parameter, which will be called to validate an object only\n * containing the extraneous properties.\n *\n * Calling `t.isObject(..., {extra: t.isRecord(t.isUnknown())})` is\n * essentially the same as calling `t.isPartial(...)`.\n */\nfunction isObject(props, { extra: extraSpec = null, } = {}) {\n const specKeys = Object.keys(props);\n const validator = makeValidator({\n test: (value, state) => {\n if (typeof value !== `object` || value === null)\n return pushError(state, `Expected an object (got ${getPrintable(value)})`);\n const keys = new Set([...specKeys, ...Object.keys(value)]);\n const extra = {};\n let valid = true;\n for (const key of keys) {\n if (key === `constructor` || key === `__proto__`) {\n valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Unsafe property name`);\n }\n else {\n const spec = Object.prototype.hasOwnProperty.call(props, key)\n ? props[key]\n : undefined;\n const sub = Object.prototype.hasOwnProperty.call(value, key)\n ? value[key]\n : undefined;\n if (typeof spec !== `undefined`) {\n valid = spec(sub, Object.assign(Object.assign({}, state), { p: computeKey(state, key), coercion: makeCoercionFn(value, key) })) && valid;\n }\n else if (extraSpec === null) {\n valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Extraneous property (got ${getPrintable(sub)})`);\n }\n else {\n Object.defineProperty(extra, key, {\n enumerable: true,\n get: () => sub,\n set: makeSetter(value, key)\n });\n }\n }\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n if (extraSpec !== null && (valid || (state === null || state === void 0 ? void 0 : state.errors) != null))\n valid = extraSpec(extra, state) && valid;\n return valid;\n },\n });\n return Object.assign(validator, {\n properties: props,\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object whose all properties match their corresponding subspec. Refines\n * the type into an object whose each property has the type inferred by the\n * corresponding subspec.\n *\n * Unlike `t.isObject`, `t.isPartial` allows extraneous properties. The\n * resulting type will reflect this behaviour by including an index\n * signature (each extraneous property being typed `unknown`).\n *\n * Calling `t.isPartial(...)` is essentially the same as calling\n * `t.isObject(..., {extra: t.isRecord(t.isUnknown())})`.\n */\nfunction isPartial(props) {\n return isObject(props, { extra: isRecord(isUnknown()) });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object whose prototype is derived from the given class. Refines the type\n * into a class instance.\n */\nconst isInstanceOf = (constructor) => makeValidator({\n test: (value, state) => {\n if (!(value instanceof constructor))\n return pushError(state, `Expected an instance of ${constructor.name} (got ${getPrintable(value)})`);\n return true;\n },\n});\n/**\n * Create a validator that only returns true when the tested value is an\n * object matching any of the provided subspecs. If the optional `exclusive`\n * parameter is set to `true`, the behaviour changes so that the validator\n * only returns true when exactly one subspec matches.\n */\nconst isOneOf = (specs, { exclusive = false, } = {}) => makeValidator({\n test: (value, state) => {\n var _a, _b, _c;\n const matches = [];\n const errorBuffer = typeof (state === null || state === void 0 ? void 0 : state.errors) !== `undefined`\n ? [] : undefined;\n for (let t = 0, T = specs.length; t < T; ++t) {\n const subErrors = typeof (state === null || state === void 0 ? void 0 : state.errors) !== `undefined`\n ? [] : undefined;\n const subCoercions = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`\n ? [] : undefined;\n if (specs[t](value, Object.assign(Object.assign({}, state), { errors: subErrors, coercions: subCoercions, p: `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}#${t + 1}` }))) {\n matches.push([`#${t + 1}`, subCoercions]);\n if (!exclusive) {\n break;\n }\n }\n else {\n errorBuffer === null || errorBuffer === void 0 ? void 0 : errorBuffer.push(subErrors[0]);\n }\n }\n if (matches.length === 1) {\n const [, subCoercions] = matches[0];\n if (typeof subCoercions !== `undefined`)\n (_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions);\n return true;\n }\n if (matches.length > 1)\n pushError(state, `Expected to match exactly a single predicate (matched ${matches.join(`, `)})`);\n else\n (_c = state === null || state === void 0 ? void 0 : state.errors) === null || _c === void 0 ? void 0 : _c.push(...errorBuffer);\n return false;\n },\n});\n\nfunction makeTrait(value) {\n return () => {\n return value;\n };\n}\nfunction makeValidator({ test }) {\n return makeTrait(test)();\n}\nclass TypeAssertionError extends Error {\n constructor({ errors } = {}) {\n let errorMessage = `Type mismatch`;\n if (errors && errors.length > 0) {\n errorMessage += `\\n`;\n for (const error of errors) {\n errorMessage += `\\n- ${error}`;\n }\n }\n super(errorMessage);\n }\n}\n/**\n * Check that the specified value matches the given validator, and throws an\n * exception if it doesn't. Refine the type if it passes.\n */\nfunction assert(val, validator) {\n if (!validator(val)) {\n throw new TypeAssertionError();\n }\n}\n/**\n * Check that the specified value matches the given validator, and throws an\n * exception if it doesn't. Refine the type if it passes.\n *\n * Thrown exceptions include details about what exactly looks invalid in the\n * tested value.\n */\nfunction assertWithErrors(val, validator) {\n const errors = [];\n if (!validator(val, { errors })) {\n throw new TypeAssertionError({ errors });\n }\n}\n/**\n * Compile-time only. Refine the type as if the validator was matching the\n * tested value, but doesn't actually run it. Similar to the classic `as`\n * operator in TypeScript.\n */\nfunction softAssert(val, validator) {\n // It's a soft assert; we tell TypeScript about the type, but we don't need to check it\n}\nfunction as(value, validator, { coerce = false, errors: storeErrors, throw: throws } = {}) {\n const errors = storeErrors ? [] : undefined;\n if (!coerce) {\n if (validator(value, { errors })) {\n return throws ? value : { value, errors: undefined };\n }\n else if (!throws) {\n return { value: undefined, errors: errors !== null && errors !== void 0 ? errors : true };\n }\n else {\n throw new TypeAssertionError({ errors });\n }\n }\n const state = { value };\n const coercion = makeCoercionFn(state, `value`);\n const coercions = [];\n if (!validator(value, { errors, coercion, coercions })) {\n if (!throws) {\n return { value: undefined, errors: errors !== null && errors !== void 0 ? errors : true };\n }\n else {\n throw new TypeAssertionError({ errors });\n }\n }\n for (const [, apply] of coercions)\n apply();\n if (throws) {\n return state.value;\n }\n else {\n return { value: state.value, errors: undefined };\n }\n}\n/**\n * Create and return a new function that apply the given validators to each\n * corresponding argument passed to the function and throws an exception in\n * case of a mismatch.\n */\nfunction fn(validators, fn) {\n const isValidArgList = isTuple(validators);\n return ((...args) => {\n const check = isValidArgList(args);\n if (!check)\n throw new TypeAssertionError();\n return fn(...args);\n });\n}\n\n/**\n * Create a validator that checks that the tested array or string has at least\n * the specified length.\n */\nfunction hasMinLength(length) {\n return makeValidator({\n test: (value, state) => {\n if (!(value.length >= length))\n return pushError(state, `Expected to have a length of at least ${length} elements (got ${value.length})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested array or string has at most\n * the specified length.\n */\nfunction hasMaxLength(length) {\n return makeValidator({\n test: (value, state) => {\n if (!(value.length <= length))\n return pushError(state, `Expected to have a length of at most ${length} elements (got ${value.length})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested array or string has exactly\n * the specified length.\n */\nfunction hasExactLength(length) {\n return makeValidator({\n test: (value, state) => {\n if (!(value.length === length))\n return pushError(state, `Expected to have a length of exactly ${length} elements (got ${value.length})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested array only contains unique\n * elements. The optional `map` parameter lets you define a transform to\n * apply before making the check (the result of this transform will be\n * discarded afterwards).\n */\nfunction hasUniqueItems({ map, } = {}) {\n return makeValidator({\n test: (value, state) => {\n const set = new Set();\n const dup = new Set();\n for (let t = 0, T = value.length; t < T; ++t) {\n const sub = value[t];\n const key = typeof map !== `undefined`\n ? map(sub)\n : sub;\n if (set.has(key)) {\n if (dup.has(key))\n continue;\n pushError(state, `Expected to contain unique elements; got a duplicate with ${getPrintable(value)}`);\n dup.add(key);\n }\n else {\n set.add(key);\n }\n }\n return dup.size === 0;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is strictly less than 0.\n */\nfunction isNegative() {\n return makeValidator({\n test: (value, state) => {\n if (!(value <= 0))\n return pushError(state, `Expected to be negative (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is equal or greater\n * than 0.\n */\nfunction isPositive() {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= 0))\n return pushError(state, `Expected to be positive (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is equal or greater\n * than the specified reference.\n */\nfunction isAtLeast(n) {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= n))\n return pushError(state, `Expected to be at least ${n} (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is equal or smaller\n * than the specified reference.\n */\nfunction isAtMost(n) {\n return makeValidator({\n test: (value, state) => {\n if (!(value <= n))\n return pushError(state, `Expected to be at most ${n} (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is between the\n * specified references (including the upper boundary).\n */\nfunction isInInclusiveRange(a, b) {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= a && value <= b))\n return pushError(state, `Expected to be in the [${a}; ${b}] range (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is between the\n * specified references (excluding the upper boundary).\n */\nfunction isInExclusiveRange(a, b) {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= a && value < b))\n return pushError(state, `Expected to be in the [${a}; ${b}[ range (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is an integer.\n *\n * By default Typanion will also check that it's a *safe* integer. For example,\n * 2^53 wouldn't be a safe integer because 2^53+1 would be rounded to 2^53,\n * which could put your applications at risk when used in loops.\n */\nfunction isInteger({ unsafe = false, } = {}) {\n return makeValidator({\n test: (value, state) => {\n if (value !== Math.round(value))\n return pushError(state, `Expected to be an integer (got ${value})`);\n if (!unsafe && !Number.isSafeInteger(value))\n return pushError(state, `Expected to be a safe integer (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string matches the given\n * regular expression.\n */\nfunction matchesRegExp(regExp) {\n return makeValidator({\n test: (value, state) => {\n if (!regExp.test(value))\n return pushError(state, `Expected to match the pattern ${regExp.toString()} (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string only contain lowercase\n * characters.\n */\nfunction isLowerCase() {\n return makeValidator({\n test: (value, state) => {\n if (value !== value.toLowerCase())\n return pushError(state, `Expected to be all-lowercase (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string only contain uppercase\n * characters.\n */\nfunction isUpperCase() {\n return makeValidator({\n test: (value, state) => {\n if (value !== value.toUpperCase())\n return pushError(state, `Expected to be all-uppercase (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is a valid UUID v4.\n */\nfunction isUUID4() {\n return makeValidator({\n test: (value, state) => {\n if (!uuid4RegExp.test(value))\n return pushError(state, `Expected to be a valid UUID v4 (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is a valid ISO8601\n * date.\n */\nfunction isISO8601() {\n return makeValidator({\n test: (value, state) => {\n if (!iso8601RegExp.test(value))\n return pushError(state, `Expected to be a valid ISO 8601 date string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is a valid hexadecimal\n * color. Setting the optional `alpha` parameter to `true` allows an additional\n * transparency channel to be included.\n */\nfunction isHexColor({ alpha = false, }) {\n return makeValidator({\n test: (value, state) => {\n const res = alpha\n ? colorStringRegExp.test(value)\n : colorStringAlphaRegExp.test(value);\n if (!res)\n return pushError(state, `Expected to be a valid hexadecimal color string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is valid base64.\n */\nfunction isBase64() {\n return makeValidator({\n test: (value, state) => {\n if (!base64RegExp.test(value))\n return pushError(state, `Expected to be a valid base 64 string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is valid JSON. A\n * optional spec can be passed as parameter, in which case the data will be\n * deserialized and validated against the spec (coercion will be disabled\n * for this check, and even if successful the returned value will still be\n * the original string).\n */\nfunction isJSON(spec = isUnknown()) {\n return makeValidator({\n test: (value, state) => {\n let data;\n try {\n data = JSON.parse(value);\n }\n catch (_a) {\n return pushError(state, `Expected to be a valid JSON string (got ${getPrintable(value)})`);\n }\n return spec(data, state);\n },\n });\n}\n\nfunction cascade(spec, ...followups) {\n const resolvedFollowups = Array.isArray(followups[0])\n ? followups[0]\n : followups;\n return makeValidator({\n test: (value, state) => {\n var _a, _b;\n const context = { value: value };\n const subCoercion = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`\n ? makeCoercionFn(context, `value`) : undefined;\n const subCoercions = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`\n ? [] : undefined;\n if (!spec(value, Object.assign(Object.assign({}, state), { coercion: subCoercion, coercions: subCoercions })))\n return false;\n const reverts = [];\n if (typeof subCoercions !== `undefined`)\n for (const [, coercion] of subCoercions)\n reverts.push(coercion());\n try {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (context.value !== value) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, context.value)]);\n }\n (_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions);\n }\n return resolvedFollowups.every(spec => {\n return spec(context.value, state);\n });\n }\n finally {\n for (const revert of reverts) {\n revert();\n }\n }\n },\n });\n}\nfunction applyCascade(spec, ...followups) {\n const resolvedFollowups = Array.isArray(followups[0])\n ? followups[0]\n : followups;\n return cascade(spec, resolvedFollowups);\n}\n/**\n * Wraps the given spec to also allow `undefined`.\n */\nfunction isOptional(spec) {\n return makeValidator({\n test: (value, state) => {\n if (typeof value === `undefined`)\n return true;\n return spec(value, state);\n },\n });\n}\n/**\n * Wraps the given spec to also allow `null`.\n */\nfunction isNullable(spec) {\n return makeValidator({\n test: (value, state) => {\n if (value === null)\n return true;\n return spec(value, state);\n },\n });\n}\nconst checks = {\n missing: (keys, key) => keys.has(key),\n undefined: (keys, key, value) => keys.has(key) && typeof value[key] !== `undefined`,\n nil: (keys, key, value) => keys.has(key) && value[key] != null,\n falsy: (keys, key, value) => keys.has(key) && !!value[key],\n};\n/**\n * Create a validator that checks that the tested object contains the specified\n * keys.\n*/\nfunction hasRequiredKeys(requiredKeys, options) {\n var _a;\n const requiredSet = new Set(requiredKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n const problems = [];\n for (const key of requiredSet)\n if (!check(keys, key, value))\n problems.push(key);\n if (problems.length > 0)\n return pushError(state, `Missing required ${plural(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);\n return true;\n },\n });\n}\n/**\n* Create a validator that checks that the tested object contains at least one\n* of the specified keys.\n*/\nfunction hasAtLeastOneKey(requiredKeys, options) {\n var _a;\n const requiredSet = new Set(requiredKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = Object.keys(value);\n const valid = keys.some(key => check(requiredSet, key, value));\n if (!valid)\n return pushError(state, `Missing at least one property from ${getPrintableArray(Array.from(requiredSet), `or`)}`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested object contains none of the\n * specified keys.\n*/\nfunction hasForbiddenKeys(forbiddenKeys, options) {\n var _a;\n const forbiddenSet = new Set(forbiddenKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n const problems = [];\n for (const key of forbiddenSet)\n if (check(keys, key, value))\n problems.push(key);\n if (problems.length > 0)\n return pushError(state, `Forbidden ${plural(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested object contains at most one\n * of the specified keys.\n */\nfunction hasMutuallyExclusiveKeys(exclusiveKeys, options) {\n var _a;\n const exclusiveSet = new Set(exclusiveKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n const used = [];\n for (const key of exclusiveSet)\n if (check(keys, key, value))\n used.push(key);\n if (used.length > 1)\n return pushError(state, `Mutually exclusive properties ${getPrintableArray(used, `and`)}`);\n return true;\n },\n });\n}\n(function (KeyRelationship) {\n KeyRelationship[\"Forbids\"] = \"Forbids\";\n KeyRelationship[\"Requires\"] = \"Requires\";\n})(exports.KeyRelationship || (exports.KeyRelationship = {}));\nconst keyRelationships = {\n [exports.KeyRelationship.Forbids]: {\n expect: false,\n message: `forbids using`,\n },\n [exports.KeyRelationship.Requires]: {\n expect: true,\n message: `requires using`,\n },\n};\n/**\n * Create a validator that checks that, when the specified subject property is\n * set, the relationship is satisfied.\n */\nfunction hasKeyRelationship(subject, relationship, others, options) {\n var _a, _b;\n const skipped = new Set((_a = options === null || options === void 0 ? void 0 : options.ignore) !== null && _a !== void 0 ? _a : []);\n const check = checks[(_b = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _b !== void 0 ? _b : 'missing'];\n const otherSet = new Set(others);\n const spec = keyRelationships[relationship];\n const conjunction = relationship === exports.KeyRelationship.Forbids\n ? `or`\n : `and`;\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n if (!check(keys, subject, value) || skipped.has(value[subject]))\n return true;\n const problems = [];\n for (const key of otherSet)\n if ((check(keys, key, value) && !skipped.has(value[key])) !== spec.expect)\n problems.push(key);\n if (problems.length >= 1)\n return pushError(state, `Property \"${subject}\" ${spec.message} ${plural(problems.length, `property`, `properties`)} ${getPrintableArray(problems, conjunction)}`);\n return true;\n },\n });\n}\n\nexports.TypeAssertionError = TypeAssertionError;\nexports.applyCascade = applyCascade;\nexports.as = as;\nexports.assert = assert;\nexports.assertWithErrors = assertWithErrors;\nexports.cascade = cascade;\nexports.fn = fn;\nexports.hasAtLeastOneKey = hasAtLeastOneKey;\nexports.hasExactLength = hasExactLength;\nexports.hasForbiddenKeys = hasForbiddenKeys;\nexports.hasKeyRelationship = hasKeyRelationship;\nexports.hasMaxLength = hasMaxLength;\nexports.hasMinLength = hasMinLength;\nexports.hasMutuallyExclusiveKeys = hasMutuallyExclusiveKeys;\nexports.hasRequiredKeys = hasRequiredKeys;\nexports.hasUniqueItems = hasUniqueItems;\nexports.isArray = isArray;\nexports.isAtLeast = isAtLeast;\nexports.isAtMost = isAtMost;\nexports.isBase64 = isBase64;\nexports.isBoolean = isBoolean;\nexports.isDate = isDate;\nexports.isDict = isDict;\nexports.isEnum = isEnum;\nexports.isHexColor = isHexColor;\nexports.isISO8601 = isISO8601;\nexports.isInExclusiveRange = isInExclusiveRange;\nexports.isInInclusiveRange = isInInclusiveRange;\nexports.isInstanceOf = isInstanceOf;\nexports.isInteger = isInteger;\nexports.isJSON = isJSON;\nexports.isLiteral = isLiteral;\nexports.isLowerCase = isLowerCase;\nexports.isMap = isMap;\nexports.isNegative = isNegative;\nexports.isNullable = isNullable;\nexports.isNumber = isNumber;\nexports.isObject = isObject;\nexports.isOneOf = isOneOf;\nexports.isOptional = isOptional;\nexports.isPartial = isPartial;\nexports.isPayload = isPayload;\nexports.isPositive = isPositive;\nexports.isRecord = isRecord;\nexports.isSet = isSet;\nexports.isString = isString;\nexports.isTuple = isTuple;\nexports.isUUID4 = isUUID4;\nexports.isUnknown = isUnknown;\nexports.isUpperCase = isUpperCase;\nexports.makeTrait = makeTrait;\nexports.makeValidator = makeValidator;\nexports.matchesRegExp = matchesRegExp;\nexports.softAssert = softAssert;\n","import { Command, Option } from 'clipanion';\nimport { isEnum } from 'typanion';\n\nimport type { ColorMode, LogLevel } from '../internal/Logger.js';\n\nimport { ManagedScript } from '../ManagedScript.js';\n\nconst isLogLevel = isEnum(['debug', 'error', 'info', 'silent', 'warn'] as const);\n\nconst isColorModes = isEnum(['always', 'auto', 'never'] as const);\n\nexport class RootCommand extends Command {\n static override paths = [Command.Default];\n static override usage = Command.Usage({\n description: 'Run a script from the managed-script configuration.',\n details: 'Resolves the script name from the first positional argument, MANAGED_SCRIPT_NAME or npm_lifecycle_event, then executes it. Use --dry-run,-n to print the resolved command without executing it. Use --loglevel, --silent,-s or --verbose,-v to control status messages, forwarded to the script as MANAGED_SCRIPT_LOGLEVEL. Use --color[=WHEN] or --no-color to control ANSI colors (WHEN: auto, always, never).',\n });\n\n readonly color = Option.String('--color', {\n description: 'Control ANSI colors (auto, always, never). Bare --color means always.',\n required: false,\n tolerateBoolean: true,\n validator: isColorModes,\n });\n\n readonly cwd = Option.String('--cwd', {\n description: 'Working directory used to resolve configuration and run the script.',\n required: false,\n });\n\n readonly dryRun = Option.Boolean('--dry-run,-n', false, {\n description: 'Print the resolved command instead of executing it.',\n });\n\n readonly loglevel = Option.String('--loglevel', {\n description: 'Set the log level (silent, error, warn, info, debug). Default: info.',\n required: false,\n validator: isLogLevel,\n });\n\n readonly scriptArgs = Option.Rest();\n\n readonly silent = Option.Boolean('--silent,-s', false, {\n description: 'Alias for --loglevel silent.',\n });\n\n readonly verbose = Option.Boolean('--verbose,-v', false, {\n description: 'Alias for --loglevel debug.',\n });\n\n async execute(): Promise<number> {\n const [scriptName, ...scriptArgs] = this.scriptArgs;\n let color: ColorMode | undefined;\n if (this.color === true) {\n color = 'always';\n } else if (this.color === false) {\n color = 'never';\n } else if (this.color != null) {\n color = this.color;\n }\n let logLevel: LogLevel | undefined;\n if (this.silent) {\n logLevel = 'silent';\n } else if (this.verbose) {\n logLevel = 'debug';\n } else if (this.loglevel != null) {\n logLevel = this.loglevel;\n }\n\n try {\n await ManagedScript.runScript({\n context: {\n cli: { color, cwd: this.cwd, dryRun: this.dryRun, logLevel },\n stderr: this.context.stderr,\n stdout: this.context.stdout,\n },\n parameters: {\n scriptArgs,\n scriptName,\n },\n });\n return 0;\n } catch (error) {\n this.context.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n }\n}\n","import { Builtins, Cli } from 'clipanion';\n\nimport { meta } from '../meta.js';\nimport { RootCommand } from './RootCommand.js';\n\nexport async function runCLI(): Promise<void> {\n const cli = new Cli({\n binaryLabel: meta.binaryLabel,\n binaryName: meta.binaryName,\n binaryVersion: meta.binaryVersion,\n });\n\n cli.register(RootCommand);\n cli.register(Builtins.HelpCommand);\n cli.register(Builtins.VersionCommand);\n\n try {\n await cli.runExit(process.argv.slice(2), {\n stderr: process.stderr,\n stdin: process.stdin,\n stdout: process.stdout,\n });\n } catch (error) {\n console.error(error instanceof Error ? error.message : error);\n process.exitCode = 1;\n }\n}\n","#!/usr/bin/env node\nimport { runCLI } from './cli/runCLI.js';\n\nvoid runCLI();\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI;CACH,SAAU,cAAc;CACrB,aAAa,kBAAkB;CAC/B,aAAa,gBAAgB;CAC7B,aAAa,uBAAuB;AACxC,EAAA,CAAG,iBAAiB,eAAe,CAAC,EAAE;AACtC,IAAI;CACH,SAAU,UAAU;CACjB,SAAS,SAAS,iBAAiB,KAAK;CACxC,SAAS,SAAS,iBAAiB,KAAK;CACxC,SAAS,SAAS,eAAe,KAAK;CACtC,SAAS,SAAS,gBAAgB,KAAK;AAC3C,EAAA,CAAG,aAAa,WAAW,CAAC,EAAE;AAE9B,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,gBAAgB;AACtB,MAAM,WAAW,QAAQ,IAAI,cAAc;;;;;;;;ACX3C,IAAM,aAAN,cAAyB,MAAM;CAC3B,YAAY,SAAS;EACjB,MAAM,OAAO;EACb,KAAK,YAAY,EAAE,MAAM,QAAQ;EACjC,KAAK,OAAO;CAChB;AACJ;AACA,IAAM,qBAAN,cAAiC,MAAM;CACnC,YAAY,OAAO,YAAY;EAC3B,MAAM;EACN,KAAK,QAAQ;EACb,KAAK,aAAa;EAClB,KAAK,YAAY,EAAE,MAAM,OAAO;EAChC,KAAK,OAAO;EACZ,IAAI,KAAK,WAAW,WAAW,GAC3B,KAAK,UAAU;OAEd,IAAI,KAAK,WAAW,OAAM,cAAa,UAAU,WAAW,QAAQ,UAAU,WAAW,WAAW,EAAE,CAAC,MAAM,GAAG;GACjH,MAAM,CAAC,EAAE,YAAY,KAAK;GAC1B,KAAK,UAAU,GAAG,OAAO,MAAM,KAAK,WAAW,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,KAAK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AAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;GACvF,OAAO;EACT;CACF;AACF;;;AClFA,eAAsB,SAAwB;CAC5C,MAAM,MAAM,IAAI,IAAI;EAClB,aAAa,KAAK;EAClB,YAAY,KAAK;EACjB,eAAe,KAAK;CACtB,CAAC;CAED,IAAI,SAAS,WAAW;CACxB,IAAI,SAASE,WAAoB;CACjC,IAAI,SAASC,cAAuB;CAEpC,IAAI;EACF,MAAM,IAAI,QAAQ,QAAQ,KAAK,MAAM,CAAC,GAAG;GACvC,QAAQ,QAAQ;GAChB,OAAO,QAAQ;GACf,QAAQ,QAAQ;EAClB,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;EAC5D,QAAQ,WAAW;CACrB;AACF;;;ACvBK,OAAO"}
1
+ {"version":3,"file":"cli.js","names":["HelpCommand","HelpCommand","String","isEnum","Option.String","Option.Boolean","Option.Rest","Builtins.HelpCommand","Builtins.VersionCommand"],"sources":["../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/constants.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/errors.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/utils.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/Command.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/platform/node.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/core.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/format.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/HelpCommand.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/Cli.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/builtins/help.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/builtins/version.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/Boolean.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/Rest.mjs","../../../node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/advanced/options/String.mjs","../../../node_modules/.pnpm/typanion@3.14.0/node_modules/typanion/lib/index.js","../src/cli/RootCommand.ts","../src/cli/runCLI.ts","../src/cli.ts"],"sourcesContent":["var SpecialToken;\n(function (SpecialToken) {\n SpecialToken[\"StartOfInput\"] = \"\\0\";\n SpecialToken[\"EndOfInput\"] = \"\\u0001\";\n SpecialToken[\"EndOfPartialInput\"] = \"\\u0002\";\n})(SpecialToken || (SpecialToken = {}));\nvar NodeType;\n(function (NodeType) {\n NodeType[NodeType[\"InitialNode\"] = 0] = \"InitialNode\";\n NodeType[NodeType[\"SuccessNode\"] = 1] = \"SuccessNode\";\n NodeType[NodeType[\"ErrorNode\"] = 2] = \"ErrorNode\";\n NodeType[NodeType[\"CustomNode\"] = 3] = \"CustomNode\";\n})(NodeType || (NodeType = {}));\nconst HELP_COMMAND_INDEX = -1;\nconst HELP_REGEX = /^(-h|--help)(?:=([0-9]+))?$/;\nconst OPTION_REGEX = /^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/;\nconst BATCH_REGEX = /^-[a-zA-Z]{2,}$/;\nconst BINDING_REGEX = /^([^=]+)=([\\s\\S]*)$/;\nconst IS_DEBUG = process.env.DEBUG_CLI === `1`;\n\nexport { BATCH_REGEX, BINDING_REGEX, HELP_COMMAND_INDEX, HELP_REGEX, IS_DEBUG, NodeType, OPTION_REGEX, SpecialToken };\n","import { SpecialToken } from './constants.mjs';\n\n/**\n * A generic usage error with the name `UsageError`.\n *\n * It should be used over `Error` only when it's the user's fault.\n */\nclass UsageError extends Error {\n constructor(message) {\n super(message);\n this.clipanion = { type: `usage` };\n this.name = `UsageError`;\n }\n}\nclass UnknownSyntaxError extends Error {\n constructor(input, candidates) {\n super();\n this.input = input;\n this.candidates = candidates;\n this.clipanion = { type: `none` };\n this.name = `UnknownSyntaxError`;\n if (this.candidates.length === 0) {\n this.message = `Command not found, but we're not sure what's the alternative.`;\n }\n else if (this.candidates.every(candidate => candidate.reason !== null && candidate.reason === candidates[0].reason)) {\n const [{ reason }] = this.candidates;\n this.message = `${reason}\\n\\n${this.candidates.map(({ usage }) => `$ ${usage}`).join(`\\n`)}`;\n }\n else if (this.candidates.length === 1) {\n const [{ usage }] = this.candidates;\n this.message = `Command not found; did you mean:\\n\\n$ ${usage}\\n${whileRunning(input)}`;\n }\n else {\n this.message = `Command not found; did you mean one of:\\n\\n${this.candidates.map(({ usage }, index) => {\n return `${`${index}.`.padStart(4)} ${usage}`;\n }).join(`\\n`)}\\n\\n${whileRunning(input)}`;\n }\n }\n}\nclass AmbiguousSyntaxError extends Error {\n constructor(input, usages) {\n super();\n this.input = input;\n this.usages = usages;\n this.clipanion = { type: `none` };\n this.name = `AmbiguousSyntaxError`;\n this.message = `Cannot find which to pick amongst the following alternatives:\\n\\n${this.usages.map((usage, index) => {\n return `${`${index}.`.padStart(4)} ${usage}`;\n }).join(`\\n`)}\\n\\n${whileRunning(input)}`;\n }\n}\nconst whileRunning = (input) => `While running ${input.filter(token => {\n return token !== SpecialToken.EndOfInput && token !== SpecialToken.EndOfPartialInput;\n}).map(token => {\n const json = JSON.stringify(token);\n if (token.match(/\\s/) || token.length === 0 || json !== `\"${token}\"`) {\n return json;\n }\n else {\n return token;\n }\n}).join(` `)}`;\n\nexport { AmbiguousSyntaxError, UnknownSyntaxError, UsageError };\n","import { UsageError } from '../../errors.mjs';\n\nconst isOptionSymbol = Symbol(`clipanion/isOption`);\nfunction makeCommandOption(spec) {\n // We lie! But it's for the good cause: the cli engine will turn the specs into proper values after instantiation.\n return { ...spec, [isOptionSymbol]: true };\n}\nfunction rerouteArguments(a, b) {\n if (typeof a === `undefined`)\n return [a, b];\n if (typeof a === `object` && a !== null && !Array.isArray(a)) {\n return [undefined, a];\n }\n else {\n return [a, b];\n }\n}\nfunction cleanValidationError(message, { mergeName = false } = {}) {\n const match = message.match(/^([^:]+): (.*)$/m);\n if (!match)\n return `validation failed`;\n let [, path, line] = match;\n if (mergeName)\n line = line[0].toLowerCase() + line.slice(1);\n line = path !== `.` || !mergeName\n ? `${path.replace(/^\\.(\\[|$)/, `$1`)}: ${line}`\n : `: ${line}`;\n return line;\n}\nfunction formatError(message, errors) {\n if (errors.length === 1) {\n return new UsageError(`${message}${cleanValidationError(errors[0], { mergeName: true })}`);\n }\n else {\n return new UsageError(`${message}:\\n${errors.map(error => `\\n- ${cleanValidationError(error)}`).join(``)}`);\n }\n}\nfunction applyValidator(name, value, validator) {\n if (typeof validator === `undefined`)\n return value;\n const errors = [];\n const coercions = [];\n const coercion = (v) => {\n const orig = value;\n value = v;\n return coercion.bind(null, orig);\n };\n const check = validator(value, { errors, coercions, coercion });\n if (!check)\n throw formatError(`Invalid value for ${name}`, errors);\n for (const [, op] of coercions)\n op();\n return value;\n}\n\nexport { applyValidator, cleanValidationError, formatError, isOptionSymbol, makeCommandOption, rerouteArguments };\n","import { formatError, isOptionSymbol } from './options/utils.mjs';\n\n/**\n * Base abstract class for CLI commands. The main thing to remember is to\n * declare an async `execute` member function that will be called when the\n * command is invoked from the CLI, and optionally a `paths` property to\n * declare the set of paths under which the command should be exposed.\n */\nclass Command {\n constructor() {\n /**\n * Predefined that will be set to true if `-h,--help` has been used, in\n * which case `Command#execute` won't be called.\n */\n this.help = false;\n }\n /**\n * Defines the usage information for the given command.\n */\n static Usage(usage) {\n return usage;\n }\n /**\n * Standard error handler which will simply rethrow the error. Can be used\n * to add custom logic to handle errors from the command or simply return\n * the parent class error handling.\n */\n async catch(error) {\n throw error;\n }\n async validateAndExecute() {\n const commandClass = this.constructor;\n const cascade = commandClass.schema;\n if (Array.isArray(cascade)) {\n const { isDict, isUnknown, applyCascade } = await import('typanion');\n const schema = applyCascade(isDict(isUnknown()), cascade);\n const errors = [];\n const coercions = [];\n const check = schema(this, { errors, coercions });\n if (!check)\n throw formatError(`Invalid option schema`, errors);\n for (const [, op] of coercions) {\n op();\n }\n }\n else if (cascade != null) {\n throw new Error(`Invalid command schema`);\n }\n const exitCode = await this.execute();\n if (typeof exitCode !== `undefined`) {\n return exitCode;\n }\n else {\n return 0;\n }\n }\n}\n/**\n * Used to detect option definitions.\n */\nCommand.isOption = isOptionSymbol;\n/**\n * Just an helper to use along with the `paths` fields, to make it\n * clearer that a command is the default one.\n *\n * @example\n * class MyCommand extends Command {\n * static paths = [Command.Default];\n * }\n */\nCommand.Default = [];\n\nexport { Command };\n","import tty from 'tty';\n\nfunction getDefaultColorDepth() {\n if (tty && `getColorDepth` in tty.WriteStream.prototype)\n return tty.WriteStream.prototype.getColorDepth();\n if (process.env.FORCE_COLOR === `0`)\n return 1;\n if (process.env.FORCE_COLOR === `1`)\n return 8;\n if (typeof process.stdout !== `undefined` && process.stdout.isTTY)\n return 8;\n return 1;\n}\nlet gContextStorage;\nfunction getCaptureActivator(context) {\n let contextStorage = gContextStorage;\n if (typeof contextStorage === `undefined`) {\n if (context.stdout === process.stdout && context.stderr === process.stderr)\n return null;\n const { AsyncLocalStorage: LazyAsyncLocalStorage } = require(`async_hooks`);\n contextStorage = gContextStorage = new LazyAsyncLocalStorage();\n const origStdoutWrite = process.stdout._write;\n process.stdout._write = function (chunk, encoding, cb) {\n const context = contextStorage.getStore();\n if (typeof context === `undefined`)\n return origStdoutWrite.call(this, chunk, encoding, cb);\n return context.stdout.write(chunk, encoding, cb);\n };\n const origStderrWrite = process.stderr._write;\n process.stderr._write = function (chunk, encoding, cb) {\n const context = contextStorage.getStore();\n if (typeof context === `undefined`)\n return origStderrWrite.call(this, chunk, encoding, cb);\n return context.stderr.write(chunk, encoding, cb);\n };\n }\n return (fn) => {\n return contextStorage.run(context, fn);\n };\n}\n\nexport { getCaptureActivator, getDefaultColorDepth };\n","import { IS_DEBUG, NodeType, SpecialToken, HELP_COMMAND_INDEX, BATCH_REGEX, BINDING_REGEX, OPTION_REGEX, HELP_REGEX } from './constants.mjs';\nimport { UnknownSyntaxError, AmbiguousSyntaxError } from './errors.mjs';\n\n// ------------------------------------------------------------------------\nfunction debug(str) {\n if (IS_DEBUG) {\n console.log(str);\n }\n}\nconst basicHelpState = {\n candidateUsage: null,\n requiredOptions: [],\n errorMessage: null,\n ignoreOptions: false,\n path: [],\n positionals: [],\n options: [],\n remainder: null,\n selectedIndex: HELP_COMMAND_INDEX,\n tokens: [],\n};\nfunction makeStateMachine() {\n const stateMachine = {\n nodes: [],\n };\n for (let t = 0; t < NodeType.CustomNode; ++t)\n stateMachine.nodes.push(makeNode());\n return stateMachine;\n}\nfunction makeAnyOfMachine(inputs) {\n const output = makeStateMachine();\n const heads = [];\n let offset = output.nodes.length;\n for (const input of inputs) {\n heads.push(offset);\n for (let t = 0; t < input.nodes.length; ++t)\n if (!isTerminalNode(t))\n output.nodes.push(cloneNode(input.nodes[t], offset));\n offset += input.nodes.length - NodeType.CustomNode + 1;\n }\n for (const head of heads)\n registerShortcut(output, NodeType.InitialNode, head);\n return output;\n}\nfunction injectNode(machine, node) {\n machine.nodes.push(node);\n return machine.nodes.length - 1;\n}\nfunction simplifyMachine(input) {\n const visited = new Set();\n const process = (node) => {\n if (visited.has(node))\n return;\n visited.add(node);\n const nodeDef = input.nodes[node];\n for (const transitions of Object.values(nodeDef.statics))\n for (const { to } of transitions)\n process(to);\n for (const [, { to }] of nodeDef.dynamics)\n process(to);\n for (const { to } of nodeDef.shortcuts)\n process(to);\n const shortcuts = new Set(nodeDef.shortcuts.map(({ to }) => to));\n while (nodeDef.shortcuts.length > 0) {\n const { to } = nodeDef.shortcuts.shift();\n const toDef = input.nodes[to];\n for (const [segment, transitions] of Object.entries(toDef.statics)) {\n const store = !Object.prototype.hasOwnProperty.call(nodeDef.statics, segment)\n ? nodeDef.statics[segment] = []\n : nodeDef.statics[segment];\n for (const transition of transitions) {\n if (!store.some(({ to }) => transition.to === to)) {\n store.push(transition);\n }\n }\n }\n for (const [test, transition] of toDef.dynamics)\n if (!nodeDef.dynamics.some(([otherTest, { to }]) => test === otherTest && transition.to === to))\n nodeDef.dynamics.push([test, transition]);\n for (const transition of toDef.shortcuts) {\n if (!shortcuts.has(transition.to)) {\n nodeDef.shortcuts.push(transition);\n shortcuts.add(transition.to);\n }\n }\n }\n };\n process(NodeType.InitialNode);\n}\nfunction debugMachine(machine, { prefix = `` } = {}) {\n // Don't iterate unless it's needed\n if (IS_DEBUG) {\n debug(`${prefix}Nodes are:`);\n for (let t = 0; t < machine.nodes.length; ++t) {\n debug(`${prefix} ${t}: ${JSON.stringify(machine.nodes[t])}`);\n }\n }\n}\nfunction runMachineInternal(machine, input, partial = false) {\n debug(`Running a vm on ${JSON.stringify(input)}`);\n let branches = [{\n node: NodeType.InitialNode,\n state: {\n candidateUsage: null,\n requiredOptions: [],\n errorMessage: null,\n ignoreOptions: false,\n options: [],\n path: [],\n positionals: [],\n remainder: null,\n selectedIndex: null,\n tokens: [],\n },\n }];\n debugMachine(machine, { prefix: ` ` });\n const tokens = [SpecialToken.StartOfInput, ...input];\n for (let t = 0; t < tokens.length; ++t) {\n const segment = tokens[t];\n const isEOI = segment === SpecialToken.EndOfInput || segment === SpecialToken.EndOfPartialInput;\n // The -1 is because we added a START_OF_INPUT token\n const segmentIndex = t - 1;\n debug(` Processing ${JSON.stringify(segment)}`);\n const nextBranches = [];\n for (const { node, state } of branches) {\n debug(` Current node is ${node}`);\n const nodeDef = machine.nodes[node];\n if (node === NodeType.ErrorNode) {\n nextBranches.push({ node, state });\n continue;\n }\n console.assert(nodeDef.shortcuts.length === 0, `Shortcuts should have been eliminated by now`);\n const hasExactMatch = Object.prototype.hasOwnProperty.call(nodeDef.statics, segment);\n if (!partial || t < tokens.length - 1 || hasExactMatch) {\n if (hasExactMatch) {\n const transitions = nodeDef.statics[segment];\n for (const { to, reducer } of transitions) {\n nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment, segmentIndex) : state });\n debug(` Static transition to ${to} found`);\n }\n }\n else {\n debug(` No static transition found`);\n }\n }\n else {\n let hasMatches = false;\n for (const candidate of Object.keys(nodeDef.statics)) {\n if (!candidate.startsWith(segment))\n continue;\n if (segment === candidate) {\n for (const { to, reducer } of nodeDef.statics[candidate]) {\n nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment, segmentIndex) : state });\n debug(` Static transition to ${to} found`);\n }\n }\n else {\n for (const { to } of nodeDef.statics[candidate]) {\n nextBranches.push({ node: to, state: { ...state, remainder: candidate.slice(segment.length) } });\n debug(` Static transition to ${to} found (partial match)`);\n }\n }\n hasMatches = true;\n }\n if (!hasMatches) {\n debug(` No partial static transition found`);\n }\n }\n if (!isEOI) {\n for (const [test, { to, reducer }] of nodeDef.dynamics) {\n if (execute(tests, test, state, segment, segmentIndex)) {\n nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment, segmentIndex) : state });\n debug(` Dynamic transition to ${to} found (via ${test})`);\n }\n }\n }\n }\n if (nextBranches.length === 0 && isEOI && input.length === 1) {\n return [{\n node: NodeType.InitialNode,\n state: basicHelpState,\n }];\n }\n if (nextBranches.length === 0) {\n throw new UnknownSyntaxError(input, branches.filter(({ node }) => {\n return node !== NodeType.ErrorNode;\n }).map(({ state }) => {\n return { usage: state.candidateUsage, reason: null };\n }));\n }\n if (nextBranches.every(({ node }) => node === NodeType.ErrorNode)) {\n throw new UnknownSyntaxError(input, nextBranches.map(({ state }) => {\n return { usage: state.candidateUsage, reason: state.errorMessage };\n }));\n }\n branches = trimSmallerBranches(nextBranches);\n }\n if (branches.length > 0) {\n debug(` Results:`);\n for (const branch of branches) {\n debug(` - ${branch.node} -> ${JSON.stringify(branch.state)}`);\n }\n }\n else {\n debug(` No results`);\n }\n return branches;\n}\nfunction runMachine(machine, input, { endToken = SpecialToken.EndOfInput } = {}) {\n const branches = runMachineInternal(machine, [...input, endToken]);\n return selectBestState(input, branches.map(({ state }) => {\n return state;\n }));\n}\nfunction trimSmallerBranches(branches) {\n let maxPathSize = 0;\n for (const { state } of branches)\n if (state.path.length > maxPathSize)\n maxPathSize = state.path.length;\n return branches.filter(({ state }) => {\n return state.path.length === maxPathSize;\n });\n}\nfunction selectBestState(input, states) {\n const terminalStates = states.filter(state => {\n return state.selectedIndex !== null;\n });\n if (terminalStates.length === 0)\n throw new Error();\n const requiredOptionsSetStates = terminalStates.filter(state => state.selectedIndex === HELP_COMMAND_INDEX || state.requiredOptions.every(names => names.some(name => state.options.find(opt => opt.name === name))));\n if (requiredOptionsSetStates.length === 0) {\n throw new UnknownSyntaxError(input, terminalStates.map(state => ({\n usage: state.candidateUsage,\n reason: null,\n })));\n }\n let maxPathSize = 0;\n for (const state of requiredOptionsSetStates)\n if (state.path.length > maxPathSize)\n maxPathSize = state.path.length;\n const bestPathBranches = requiredOptionsSetStates.filter(state => {\n return state.path.length === maxPathSize;\n });\n const getPositionalCount = (state) => state.positionals.filter(({ extra }) => {\n return !extra;\n }).length + state.options.length;\n const statesWithPositionalCount = bestPathBranches.map(state => {\n return { state, positionalCount: getPositionalCount(state) };\n });\n let maxPositionalCount = 0;\n for (const { positionalCount } of statesWithPositionalCount)\n if (positionalCount > maxPositionalCount)\n maxPositionalCount = positionalCount;\n const bestPositionalStates = statesWithPositionalCount.filter(({ positionalCount }) => {\n return positionalCount === maxPositionalCount;\n }).map(({ state }) => {\n return state;\n });\n const fixedStates = aggregateHelpStates(bestPositionalStates);\n if (fixedStates.length > 1)\n throw new AmbiguousSyntaxError(input, fixedStates.map(state => state.candidateUsage));\n return fixedStates[0];\n}\nfunction aggregateHelpStates(states) {\n const notHelps = [];\n const helps = [];\n for (const state of states) {\n if (state.selectedIndex === HELP_COMMAND_INDEX) {\n helps.push(state);\n }\n else {\n notHelps.push(state);\n }\n }\n if (helps.length > 0) {\n notHelps.push({\n ...basicHelpState,\n path: findCommonPrefix(...helps.map(state => state.path)),\n options: helps.reduce((options, state) => options.concat(state.options), []),\n });\n }\n return notHelps;\n}\nfunction findCommonPrefix(firstPath, secondPath, ...rest) {\n if (secondPath === undefined)\n return Array.from(firstPath);\n return findCommonPrefix(firstPath.filter((segment, i) => segment === secondPath[i]), ...rest);\n}\nfunction makeNode() {\n return {\n dynamics: [],\n shortcuts: [],\n statics: {},\n };\n}\nfunction isTerminalNode(node) {\n return node === NodeType.SuccessNode || node === NodeType.ErrorNode;\n}\nfunction cloneTransition(input, offset = 0) {\n const to = !isTerminalNode(input.to)\n ? input.to >= NodeType.CustomNode\n ? input.to + offset - NodeType.CustomNode + 1\n : input.to + offset\n : input.to;\n return {\n to,\n reducer: input.reducer,\n };\n}\nfunction cloneNode(input, offset = 0) {\n const output = makeNode();\n for (const [test, transition] of input.dynamics)\n output.dynamics.push([test, cloneTransition(transition, offset)]);\n for (const transition of input.shortcuts)\n output.shortcuts.push(cloneTransition(transition, offset));\n for (const [segment, transitions] of Object.entries(input.statics))\n output.statics[segment] = transitions.map(transition => cloneTransition(transition, offset));\n return output;\n}\nfunction registerDynamic(machine, from, test, to, reducer) {\n machine.nodes[from].dynamics.push([\n test,\n { to, reducer: reducer },\n ]);\n}\nfunction registerShortcut(machine, from, to, reducer) {\n machine.nodes[from].shortcuts.push({ to, reducer: reducer });\n}\nfunction registerStatic(machine, from, test, to, reducer) {\n const store = !Object.prototype.hasOwnProperty.call(machine.nodes[from].statics, test)\n ? machine.nodes[from].statics[test] = []\n : machine.nodes[from].statics[test];\n store.push({ to, reducer: reducer });\n}\nfunction execute(store, callback, state, segment, segmentIndex) {\n // TypeScript's control flow can't properly narrow\n // generic conditionals for some mysterious reason\n if (Array.isArray(callback)) {\n const [name, ...args] = callback;\n return store[name](state, segment, segmentIndex, ...args);\n }\n else {\n return store[callback](state, segment, segmentIndex);\n }\n}\nconst tests = {\n always: () => {\n return true;\n },\n isOptionLike: (state, segment) => {\n return !state.ignoreOptions && (segment !== `-` && segment.startsWith(`-`));\n },\n isNotOptionLike: (state, segment) => {\n return state.ignoreOptions || segment === `-` || !segment.startsWith(`-`);\n },\n isOption: (state, segment, segmentIndex, name) => {\n return !state.ignoreOptions && segment === name;\n },\n isBatchOption: (state, segment, segmentIndex, names) => {\n return !state.ignoreOptions && BATCH_REGEX.test(segment) && [...segment.slice(1)].every(name => names.has(`-${name}`));\n },\n isBoundOption: (state, segment, segmentIndex, names, options) => {\n const optionParsing = segment.match(BINDING_REGEX);\n return !state.ignoreOptions && !!optionParsing && OPTION_REGEX.test(optionParsing[1]) && names.has(optionParsing[1])\n // Disallow bound options with no arguments (i.e. booleans)\n && options.filter(opt => opt.nameSet.includes(optionParsing[1])).every(opt => opt.allowBinding);\n },\n isNegatedOption: (state, segment, segmentIndex, name) => {\n return !state.ignoreOptions && segment === `--no-${name.slice(2)}`;\n },\n isHelp: (state, segment) => {\n return !state.ignoreOptions && HELP_REGEX.test(segment);\n },\n isUnsupportedOption: (state, segment, segmentIndex, names) => {\n return !state.ignoreOptions && segment.startsWith(`-`) && OPTION_REGEX.test(segment) && !names.has(segment);\n },\n isInvalidOption: (state, segment) => {\n return !state.ignoreOptions && segment.startsWith(`-`) && !OPTION_REGEX.test(segment);\n },\n};\nconst reducers = {\n setCandidateState: (state, segment, segmentIndex, candidateState) => {\n return { ...state, ...candidateState };\n },\n setSelectedIndex: (state, segment, segmentIndex, index) => {\n return { ...state, selectedIndex: index };\n },\n pushBatch: (state, segment, segmentIndex, names) => {\n const options = state.options.slice();\n const tokens = state.tokens.slice();\n for (let t = 1; t < segment.length; ++t) {\n const name = names.get(`-${segment[t]}`);\n const slice = t === 1 ? [0, 2] : [t, t + 1];\n options.push({ name, value: true });\n tokens.push({ segmentIndex, type: `option`, option: name, slice });\n }\n return { ...state, options, tokens };\n },\n pushBound: (state, segment, segmentIndex) => {\n const [, name, value] = segment.match(BINDING_REGEX);\n const options = state.options.concat({ name, value });\n const tokens = state.tokens.concat([\n { segmentIndex, type: `option`, slice: [0, name.length], option: name },\n { segmentIndex, type: `assign`, slice: [name.length, name.length + 1] },\n { segmentIndex, type: `value`, slice: [name.length + 1, name.length + value.length + 1] },\n ]);\n return { ...state, options, tokens };\n },\n pushPath: (state, segment, segmentIndex) => {\n const path = state.path.concat(segment);\n const tokens = state.tokens.concat({ segmentIndex, type: `path` });\n return { ...state, path, tokens };\n },\n pushPositional: (state, segment, segmentIndex) => {\n const positionals = state.positionals.concat({ value: segment, extra: false });\n const tokens = state.tokens.concat({ segmentIndex, type: `positional` });\n return { ...state, positionals, tokens };\n },\n pushExtra: (state, segment, segmentIndex) => {\n const positionals = state.positionals.concat({ value: segment, extra: true });\n const tokens = state.tokens.concat({ segmentIndex, type: `positional` });\n return { ...state, positionals, tokens };\n },\n pushExtraNoLimits: (state, segment, segmentIndex) => {\n const positionals = state.positionals.concat({ value: segment, extra: NoLimits });\n const tokens = state.tokens.concat({ segmentIndex, type: `positional` });\n return { ...state, positionals, tokens };\n },\n pushTrue: (state, segment, segmentIndex, name) => {\n const options = state.options.concat({ name, value: true });\n const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: name });\n return { ...state, options, tokens };\n },\n pushFalse: (state, segment, segmentIndex, name) => {\n const options = state.options.concat({ name, value: false });\n const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: name });\n return { ...state, options, tokens };\n },\n pushUndefined: (state, segment, segmentIndex, name) => {\n const options = state.options.concat({ name: segment, value: undefined });\n const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: segment });\n return { ...state, options, tokens };\n },\n pushStringValue: (state, segment, segmentIndex) => {\n var _a;\n const lastOption = state.options[state.options.length - 1];\n const options = state.options.slice();\n const tokens = state.tokens.concat({ segmentIndex, type: `value` });\n lastOption.value = ((_a = lastOption.value) !== null && _a !== void 0 ? _a : []).concat([segment]);\n return { ...state, options, tokens };\n },\n setStringValue: (state, segment, segmentIndex) => {\n const lastOption = state.options[state.options.length - 1];\n const options = state.options.slice();\n const tokens = state.tokens.concat({ segmentIndex, type: `value` });\n lastOption.value = segment;\n return { ...state, options, tokens };\n },\n inhibateOptions: (state) => {\n return { ...state, ignoreOptions: true };\n },\n useHelp: (state, segment, segmentIndex, command) => {\n const [, /* name */ , index] = segment.match(HELP_REGEX);\n if (typeof index !== `undefined`) {\n return { ...state, options: [{ name: `-c`, value: String(command) }, { name: `-i`, value: index }] };\n }\n else {\n return { ...state, options: [{ name: `-c`, value: String(command) }] };\n }\n },\n setError: (state, segment, segmentIndex, errorMessage) => {\n if (segment === SpecialToken.EndOfInput || segment === SpecialToken.EndOfPartialInput) {\n return { ...state, errorMessage: `${errorMessage}.` };\n }\n else {\n return { ...state, errorMessage: `${errorMessage} (\"${segment}\").` };\n }\n },\n setOptionArityError: (state, segment) => {\n const lastOption = state.options[state.options.length - 1];\n return { ...state, errorMessage: `Not enough arguments to option ${lastOption.name}.` };\n },\n};\n// ------------------------------------------------------------------------\nconst NoLimits = Symbol();\nclass CommandBuilder {\n constructor(cliIndex, cliOpts) {\n this.allOptionNames = new Map();\n this.arity = { leading: [], trailing: [], extra: [], proxy: false };\n this.options = [];\n this.paths = [];\n this.cliIndex = cliIndex;\n this.cliOpts = cliOpts;\n }\n addPath(path) {\n this.paths.push(path);\n }\n setArity({ leading = this.arity.leading, trailing = this.arity.trailing, extra = this.arity.extra, proxy = this.arity.proxy }) {\n Object.assign(this.arity, { leading, trailing, extra, proxy });\n }\n addPositional({ name = `arg`, required = true } = {}) {\n if (!required && this.arity.extra === NoLimits)\n throw new Error(`Optional parameters cannot be declared when using .rest() or .proxy()`);\n if (!required && this.arity.trailing.length > 0)\n throw new Error(`Optional parameters cannot be declared after the required trailing positional arguments`);\n if (!required && this.arity.extra !== NoLimits) {\n this.arity.extra.push(name);\n }\n else if (this.arity.extra !== NoLimits && this.arity.extra.length === 0) {\n this.arity.leading.push(name);\n }\n else {\n this.arity.trailing.push(name);\n }\n }\n addRest({ name = `arg`, required = 0 } = {}) {\n if (this.arity.extra === NoLimits)\n throw new Error(`Infinite lists cannot be declared multiple times in the same command`);\n if (this.arity.trailing.length > 0)\n throw new Error(`Infinite lists cannot be declared after the required trailing positional arguments`);\n for (let t = 0; t < required; ++t)\n this.addPositional({ name });\n this.arity.extra = NoLimits;\n }\n addProxy({ required = 0 } = {}) {\n this.addRest({ required });\n this.arity.proxy = true;\n }\n addOption({ names: nameSet, description, arity = 0, hidden = false, required = false, allowBinding = true }) {\n if (!allowBinding && arity > 1)\n throw new Error(`The arity cannot be higher than 1 when the option only supports the --arg=value syntax`);\n if (!Number.isInteger(arity))\n throw new Error(`The arity must be an integer, got ${arity}`);\n if (arity < 0)\n throw new Error(`The arity must be positive, got ${arity}`);\n const preferredName = nameSet.reduce((longestName, name) => {\n return name.length > longestName.length ? name : longestName;\n }, ``);\n for (const name of nameSet)\n this.allOptionNames.set(name, preferredName);\n this.options.push({ preferredName, nameSet, description, arity, hidden, required, allowBinding });\n }\n setContext(context) {\n this.context = context;\n }\n usage({ detailed = true, inlineOptions = true } = {}) {\n const segments = [this.cliOpts.binaryName];\n const detailedOptionList = [];\n if (this.paths.length > 0)\n segments.push(...this.paths[0]);\n if (detailed) {\n for (const { preferredName, nameSet, arity, hidden, description, required } of this.options) {\n if (hidden)\n continue;\n const args = [];\n for (let t = 0; t < arity; ++t)\n args.push(` #${t}`);\n const definition = `${nameSet.join(`,`)}${args.join(``)}`;\n if (!inlineOptions && description) {\n detailedOptionList.push({ preferredName, nameSet, definition, description, required });\n }\n else {\n segments.push(required ? `<${definition}>` : `[${definition}]`);\n }\n }\n segments.push(...this.arity.leading.map(name => `<${name}>`));\n if (this.arity.extra === NoLimits)\n segments.push(`...`);\n else\n segments.push(...this.arity.extra.map(name => `[${name}]`));\n segments.push(...this.arity.trailing.map(name => `<${name}>`));\n }\n const usage = segments.join(` `);\n return { usage, options: detailedOptionList };\n }\n compile() {\n if (typeof this.context === `undefined`)\n throw new Error(`Assertion failed: No context attached`);\n const machine = makeStateMachine();\n let firstNode = NodeType.InitialNode;\n const candidateUsage = this.usage().usage;\n const requiredOptions = this.options\n .filter(opt => opt.required)\n .map(opt => opt.nameSet);\n firstNode = injectNode(machine, makeNode());\n registerStatic(machine, NodeType.InitialNode, SpecialToken.StartOfInput, firstNode, [`setCandidateState`, { candidateUsage, requiredOptions }]);\n const positionalArgument = this.arity.proxy\n ? `always`\n : `isNotOptionLike`;\n const paths = this.paths.length > 0\n ? this.paths\n : [[]];\n for (const path of paths) {\n let lastPathNode = firstNode;\n // We allow options to be specified before the path. Note that we\n // only do this when there is a path, otherwise there would be\n // some redundancy with the options attached later.\n if (path.length > 0) {\n const optionPathNode = injectNode(machine, makeNode());\n registerShortcut(machine, lastPathNode, optionPathNode);\n this.registerOptions(machine, optionPathNode);\n lastPathNode = optionPathNode;\n }\n for (let t = 0; t < path.length; ++t) {\n const nextPathNode = injectNode(machine, makeNode());\n registerStatic(machine, lastPathNode, path[t], nextPathNode, `pushPath`);\n lastPathNode = nextPathNode;\n if (t + 1 < path.length) {\n // Allow to pass `-h` (without anything after it) after each part of a path.\n // Note that we do not do this for the last part, otherwise there would be\n // some redundancy with the `useHelp` attached later.\n const helpNode = injectNode(machine, makeNode());\n registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);\n registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);\n }\n }\n if (this.arity.leading.length > 0 || !this.arity.proxy) {\n const helpNode = injectNode(machine, makeNode());\n registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);\n registerDynamic(machine, helpNode, `always`, helpNode, `pushExtra`);\n registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);\n this.registerOptions(machine, lastPathNode);\n }\n if (this.arity.leading.length > 0) {\n registerStatic(machine, lastPathNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, lastPathNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n let lastLeadingNode = lastPathNode;\n for (let t = 0; t < this.arity.leading.length; ++t) {\n const nextLeadingNode = injectNode(machine, makeNode());\n if (!this.arity.proxy || t + 1 !== this.arity.leading.length)\n this.registerOptions(machine, nextLeadingNode);\n if (this.arity.trailing.length > 0 || t + 1 !== this.arity.leading.length) {\n registerStatic(machine, nextLeadingNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, nextLeadingNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n registerDynamic(machine, lastLeadingNode, `isNotOptionLike`, nextLeadingNode, `pushPositional`);\n lastLeadingNode = nextLeadingNode;\n }\n let lastExtraNode = lastLeadingNode;\n if (this.arity.extra === NoLimits || this.arity.extra.length > 0) {\n const extraShortcutNode = injectNode(machine, makeNode());\n registerShortcut(machine, lastLeadingNode, extraShortcutNode);\n if (this.arity.extra === NoLimits) {\n const extraNode = injectNode(machine, makeNode());\n if (!this.arity.proxy)\n this.registerOptions(machine, extraNode);\n registerDynamic(machine, lastLeadingNode, positionalArgument, extraNode, `pushExtraNoLimits`);\n registerDynamic(machine, extraNode, positionalArgument, extraNode, `pushExtraNoLimits`);\n registerShortcut(machine, extraNode, extraShortcutNode);\n }\n else {\n for (let t = 0; t < this.arity.extra.length; ++t) {\n const nextExtraNode = injectNode(machine, makeNode());\n if (!this.arity.proxy || t > 0)\n this.registerOptions(machine, nextExtraNode);\n registerDynamic(machine, lastExtraNode, positionalArgument, nextExtraNode, `pushExtra`);\n registerShortcut(machine, nextExtraNode, extraShortcutNode);\n lastExtraNode = nextExtraNode;\n }\n }\n lastExtraNode = extraShortcutNode;\n }\n if (this.arity.trailing.length > 0) {\n registerStatic(machine, lastExtraNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, lastExtraNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n let lastTrailingNode = lastExtraNode;\n for (let t = 0; t < this.arity.trailing.length; ++t) {\n const nextTrailingNode = injectNode(machine, makeNode());\n if (!this.arity.proxy)\n this.registerOptions(machine, nextTrailingNode);\n if (t + 1 < this.arity.trailing.length) {\n registerStatic(machine, nextTrailingNode, SpecialToken.EndOfInput, NodeType.ErrorNode, [`setError`, `Not enough positional arguments`]);\n registerStatic(machine, nextTrailingNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n registerDynamic(machine, lastTrailingNode, `isNotOptionLike`, nextTrailingNode, `pushPositional`);\n lastTrailingNode = nextTrailingNode;\n }\n registerDynamic(machine, lastTrailingNode, positionalArgument, NodeType.ErrorNode, [`setError`, `Extraneous positional argument`]);\n registerStatic(machine, lastTrailingNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n registerStatic(machine, lastTrailingNode, SpecialToken.EndOfPartialInput, NodeType.SuccessNode, [`setSelectedIndex`, this.cliIndex]);\n }\n return {\n machine,\n context: this.context,\n };\n }\n registerOptions(machine, node) {\n registerDynamic(machine, node, [`isOption`, `--`], node, `inhibateOptions`);\n registerDynamic(machine, node, [`isBatchOption`, this.allOptionNames], node, [`pushBatch`, this.allOptionNames]);\n registerDynamic(machine, node, [`isBoundOption`, this.allOptionNames, this.options], node, `pushBound`);\n registerDynamic(machine, node, [`isUnsupportedOption`, this.allOptionNames], NodeType.ErrorNode, [`setError`, `Unsupported option name`]);\n registerDynamic(machine, node, [`isInvalidOption`], NodeType.ErrorNode, [`setError`, `Invalid option name`]);\n for (const option of this.options) {\n if (option.arity === 0) {\n for (const name of option.nameSet) {\n registerDynamic(machine, node, [`isOption`, name], node, [`pushTrue`, option.preferredName]);\n if (name.startsWith(`--`) && !name.startsWith(`--no-`)) {\n registerDynamic(machine, node, [`isNegatedOption`, name], node, [`pushFalse`, option.preferredName]);\n }\n }\n }\n else {\n // We inject a new node at the end of the state machine\n let lastNode = injectNode(machine, makeNode());\n // We register transitions from the starting node to this new node\n for (const name of option.nameSet)\n registerDynamic(machine, node, [`isOption`, name], lastNode, [`pushUndefined`, option.preferredName]);\n // For each argument, we inject a new node at the end and we\n // register a transition from the current node to this new node\n for (let t = 0; t < option.arity; ++t) {\n const nextNode = injectNode(machine, makeNode());\n // We can provide better errors when another option or EndOfInput is encountered\n registerStatic(machine, lastNode, SpecialToken.EndOfInput, NodeType.ErrorNode, `setOptionArityError`);\n registerStatic(machine, lastNode, SpecialToken.EndOfPartialInput, NodeType.ErrorNode, `setOptionArityError`);\n registerDynamic(machine, lastNode, `isOptionLike`, NodeType.ErrorNode, `setOptionArityError`);\n // If the option has a single argument, no need to store it in an array\n const action = option.arity === 1\n ? `setStringValue`\n : `pushStringValue`;\n registerDynamic(machine, lastNode, `isNotOptionLike`, nextNode, action);\n lastNode = nextNode;\n }\n // In the end, we register a shortcut from\n // the last node back to the starting node\n registerShortcut(machine, lastNode, node);\n }\n }\n }\n}\nclass CliBuilder {\n static build(cbs, opts = {}) {\n return new CliBuilder(opts).commands(cbs).compile();\n }\n constructor({ binaryName = `...` } = {}) {\n this.builders = [];\n this.opts = { binaryName };\n }\n getBuilderByIndex(n) {\n if (!(n >= 0 && n < this.builders.length))\n throw new Error(`Assertion failed: Out-of-bound command index (${n})`);\n return this.builders[n];\n }\n commands(cbs) {\n for (const cb of cbs)\n cb(this.command());\n return this;\n }\n command() {\n const builder = new CommandBuilder(this.builders.length, this.opts);\n this.builders.push(builder);\n return builder;\n }\n compile() {\n const machines = [];\n const contexts = [];\n for (const builder of this.builders) {\n const { machine, context } = builder.compile();\n machines.push(machine);\n contexts.push(context);\n }\n const machine = makeAnyOfMachine(machines);\n simplifyMachine(machine);\n return {\n machine,\n contexts,\n process: (input, { partial } = {}) => {\n const endToken = partial\n ? SpecialToken.EndOfPartialInput\n : SpecialToken.EndOfInput;\n return runMachine(machine, input, { endToken });\n },\n };\n }\n}\n\nexport { CliBuilder, CommandBuilder, NoLimits, aggregateHelpStates, cloneNode, cloneTransition, debug, debugMachine, execute, injectNode, isTerminalNode, makeAnyOfMachine, makeNode, makeStateMachine, reducers, registerDynamic, registerShortcut, registerStatic, runMachineInternal, selectBestState, simplifyMachine, tests, trimSmallerBranches };\n","const MAX_LINE_LENGTH = 80;\nconst richLine = Array(MAX_LINE_LENGTH).fill(`━`);\nfor (let t = 0; t <= 24; ++t)\n richLine[richLine.length - t] = `\\x1b[38;5;${232 + t}m━`;\nconst richFormat = {\n header: str => `\\x1b[1m━━━ ${str}${str.length < MAX_LINE_LENGTH - 5 ? ` ${richLine.slice(str.length + 5).join(``)}` : `:`}\\x1b[0m`,\n bold: str => `\\x1b[1m${str}\\x1b[22m`,\n error: str => `\\x1b[31m\\x1b[1m${str}\\x1b[22m\\x1b[39m`,\n code: str => `\\x1b[36m${str}\\x1b[39m`,\n};\nconst textFormat = {\n header: str => str,\n bold: str => str,\n error: str => str,\n code: str => str,\n};\nfunction dedent(text) {\n const lines = text.split(`\\n`);\n const nonEmptyLines = lines.filter(line => line.match(/\\S/));\n const indent = nonEmptyLines.length > 0 ? nonEmptyLines.reduce((minLength, line) => Math.min(minLength, line.length - line.trimStart().length), Number.MAX_VALUE) : 0;\n return lines\n .map(line => line.slice(indent).trimRight())\n .join(`\\n`);\n}\n/**\n * Formats markdown text to be displayed to the console. Not all markdown features are supported.\n *\n * @param text The markdown text to format.\n * @param opts.format The format to use.\n * @param opts.paragraphs Whether to cut the text into paragraphs of 80 characters at most.\n */\nfunction formatMarkdownish(text, { format, paragraphs }) {\n // Enforce \\n as newline character\n text = text.replace(/\\r\\n?/g, `\\n`);\n // Remove the indentation, since it got messed up with the JS indentation\n text = dedent(text);\n // Remove surrounding newlines, since they got added for JS formatting\n text = text.replace(/^\\n+|\\n+$/g, ``);\n // List items always end with at least two newlines (in order to not be collapsed)\n text = text.replace(/^(\\s*)-([^\\n]*?)\\n+/gm, `$1-$2\\n\\n`);\n // Single newlines are removed; larger than that are collapsed into one\n text = text.replace(/\\n(\\n)?\\n*/g, ($0, $1) => $1 ? $1 : ` `);\n if (paragraphs) {\n text = text.split(/\\n/).map(paragraph => {\n // Does the paragraph starts with a list?\n const bulletMatch = paragraph.match(/^\\s*[*-][\\t ]+(.*)/);\n if (!bulletMatch)\n // No, cut the paragraphs into segments of 80 characters\n return paragraph.match(/(.{1,80})(?: |$)/g).join(`\\n`);\n const indent = paragraph.length - paragraph.trimStart().length;\n // Yes, cut the paragraphs into segments of (78 - indent) characters (to account for the prefix)\n return bulletMatch[1].match(new RegExp(`(.{1,${78 - indent}})(?: |$)`, `g`)).map((line, index) => {\n return ` `.repeat(indent) + (index === 0 ? `- ` : ` `) + line;\n }).join(`\\n`);\n }).join(`\\n\\n`);\n }\n // Highlight the code segments\n text = text.replace(/(`+)((?:.|[\\n])*?)\\1/g, ($0, $1, $2) => {\n return format.code($1 + $2 + $1);\n });\n // Highlight the bold segments\n text = text.replace(/(\\*\\*)((?:.|[\\n])*?)\\1/g, ($0, $1, $2) => {\n return format.bold($1 + $2 + $1);\n });\n return text ? `${text}\\n` : ``;\n}\n\nexport { formatMarkdownish, richFormat, textFormat };\n","import { Command } from './Command.mjs';\n\nclass HelpCommand extends Command {\n static from(state, contexts) {\n const command = new HelpCommand(contexts);\n command.path = state.path;\n for (const opt of state.options) {\n switch (opt.name) {\n case `-c`:\n {\n command.commands.push(Number(opt.value));\n }\n break;\n case `-i`:\n {\n command.index = Number(opt.value);\n }\n break;\n }\n }\n return command;\n }\n constructor(contexts) {\n super();\n this.contexts = contexts;\n this.commands = [];\n }\n async execute() {\n let commands = this.commands;\n if (typeof this.index !== `undefined` && this.index >= 0 && this.index < commands.length)\n commands = [commands[this.index]];\n if (commands.length === 0) {\n this.context.stdout.write(this.cli.usage());\n }\n else if (commands.length === 1) {\n this.context.stdout.write(this.cli.usage(this.contexts[commands[0]].commandClass, { detailed: true }));\n }\n else if (commands.length > 1) {\n this.context.stdout.write(`Multiple commands match your selection:\\n`);\n this.context.stdout.write(`\\n`);\n let index = 0;\n for (const command of this.commands)\n this.context.stdout.write(this.cli.usage(this.contexts[command].commandClass, { prefix: `${index++}. `.padStart(5) }));\n this.context.stdout.write(`\\n`);\n this.context.stdout.write(`Run again with -h=<index> to see the longer details of any of those commands.\\n`);\n }\n }\n}\n\nexport { HelpCommand };\n","import { getDefaultColorDepth, getCaptureActivator } from '../platform/node.mjs';\nimport { HELP_COMMAND_INDEX } from '../constants.mjs';\nimport { CliBuilder } from '../core.mjs';\nimport { formatMarkdownish, richFormat, textFormat } from '../format.mjs';\nimport { Command } from './Command.mjs';\nimport { HelpCommand } from './HelpCommand.mjs';\n\nconst errorCommandSymbol = Symbol(`clipanion/errorCommand`);\nasync function runExit(...args) {\n const { resolvedOptions, resolvedCommandClasses, resolvedArgv, resolvedContext, } = resolveRunParameters(args);\n const cli = Cli.from(resolvedCommandClasses, resolvedOptions);\n return cli.runExit(resolvedArgv, resolvedContext);\n}\nasync function run(...args) {\n const { resolvedOptions, resolvedCommandClasses, resolvedArgv, resolvedContext, } = resolveRunParameters(args);\n const cli = Cli.from(resolvedCommandClasses, resolvedOptions);\n return cli.run(resolvedArgv, resolvedContext);\n}\nfunction resolveRunParameters(args) {\n let resolvedOptions;\n let resolvedCommandClasses;\n let resolvedArgv;\n let resolvedContext;\n if (typeof process !== `undefined` && typeof process.argv !== `undefined`)\n resolvedArgv = process.argv.slice(2);\n switch (args.length) {\n case 1:\n {\n resolvedCommandClasses = args[0];\n }\n break;\n case 2:\n {\n if (args[0] && (args[0].prototype instanceof Command) || Array.isArray(args[0])) {\n resolvedCommandClasses = args[0];\n if (Array.isArray(args[1])) {\n resolvedArgv = args[1];\n }\n else {\n resolvedContext = args[1];\n }\n }\n else {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n }\n }\n break;\n case 3:\n {\n if (Array.isArray(args[2])) {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n resolvedArgv = args[2];\n }\n else if (args[0] && (args[0].prototype instanceof Command) || Array.isArray(args[0])) {\n resolvedCommandClasses = args[0];\n resolvedArgv = args[1];\n resolvedContext = args[2];\n }\n else {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n resolvedContext = args[2];\n }\n }\n break;\n default:\n {\n resolvedOptions = args[0];\n resolvedCommandClasses = args[1];\n resolvedArgv = args[2];\n resolvedContext = args[3];\n }\n break;\n }\n if (typeof resolvedArgv === `undefined`)\n throw new Error(`The argv parameter must be provided when running Clipanion outside of a Node context`);\n return {\n resolvedOptions,\n resolvedCommandClasses,\n resolvedArgv,\n resolvedContext,\n };\n}\n/**\n * @template Context The context shared by all commands. Contexts are a set of values, defined when calling the `run`/`runExit` functions from the CLI instance, that will be made available to the commands via `this.context`.\n */\nclass Cli {\n /**\n * Creates a new Cli and registers all commands passed as parameters.\n *\n * @param commandClasses The Commands to register\n * @returns The created `Cli` instance\n */\n static from(commandClasses, options = {}) {\n const cli = new Cli(options);\n const resolvedCommandClasses = Array.isArray(commandClasses)\n ? commandClasses\n : [commandClasses];\n for (const commandClass of resolvedCommandClasses)\n cli.register(commandClass);\n return cli;\n }\n constructor({ binaryLabel, binaryName: binaryNameOpt = `...`, binaryVersion, enableCapture = false, enableColors } = {}) {\n this.registrations = new Map();\n this.builder = new CliBuilder({ binaryName: binaryNameOpt });\n this.binaryLabel = binaryLabel;\n this.binaryName = binaryNameOpt;\n this.binaryVersion = binaryVersion;\n this.enableCapture = enableCapture;\n this.enableColors = enableColors;\n }\n /**\n * Registers a command inside the CLI.\n */\n register(commandClass) {\n var _a;\n if (this.registrations.has(commandClass))\n throw new RangeError(`${commandClass.name} has already been registered`);\n const specs = new Map();\n const command = new commandClass();\n for (const key in command) {\n const value = command[key];\n if (typeof value === `object` && value !== null && value[Command.isOption]) {\n specs.set(key, value);\n }\n }\n const builder = this.builder.command();\n const index = builder.cliIndex;\n const paths = (_a = commandClass.paths) !== null && _a !== void 0 ? _a : command.paths;\n if (typeof paths !== `undefined`)\n for (const path of paths)\n builder.addPath(path);\n this.registrations.set(commandClass, { specs, builder, index });\n for (const [key, { definition }] of specs.entries())\n definition(builder, key);\n builder.setContext({\n commandClass,\n });\n }\n process(opts, contextArg) {\n const { input, context: userContext, partial } = typeof opts === `object` && Array.isArray(opts)\n ? { input: opts, context: contextArg }\n : opts;\n const { contexts, process } = this.builder.compile();\n const state = process(input, { partial });\n const context = {\n ...Cli.defaultContext,\n ...userContext,\n };\n switch (state.selectedIndex) {\n case HELP_COMMAND_INDEX:\n {\n const command = HelpCommand.from(state, contexts);\n command.context = context;\n command.tokens = state.tokens;\n return command;\n }\n default:\n {\n const { commandClass } = contexts[state.selectedIndex];\n const record = this.registrations.get(commandClass);\n if (typeof record === `undefined`)\n throw new Error(`Assertion failed: Expected the command class to have been registered.`);\n const command = new commandClass();\n command.context = context;\n command.tokens = state.tokens;\n command.path = state.path;\n try {\n for (const [key, { transformer }] of record.specs.entries())\n command[key] = transformer(record.builder, key, state, context);\n return command;\n }\n catch (error) {\n error[errorCommandSymbol] = command;\n throw error;\n }\n }\n break;\n }\n }\n async run(input, userContext) {\n var _a, _b;\n let command;\n const context = {\n ...Cli.defaultContext,\n ...userContext,\n };\n const colored = (_a = this.enableColors) !== null && _a !== void 0 ? _a : context.colorDepth > 1;\n if (!Array.isArray(input)) {\n command = input;\n }\n else {\n try {\n command = this.process(input, context);\n }\n catch (error) {\n context.stdout.write(this.error(error, { colored }));\n return 1;\n }\n }\n if (command.help) {\n context.stdout.write(this.usage(command, { colored, detailed: true }));\n return 0;\n }\n command.context = context;\n command.cli = {\n binaryLabel: this.binaryLabel,\n binaryName: this.binaryName,\n binaryVersion: this.binaryVersion,\n enableCapture: this.enableCapture,\n enableColors: this.enableColors,\n definitions: () => this.definitions(),\n definition: command => this.definition(command),\n error: (error, opts) => this.error(error, opts),\n format: colored => this.format(colored),\n process: (input, subContext) => this.process(input, { ...context, ...subContext }),\n run: (input, subContext) => this.run(input, { ...context, ...subContext }),\n usage: (command, opts) => this.usage(command, opts),\n };\n const activate = this.enableCapture\n ? (_b = getCaptureActivator(context)) !== null && _b !== void 0 ? _b : noopCaptureActivator\n : noopCaptureActivator;\n let exitCode;\n try {\n exitCode = await activate(() => command.validateAndExecute().catch(error => command.catch(error).then(() => 0)));\n }\n catch (error) {\n context.stdout.write(this.error(error, { colored, command }));\n return 1;\n }\n return exitCode;\n }\n async runExit(input, context) {\n process.exitCode = await this.run(input, context);\n }\n definition(commandClass, { colored = false } = {}) {\n if (!commandClass.usage)\n return null;\n const { usage: path } = this.getUsageByRegistration(commandClass, { detailed: false });\n const { usage, options } = this.getUsageByRegistration(commandClass, { detailed: true, inlineOptions: false });\n const category = typeof commandClass.usage.category !== `undefined`\n ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false })\n : undefined;\n const description = typeof commandClass.usage.description !== `undefined`\n ? formatMarkdownish(commandClass.usage.description, { format: this.format(colored), paragraphs: false })\n : undefined;\n const details = typeof commandClass.usage.details !== `undefined`\n ? formatMarkdownish(commandClass.usage.details, { format: this.format(colored), paragraphs: true })\n : undefined;\n const examples = typeof commandClass.usage.examples !== `undefined`\n ? commandClass.usage.examples.map(([label, cli]) => [formatMarkdownish(label, { format: this.format(colored), paragraphs: false }), cli.replace(/\\$0/g, this.binaryName)])\n : undefined;\n return { path, usage, category, description, details, examples, options };\n }\n definitions({ colored = false } = {}) {\n const data = [];\n for (const commandClass of this.registrations.keys()) {\n const usage = this.definition(commandClass, { colored });\n if (!usage)\n continue;\n data.push(usage);\n }\n return data;\n }\n usage(command = null, { colored, detailed = false, prefix = `$ ` } = {}) {\n var _a;\n // In case the default command is the only one, we can just show the command help rather than the general one\n if (command === null) {\n for (const commandClass of this.registrations.keys()) {\n const paths = commandClass.paths;\n const isDocumented = typeof commandClass.usage !== `undefined`;\n const isExclusivelyDefault = !paths || paths.length === 0 || (paths.length === 1 && paths[0].length === 0);\n const isDefault = isExclusivelyDefault || ((_a = paths === null || paths === void 0 ? void 0 : paths.some(path => path.length === 0)) !== null && _a !== void 0 ? _a : false);\n if (isDefault) {\n if (command) {\n command = null;\n break;\n }\n else {\n command = commandClass;\n }\n }\n else {\n if (isDocumented) {\n command = null;\n continue;\n }\n }\n }\n if (command) {\n detailed = true;\n }\n }\n // @ts-ignore\n const commandClass = command !== null && command instanceof Command\n ? command.constructor\n : command;\n let result = ``;\n if (!commandClass) {\n const commandsByCategories = new Map();\n for (const [commandClass, { index }] of this.registrations.entries()) {\n if (typeof commandClass.usage === `undefined`)\n continue;\n const category = typeof commandClass.usage.category !== `undefined`\n ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false })\n : null;\n let categoryCommands = commandsByCategories.get(category);\n if (typeof categoryCommands === `undefined`)\n commandsByCategories.set(category, categoryCommands = []);\n const { usage } = this.getUsageByIndex(index);\n categoryCommands.push({ commandClass, usage });\n }\n const categoryNames = Array.from(commandsByCategories.keys()).sort((a, b) => {\n if (a === null)\n return -1;\n if (b === null)\n return +1;\n return a.localeCompare(b, `en`, { usage: `sort`, caseFirst: `upper` });\n });\n const hasLabel = typeof this.binaryLabel !== `undefined`;\n const hasVersion = typeof this.binaryVersion !== `undefined`;\n if (hasLabel || hasVersion) {\n if (hasLabel && hasVersion)\n result += `${this.format(colored).header(`${this.binaryLabel} - ${this.binaryVersion}`)}\\n\\n`;\n else if (hasLabel)\n result += `${this.format(colored).header(`${this.binaryLabel}`)}\\n`;\n else\n result += `${this.format(colored).header(`${this.binaryVersion}`)}\\n`;\n result += ` ${this.format(colored).bold(prefix)}${this.binaryName} <command>\\n`;\n }\n else {\n result += `${this.format(colored).bold(prefix)}${this.binaryName} <command>\\n`;\n }\n for (const categoryName of categoryNames) {\n const commands = commandsByCategories.get(categoryName).slice().sort((a, b) => {\n return a.usage.localeCompare(b.usage, `en`, { usage: `sort`, caseFirst: `upper` });\n });\n const header = categoryName !== null\n ? categoryName.trim()\n : `General commands`;\n result += `\\n`;\n result += `${this.format(colored).header(`${header}`)}\\n`;\n for (const { commandClass, usage } of commands) {\n const doc = commandClass.usage.description || `undocumented`;\n result += `\\n`;\n result += ` ${this.format(colored).bold(usage)}\\n`;\n result += ` ${formatMarkdownish(doc, { format: this.format(colored), paragraphs: false })}`;\n }\n }\n result += `\\n`;\n result += formatMarkdownish(`You can also print more details about any of these commands by calling them with the \\`-h,--help\\` flag right after the command name.`, { format: this.format(colored), paragraphs: true });\n }\n else {\n if (!detailed) {\n const { usage } = this.getUsageByRegistration(commandClass);\n result += `${this.format(colored).bold(prefix)}${usage}\\n`;\n }\n else {\n const { description = ``, details = ``, examples = [], } = commandClass.usage || {};\n if (description !== ``) {\n result += formatMarkdownish(description, { format: this.format(colored), paragraphs: false }).replace(/^./, $0 => $0.toUpperCase());\n result += `\\n`;\n }\n if (details !== `` || examples.length > 0) {\n result += `${this.format(colored).header(`Usage`)}\\n`;\n result += `\\n`;\n }\n const { usage, options } = this.getUsageByRegistration(commandClass, { inlineOptions: false });\n result += `${this.format(colored).bold(prefix)}${usage}\\n`;\n if (options.length > 0) {\n result += `\\n`;\n result += `${this.format(colored).header(`Options`)}\\n`;\n const maxDefinitionLength = options.reduce((length, option) => {\n return Math.max(length, option.definition.length);\n }, 0);\n result += `\\n`;\n for (const { definition, description } of options) {\n result += ` ${this.format(colored).bold(definition.padEnd(maxDefinitionLength))} ${formatMarkdownish(description, { format: this.format(colored), paragraphs: false })}`;\n }\n }\n if (details !== ``) {\n result += `\\n`;\n result += `${this.format(colored).header(`Details`)}\\n`;\n result += `\\n`;\n result += formatMarkdownish(details, { format: this.format(colored), paragraphs: true });\n }\n if (examples.length > 0) {\n result += `\\n`;\n result += `${this.format(colored).header(`Examples`)}\\n`;\n for (const [description, example] of examples) {\n result += `\\n`;\n result += formatMarkdownish(description, { format: this.format(colored), paragraphs: false });\n result += `${example\n .replace(/^/m, ` ${this.format(colored).bold(prefix)}`)\n .replace(/\\$0/g, this.binaryName)}\\n`;\n }\n }\n }\n }\n return result;\n }\n error(error, _a) {\n var _b;\n var { colored, command = (_b = error[errorCommandSymbol]) !== null && _b !== void 0 ? _b : null } = _a === void 0 ? {} : _a;\n if (!error || typeof error !== `object` || !(`stack` in error))\n error = new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(error)})`);\n let result = ``;\n let name = error.name.replace(/([a-z])([A-Z])/g, `$1 $2`);\n if (name === `Error`)\n name = `Internal Error`;\n result += `${this.format(colored).error(name)}: ${error.message}\\n`;\n const meta = error.clipanion;\n if (typeof meta !== `undefined`) {\n if (meta.type === `usage`) {\n result += `\\n`;\n result += this.usage(command);\n }\n }\n else {\n if (error.stack) {\n result += `${error.stack.replace(/^.*\\n/, ``)}\\n`;\n }\n }\n return result;\n }\n format(colored) {\n var _a;\n return ((_a = colored !== null && colored !== void 0 ? colored : this.enableColors) !== null && _a !== void 0 ? _a : Cli.defaultContext.colorDepth > 1) ? richFormat : textFormat;\n }\n getUsageByRegistration(klass, opts) {\n const record = this.registrations.get(klass);\n if (typeof record === `undefined`)\n throw new Error(`Assertion failed: Unregistered command`);\n return this.getUsageByIndex(record.index, opts);\n }\n getUsageByIndex(n, opts) {\n return this.builder.getBuilderByIndex(n).usage(opts);\n }\n}\n/**\n * The default context of the CLI.\n *\n * Contains the stdio of the current `process`.\n */\nCli.defaultContext = {\n env: process.env,\n stdin: process.stdin,\n stdout: process.stdout,\n stderr: process.stderr,\n colorDepth: getDefaultColorDepth(),\n};\nfunction noopCaptureActivator(fn) {\n return fn();\n}\n\nexport { Cli, run, runExit };\n","import { Command } from '../Command.mjs';\n\n/**\n * A command that prints the usage of all commands.\n *\n * Paths: `-h`, `--help`\n */\nclass HelpCommand extends Command {\n async execute() {\n this.context.stdout.write(this.cli.usage());\n }\n}\nHelpCommand.paths = [[`-h`], [`--help`]];\n\nexport { HelpCommand };\n","import { Command } from '../Command.mjs';\n\n/**\n * A command that prints the version of the binary (`cli.binaryVersion`).\n *\n * Paths: `-v`, `--version`\n */\nclass VersionCommand extends Command {\n async execute() {\n var _a;\n this.context.stdout.write(`${(_a = this.cli.binaryVersion) !== null && _a !== void 0 ? _a : `<unknown>`}\\n`);\n }\n}\nVersionCommand.paths = [[`-v`], [`--version`]];\n\nexport { VersionCommand };\n","import { makeCommandOption, rerouteArguments } from './utils.mjs';\n\nfunction Boolean(descriptor, initialValueBase, optsBase) {\n const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {});\n const optNames = descriptor.split(`,`);\n const nameSet = new Set(optNames);\n return makeCommandOption({\n definition(builder) {\n builder.addOption({\n names: optNames,\n allowBinding: false,\n arity: 0,\n hidden: opts.hidden,\n description: opts.description,\n required: opts.required,\n });\n },\n transformer(builer, key, state) {\n let currentValue = initialValue;\n for (const { name, value } of state.options) {\n if (!nameSet.has(name))\n continue;\n currentValue = value;\n }\n return currentValue;\n },\n });\n}\n\nexport { Boolean };\n","import { NoLimits } from '../../core.mjs';\nimport { makeCommandOption } from './utils.mjs';\n\n/**\n * Used to annotate that the command supports any number of positional\n * arguments.\n *\n * Be careful: this function is order-dependent! Make sure to define it\n * after any positional argument you want to declare.\n *\n * This function is mutually exclusive with Option.Proxy.\n *\n * @example\n * yarn add hello world\n * ► rest = [\"hello\", \"world\"]\n */\nfunction Rest(opts = {}) {\n return makeCommandOption({\n definition(builder, key) {\n var _a;\n builder.addRest({\n name: (_a = opts.name) !== null && _a !== void 0 ? _a : key,\n required: opts.required,\n });\n },\n transformer(builder, key, state) {\n // The builder's arity.extra will always be NoLimits,\n // because it is set when we call registerDefinition\n const isRestPositional = (index) => {\n const positional = state.positionals[index];\n // A NoLimits extra (i.e. an optional rest argument)\n if (positional.extra === NoLimits)\n return true;\n // A leading positional (i.e. a required rest argument)\n if (positional.extra === false && index < builder.arity.leading.length)\n return true;\n return false;\n };\n let count = 0;\n while (count < state.positionals.length && isRestPositional(count))\n count += 1;\n return state.positionals.splice(0, count).map(({ value }) => value);\n },\n });\n}\n\nexport { Rest };\n","import { NoLimits } from '../../core.mjs';\nimport { makeCommandOption, applyValidator, rerouteArguments } from './utils.mjs';\n\nfunction StringOption(descriptor, initialValueBase, optsBase) {\n const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {});\n const { arity = 1 } = opts;\n const optNames = descriptor.split(`,`);\n const nameSet = new Set(optNames);\n return makeCommandOption({\n definition(builder) {\n builder.addOption({\n names: optNames,\n arity: opts.tolerateBoolean ? 0 : arity,\n hidden: opts.hidden,\n description: opts.description,\n required: opts.required,\n });\n },\n transformer(builder, key, state, context) {\n let usedName;\n let currentValue = initialValue;\n if (typeof opts.env !== `undefined` && context.env[opts.env]) {\n usedName = opts.env;\n currentValue = context.env[opts.env];\n }\n for (const { name, value } of state.options) {\n if (!nameSet.has(name))\n continue;\n usedName = name;\n currentValue = value;\n }\n if (typeof currentValue === `string`) {\n return applyValidator(usedName !== null && usedName !== void 0 ? usedName : key, currentValue, opts.validator);\n }\n else {\n return currentValue;\n }\n },\n });\n}\nfunction StringPositional(opts = {}) {\n const { required = true } = opts;\n return makeCommandOption({\n definition(builder, key) {\n var _a;\n builder.addPositional({\n name: (_a = opts.name) !== null && _a !== void 0 ? _a : key,\n required: opts.required,\n });\n },\n transformer(builder, key, state) {\n var _a;\n for (let i = 0; i < state.positionals.length; ++i) {\n // We skip NoLimits extras. We only care about\n // required and optional finite positionals.\n if (state.positionals[i].extra === NoLimits)\n continue;\n // We skip optional positionals when we only\n // care about required positionals.\n if (required && state.positionals[i].extra === true)\n continue;\n // We skip required positionals when we only\n // care about optional positionals.\n if (!required && state.positionals[i].extra === false)\n continue;\n // We remove the positional from the list\n const [positional] = state.positionals.splice(i, 1);\n return applyValidator((_a = opts.name) !== null && _a !== void 0 ? _a : key, positional.value, opts.validator);\n }\n return undefined;\n },\n });\n}\n// This function is badly typed, but it doesn't matter because the overloads provide the true public typings\nfunction String(descriptor, ...args) {\n if (typeof descriptor === `string`) {\n return StringOption(descriptor, ...args);\n }\n else {\n return StringPositional(descriptor);\n }\n}\n\nexport { String };\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst simpleKeyRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\nfunction getPrintable(value) {\n if (value === null)\n return `null`;\n if (value === undefined)\n return `undefined`;\n if (value === ``)\n return `an empty string`;\n if (typeof value === 'symbol')\n return `<${value.toString()}>`;\n if (Array.isArray(value))\n return `an array`;\n return JSON.stringify(value);\n}\nfunction getPrintableArray(value, conjunction) {\n if (value.length === 0)\n return `nothing`;\n if (value.length === 1)\n return getPrintable(value[0]);\n const rest = value.slice(0, -1);\n const trailing = value[value.length - 1];\n const separator = value.length > 2\n ? `, ${conjunction} `\n : ` ${conjunction} `;\n return `${rest.map(value => getPrintable(value)).join(`, `)}${separator}${getPrintable(trailing)}`;\n}\nfunction computeKey(state, key) {\n var _a, _b, _c;\n if (typeof key === `number`) {\n return `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}[${key}]`;\n }\n else if (simpleKeyRegExp.test(key)) {\n return `${(_b = state === null || state === void 0 ? void 0 : state.p) !== null && _b !== void 0 ? _b : ``}.${key}`;\n }\n else {\n return `${(_c = state === null || state === void 0 ? void 0 : state.p) !== null && _c !== void 0 ? _c : `.`}[${JSON.stringify(key)}]`;\n }\n}\nfunction plural(n, singular, plural) {\n return n === 1 ? singular : plural;\n}\n\nconst colorStringRegExp = /^#[0-9a-f]{6}$/i;\nconst colorStringAlphaRegExp = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;\n// https://stackoverflow.com/a/475217/880703\nconst base64RegExp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\n// https://stackoverflow.com/a/14166194/880703\nconst uuid4RegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i;\n// https://stackoverflow.com/a/28022901/880703 + https://www.debuggex.com/r/bl8J35wMKk48a7u_\nconst iso8601RegExp = /^(?:[1-9]\\d{3}(-?)(?:(?:0[1-9]|1[0-2])\\1(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])\\1(?:29|30)|(?:0[13578]|1[02])(?:\\1)31|00[1-9]|0[1-9]\\d|[12]\\d{2}|3(?:[0-5]\\d|6[0-5]))|(?:[1-9]\\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\\2)29|-?366))T(?:[01]\\d|2[0-3])(:?)[0-5]\\d(?:\\3[0-5]\\d)?(?:Z|[+-][01]\\d(?:\\3[0-5]\\d)?)$/;\n\nfunction pushError({ errors, p } = {}, message) {\n errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message}`);\n return false;\n}\nfunction makeSetter(target, key) {\n return (v) => {\n target[key] = v;\n };\n}\nfunction makeCoercionFn(target, key) {\n return (v) => {\n const previous = target[key];\n target[key] = v;\n return makeCoercionFn(target, key).bind(null, previous);\n };\n}\nfunction makeLazyCoercionFn(fn, orig, generator) {\n const commit = () => {\n fn(generator());\n return revert;\n };\n const revert = () => {\n fn(orig);\n return commit;\n };\n return commit;\n}\n\n/**\n * Create a validator that always returns true and never refines the type.\n */\nfunction isUnknown() {\n return makeValidator({\n test: (value, state) => {\n return true;\n },\n });\n}\nfunction isLiteral(expected) {\n return makeValidator({\n test: (value, state) => {\n if (value !== expected)\n return pushError(state, `Expected ${getPrintable(expected)} (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a string.\n * Refines the type to `string`.\n */\nfunction isString() {\n return makeValidator({\n test: (value, state) => {\n if (typeof value !== `string`)\n return pushError(state, `Expected a string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\nfunction isEnum(enumSpec) {\n const valuesArray = Array.isArray(enumSpec) ? enumSpec : Object.values(enumSpec);\n const isAlphaNum = valuesArray.every(item => typeof item === 'string' || typeof item === 'number');\n const values = new Set(valuesArray);\n if (values.size === 1)\n return isLiteral([...values][0]);\n return makeValidator({\n test: (value, state) => {\n if (!values.has(value)) {\n if (isAlphaNum) {\n return pushError(state, `Expected one of ${getPrintableArray(valuesArray, `or`)} (got ${getPrintable(value)})`);\n }\n else {\n return pushError(state, `Expected a valid enumeration value (got ${getPrintable(value)})`);\n }\n }\n return true;\n },\n });\n}\nconst BOOLEAN_COERCIONS = new Map([\n [`true`, true],\n [`True`, true],\n [`1`, true],\n [1, true],\n [`false`, false],\n [`False`, false],\n [`0`, false],\n [0, false],\n]);\n/**\n * Create a validator that only returns true when the tested value is a\n * boolean. Refines the type to `boolean`.\n *\n * Supports coercion:\n * - 'true' / 'True' / '1' / 1 will turn to `true`\n * - 'false' / 'False' / '0' / 0 will turn to `false`\n */\nfunction isBoolean() {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof value !== `boolean`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const coercion = BOOLEAN_COERCIONS.get(value);\n if (typeof coercion !== `undefined`) {\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);\n return true;\n }\n }\n return pushError(state, `Expected a boolean (got ${getPrintable(value)})`);\n }\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a\n * number (including floating numbers; use `cascade` and `isInteger` to\n * restrict the range further). Refines the type to `number`.\n *\n * Supports coercion.\n */\nfunction isNumber() {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof value !== `number`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n let coercion;\n if (typeof value === `string`) {\n let val;\n try {\n val = JSON.parse(value);\n }\n catch (_b) { }\n // We check against JSON.stringify that the output is the same to ensure that the number can be safely represented in JS\n if (typeof val === `number`) {\n if (JSON.stringify(val) === value) {\n coercion = val;\n }\n else {\n return pushError(state, `Received a number that can't be safely represented by the runtime (${value})`);\n }\n }\n }\n if (typeof coercion !== `undefined`) {\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);\n return true;\n }\n }\n return pushError(state, `Expected a number (got ${getPrintable(value)})`);\n }\n return true;\n },\n });\n}\n/**\n * Important: This validator only makes sense when used in conjunction with\n * coercion! It will always error when used without.\n *\n * Create a validator that only returns true when the tested value is a\n * JSON representation of the expected type. Refines the type to the\n * expected type, and casts the value into its inner value.\n */\nfunction isPayload(spec) {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) === `undefined`)\n return pushError(state, `The isPayload predicate can only be used with coercion enabled`);\n if (typeof state.coercion === `undefined`)\n return pushError(state, `Unbound coercion result`);\n if (typeof value !== `string`)\n return pushError(state, `Expected a string (got ${getPrintable(value)})`);\n let inner;\n try {\n inner = JSON.parse(value);\n }\n catch (_b) {\n return pushError(state, `Expected a JSON string (got ${getPrintable(value)})`);\n }\n const wrapper = { value: inner };\n if (!spec(inner, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(wrapper, `value`) })))\n return false;\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, wrapper.value)]);\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a\n * valid date. Refines the type to `Date`.\n *\n * Supports coercion via one of the following formats:\n * - ISO86001 strings\n * - Unix timestamps\n */\nfunction isDate() {\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (!(value instanceof Date)) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n let coercion;\n if (typeof value === `string` && iso8601RegExp.test(value)) {\n coercion = new Date(value);\n }\n else {\n let timestamp;\n if (typeof value === `string`) {\n let val;\n try {\n val = JSON.parse(value);\n }\n catch (_b) { }\n if (typeof val === `number`) {\n timestamp = val;\n }\n }\n else if (typeof value === `number`) {\n timestamp = value;\n }\n if (typeof timestamp !== `undefined`) {\n if (Number.isSafeInteger(timestamp) || !Number.isSafeInteger(timestamp * 1000)) {\n coercion = new Date(timestamp * 1000);\n }\n else {\n return pushError(state, `Received a timestamp that can't be safely represented by the runtime (${value})`);\n }\n }\n }\n if (typeof coercion !== `undefined`) {\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);\n return true;\n }\n }\n return pushError(state, `Expected a date (got ${getPrintable(value)})`);\n }\n return true;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * array whose all values match the provided subspec. Refines the type to\n * `Array<T>`, with `T` being the subspec inferred type.\n *\n * Supports coercion if the `delimiter` option is set, in which case strings\n * will be split accordingly.\n */\nfunction isArray(spec, { delimiter } = {}) {\n return makeValidator({\n test: (value, state) => {\n var _a;\n const originalValue = value;\n if (typeof value === `string` && typeof delimiter !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n value = value.split(delimiter);\n }\n }\n if (!Array.isArray(value))\n return pushError(state, `Expected an array (got ${getPrintable(value)})`);\n let valid = true;\n for (let t = 0, T = value.length; t < T; ++t) {\n valid = spec(value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n if (value !== originalValue)\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);\n return valid;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * set whose all values match the provided subspec. Refines the type to\n * `Set<T>`, with `T` being the subspec inferred type.\n *\n * Supports coercion from arrays (or anything that can be coerced into an\n * array).\n */\nfunction isSet(spec, { delimiter } = {}) {\n const isArrayValidator = isArray(spec, { delimiter });\n return makeValidator({\n test: (value, state) => {\n var _a, _b;\n if (Object.getPrototypeOf(value).toString() === `[object Set]`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const originalValues = [...value];\n const coercedValues = [...value];\n if (!isArrayValidator(coercedValues, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n const updateValue = () => coercedValues.some((val, t) => val !== originalValues[t])\n ? new Set(coercedValues)\n : value;\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, makeLazyCoercionFn(state.coercion, value, updateValue)]);\n return true;\n }\n else {\n let valid = true;\n for (const subValue of value) {\n valid = spec(subValue, Object.assign({}, state)) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n return valid;\n }\n }\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const store = { value };\n if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(store, `value`) })))\n return false;\n state.coercions.push([(_b = state.p) !== null && _b !== void 0 ? _b : `.`, makeLazyCoercionFn(state.coercion, value, () => new Set(store.value))]);\n return true;\n }\n return pushError(state, `Expected a set (got ${getPrintable(value)})`);\n }\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * map whose all values match the provided subspecs. Refines the type to\n * `Map<U, V>`, with `U` being the key subspec inferred type and `V` being\n * the value subspec inferred type.\n *\n * Supports coercion from array of tuples (or anything that can be coerced into\n * an array of tuples).\n */\nfunction isMap(keySpec, valueSpec) {\n const isArrayValidator = isArray(isTuple([keySpec, valueSpec]));\n const isRecordValidator = isRecord(valueSpec, { keys: keySpec });\n return makeValidator({\n test: (value, state) => {\n var _a, _b, _c;\n if (Object.getPrototypeOf(value).toString() === `[object Map]`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const originalValues = [...value];\n const coercedValues = [...value];\n if (!isArrayValidator(coercedValues, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n const updateValue = () => coercedValues.some((val, t) => val[0] !== originalValues[t][0] || val[1] !== originalValues[t][1])\n ? new Map(coercedValues)\n : value;\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, makeLazyCoercionFn(state.coercion, value, updateValue)]);\n return true;\n }\n else {\n let valid = true;\n for (const [key, subValue] of value) {\n valid = keySpec(key, Object.assign({}, state)) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n valid = valueSpec(subValue, Object.assign(Object.assign({}, state), { p: computeKey(state, key) })) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n return valid;\n }\n }\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n const store = { value };\n if (Array.isArray(value)) {\n if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n state.coercions.push([(_b = state.p) !== null && _b !== void 0 ? _b : `.`, makeLazyCoercionFn(state.coercion, value, () => new Map(store.value))]);\n return true;\n }\n else {\n if (!isRecordValidator(value, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(store, `value`) })))\n return false;\n state.coercions.push([(_c = state.p) !== null && _c !== void 0 ? _c : `.`, makeLazyCoercionFn(state.coercion, value, () => new Map(Object.entries(store.value)))]);\n return true;\n }\n }\n return pushError(state, `Expected a map (got ${getPrintable(value)})`);\n }\n });\n}\n/**\n * Create a validator that only returns true when the tested value is a\n * tuple whose each value matches the corresponding subspec. Refines the type\n * into a tuple whose each item has the type inferred by the corresponding\n * tuple.\n *\n * Supports coercion if the `delimiter` option is set, in which case strings\n * will be split accordingly.\n */\nfunction isTuple(spec, { delimiter } = {}) {\n const lengthValidator = hasExactLength(spec.length);\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (typeof value === `string` && typeof delimiter !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n value = value.split(delimiter);\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);\n }\n }\n if (!Array.isArray(value))\n return pushError(state, `Expected a tuple (got ${getPrintable(value)})`);\n let valid = lengthValidator(value, Object.assign({}, state));\n for (let t = 0, T = value.length; t < T && t < spec.length; ++t) {\n valid = spec[t](value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid;\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n return valid;\n },\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object with any amount of properties that must all match the provided\n * subspec. Refines the type to `Record<string, T>`, with `T` being the\n * subspec inferred type.\n *\n * Keys can be optionally validated as well by using the `keys` optional\n * subspec parameter.\n */\nfunction isRecord(spec, { keys: keySpec = null, } = {}) {\n const isArrayValidator = isArray(isTuple([keySpec !== null && keySpec !== void 0 ? keySpec : isString(), spec]));\n return makeValidator({\n test: (value, state) => {\n var _a;\n if (Array.isArray(value)) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: undefined })))\n return false;\n value = Object.fromEntries(value);\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);\n return true;\n }\n }\n if (typeof value !== `object` || value === null)\n return pushError(state, `Expected an object (got ${getPrintable(value)})`);\n const keys = Object.keys(value);\n let valid = true;\n for (let t = 0, T = keys.length; t < T && (valid || (state === null || state === void 0 ? void 0 : state.errors) != null); ++t) {\n const key = keys[t];\n const sub = value[key];\n if (key === `__proto__` || key === `constructor`) {\n valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Unsafe property name`);\n continue;\n }\n if (keySpec !== null && !keySpec(key, state)) {\n valid = false;\n continue;\n }\n if (!spec(sub, Object.assign(Object.assign({}, state), { p: computeKey(state, key), coercion: makeCoercionFn(value, key) }))) {\n valid = false;\n continue;\n }\n }\n return valid;\n },\n });\n}\n/**\n * @deprecated Replace `isDict` by `isRecord`\n */\nfunction isDict(spec, opts = {}) {\n return isRecord(spec, opts);\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object whose all properties match their corresponding subspec. Refines\n * the type into an object whose each property has the type inferred by the\n * corresponding subspec.\n *\n * Unlike `t.isPartial`, `t.isObject` doesn't allow extraneous properties by\n * default. This behaviour can be altered by using the `extra` optional\n * subspec parameter, which will be called to validate an object only\n * containing the extraneous properties.\n *\n * Calling `t.isObject(..., {extra: t.isRecord(t.isUnknown())})` is\n * essentially the same as calling `t.isPartial(...)`.\n */\nfunction isObject(props, { extra: extraSpec = null, } = {}) {\n const specKeys = Object.keys(props);\n const validator = makeValidator({\n test: (value, state) => {\n if (typeof value !== `object` || value === null)\n return pushError(state, `Expected an object (got ${getPrintable(value)})`);\n const keys = new Set([...specKeys, ...Object.keys(value)]);\n const extra = {};\n let valid = true;\n for (const key of keys) {\n if (key === `constructor` || key === `__proto__`) {\n valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Unsafe property name`);\n }\n else {\n const spec = Object.prototype.hasOwnProperty.call(props, key)\n ? props[key]\n : undefined;\n const sub = Object.prototype.hasOwnProperty.call(value, key)\n ? value[key]\n : undefined;\n if (typeof spec !== `undefined`) {\n valid = spec(sub, Object.assign(Object.assign({}, state), { p: computeKey(state, key), coercion: makeCoercionFn(value, key) })) && valid;\n }\n else if (extraSpec === null) {\n valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Extraneous property (got ${getPrintable(sub)})`);\n }\n else {\n Object.defineProperty(extra, key, {\n enumerable: true,\n get: () => sub,\n set: makeSetter(value, key)\n });\n }\n }\n if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {\n break;\n }\n }\n if (extraSpec !== null && (valid || (state === null || state === void 0 ? void 0 : state.errors) != null))\n valid = extraSpec(extra, state) && valid;\n return valid;\n },\n });\n return Object.assign(validator, {\n properties: props,\n });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object whose all properties match their corresponding subspec. Refines\n * the type into an object whose each property has the type inferred by the\n * corresponding subspec.\n *\n * Unlike `t.isObject`, `t.isPartial` allows extraneous properties. The\n * resulting type will reflect this behaviour by including an index\n * signature (each extraneous property being typed `unknown`).\n *\n * Calling `t.isPartial(...)` is essentially the same as calling\n * `t.isObject(..., {extra: t.isRecord(t.isUnknown())})`.\n */\nfunction isPartial(props) {\n return isObject(props, { extra: isRecord(isUnknown()) });\n}\n/**\n * Create a validator that only returns true when the tested value is an\n * object whose prototype is derived from the given class. Refines the type\n * into a class instance.\n */\nconst isInstanceOf = (constructor) => makeValidator({\n test: (value, state) => {\n if (!(value instanceof constructor))\n return pushError(state, `Expected an instance of ${constructor.name} (got ${getPrintable(value)})`);\n return true;\n },\n});\n/**\n * Create a validator that only returns true when the tested value is an\n * object matching any of the provided subspecs. If the optional `exclusive`\n * parameter is set to `true`, the behaviour changes so that the validator\n * only returns true when exactly one subspec matches.\n */\nconst isOneOf = (specs, { exclusive = false, } = {}) => makeValidator({\n test: (value, state) => {\n var _a, _b, _c;\n const matches = [];\n const errorBuffer = typeof (state === null || state === void 0 ? void 0 : state.errors) !== `undefined`\n ? [] : undefined;\n for (let t = 0, T = specs.length; t < T; ++t) {\n const subErrors = typeof (state === null || state === void 0 ? void 0 : state.errors) !== `undefined`\n ? [] : undefined;\n const subCoercions = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`\n ? [] : undefined;\n if (specs[t](value, Object.assign(Object.assign({}, state), { errors: subErrors, coercions: subCoercions, p: `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}#${t + 1}` }))) {\n matches.push([`#${t + 1}`, subCoercions]);\n if (!exclusive) {\n break;\n }\n }\n else {\n errorBuffer === null || errorBuffer === void 0 ? void 0 : errorBuffer.push(subErrors[0]);\n }\n }\n if (matches.length === 1) {\n const [, subCoercions] = matches[0];\n if (typeof subCoercions !== `undefined`)\n (_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions);\n return true;\n }\n if (matches.length > 1)\n pushError(state, `Expected to match exactly a single predicate (matched ${matches.join(`, `)})`);\n else\n (_c = state === null || state === void 0 ? void 0 : state.errors) === null || _c === void 0 ? void 0 : _c.push(...errorBuffer);\n return false;\n },\n});\n\nfunction makeTrait(value) {\n return () => {\n return value;\n };\n}\nfunction makeValidator({ test }) {\n return makeTrait(test)();\n}\nclass TypeAssertionError extends Error {\n constructor({ errors } = {}) {\n let errorMessage = `Type mismatch`;\n if (errors && errors.length > 0) {\n errorMessage += `\\n`;\n for (const error of errors) {\n errorMessage += `\\n- ${error}`;\n }\n }\n super(errorMessage);\n }\n}\n/**\n * Check that the specified value matches the given validator, and throws an\n * exception if it doesn't. Refine the type if it passes.\n */\nfunction assert(val, validator) {\n if (!validator(val)) {\n throw new TypeAssertionError();\n }\n}\n/**\n * Check that the specified value matches the given validator, and throws an\n * exception if it doesn't. Refine the type if it passes.\n *\n * Thrown exceptions include details about what exactly looks invalid in the\n * tested value.\n */\nfunction assertWithErrors(val, validator) {\n const errors = [];\n if (!validator(val, { errors })) {\n throw new TypeAssertionError({ errors });\n }\n}\n/**\n * Compile-time only. Refine the type as if the validator was matching the\n * tested value, but doesn't actually run it. Similar to the classic `as`\n * operator in TypeScript.\n */\nfunction softAssert(val, validator) {\n // It's a soft assert; we tell TypeScript about the type, but we don't need to check it\n}\nfunction as(value, validator, { coerce = false, errors: storeErrors, throw: throws } = {}) {\n const errors = storeErrors ? [] : undefined;\n if (!coerce) {\n if (validator(value, { errors })) {\n return throws ? value : { value, errors: undefined };\n }\n else if (!throws) {\n return { value: undefined, errors: errors !== null && errors !== void 0 ? errors : true };\n }\n else {\n throw new TypeAssertionError({ errors });\n }\n }\n const state = { value };\n const coercion = makeCoercionFn(state, `value`);\n const coercions = [];\n if (!validator(value, { errors, coercion, coercions })) {\n if (!throws) {\n return { value: undefined, errors: errors !== null && errors !== void 0 ? errors : true };\n }\n else {\n throw new TypeAssertionError({ errors });\n }\n }\n for (const [, apply] of coercions)\n apply();\n if (throws) {\n return state.value;\n }\n else {\n return { value: state.value, errors: undefined };\n }\n}\n/**\n * Create and return a new function that apply the given validators to each\n * corresponding argument passed to the function and throws an exception in\n * case of a mismatch.\n */\nfunction fn(validators, fn) {\n const isValidArgList = isTuple(validators);\n return ((...args) => {\n const check = isValidArgList(args);\n if (!check)\n throw new TypeAssertionError();\n return fn(...args);\n });\n}\n\n/**\n * Create a validator that checks that the tested array or string has at least\n * the specified length.\n */\nfunction hasMinLength(length) {\n return makeValidator({\n test: (value, state) => {\n if (!(value.length >= length))\n return pushError(state, `Expected to have a length of at least ${length} elements (got ${value.length})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested array or string has at most\n * the specified length.\n */\nfunction hasMaxLength(length) {\n return makeValidator({\n test: (value, state) => {\n if (!(value.length <= length))\n return pushError(state, `Expected to have a length of at most ${length} elements (got ${value.length})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested array or string has exactly\n * the specified length.\n */\nfunction hasExactLength(length) {\n return makeValidator({\n test: (value, state) => {\n if (!(value.length === length))\n return pushError(state, `Expected to have a length of exactly ${length} elements (got ${value.length})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested array only contains unique\n * elements. The optional `map` parameter lets you define a transform to\n * apply before making the check (the result of this transform will be\n * discarded afterwards).\n */\nfunction hasUniqueItems({ map, } = {}) {\n return makeValidator({\n test: (value, state) => {\n const set = new Set();\n const dup = new Set();\n for (let t = 0, T = value.length; t < T; ++t) {\n const sub = value[t];\n const key = typeof map !== `undefined`\n ? map(sub)\n : sub;\n if (set.has(key)) {\n if (dup.has(key))\n continue;\n pushError(state, `Expected to contain unique elements; got a duplicate with ${getPrintable(value)}`);\n dup.add(key);\n }\n else {\n set.add(key);\n }\n }\n return dup.size === 0;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is strictly less than 0.\n */\nfunction isNegative() {\n return makeValidator({\n test: (value, state) => {\n if (!(value <= 0))\n return pushError(state, `Expected to be negative (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is equal or greater\n * than 0.\n */\nfunction isPositive() {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= 0))\n return pushError(state, `Expected to be positive (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is equal or greater\n * than the specified reference.\n */\nfunction isAtLeast(n) {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= n))\n return pushError(state, `Expected to be at least ${n} (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is equal or smaller\n * than the specified reference.\n */\nfunction isAtMost(n) {\n return makeValidator({\n test: (value, state) => {\n if (!(value <= n))\n return pushError(state, `Expected to be at most ${n} (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is between the\n * specified references (including the upper boundary).\n */\nfunction isInInclusiveRange(a, b) {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= a && value <= b))\n return pushError(state, `Expected to be in the [${a}; ${b}] range (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is between the\n * specified references (excluding the upper boundary).\n */\nfunction isInExclusiveRange(a, b) {\n return makeValidator({\n test: (value, state) => {\n if (!(value >= a && value < b))\n return pushError(state, `Expected to be in the [${a}; ${b}[ range (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested number is an integer.\n *\n * By default Typanion will also check that it's a *safe* integer. For example,\n * 2^53 wouldn't be a safe integer because 2^53+1 would be rounded to 2^53,\n * which could put your applications at risk when used in loops.\n */\nfunction isInteger({ unsafe = false, } = {}) {\n return makeValidator({\n test: (value, state) => {\n if (value !== Math.round(value))\n return pushError(state, `Expected to be an integer (got ${value})`);\n if (!unsafe && !Number.isSafeInteger(value))\n return pushError(state, `Expected to be a safe integer (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string matches the given\n * regular expression.\n */\nfunction matchesRegExp(regExp) {\n return makeValidator({\n test: (value, state) => {\n if (!regExp.test(value))\n return pushError(state, `Expected to match the pattern ${regExp.toString()} (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string only contain lowercase\n * characters.\n */\nfunction isLowerCase() {\n return makeValidator({\n test: (value, state) => {\n if (value !== value.toLowerCase())\n return pushError(state, `Expected to be all-lowercase (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string only contain uppercase\n * characters.\n */\nfunction isUpperCase() {\n return makeValidator({\n test: (value, state) => {\n if (value !== value.toUpperCase())\n return pushError(state, `Expected to be all-uppercase (got ${value})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is a valid UUID v4.\n */\nfunction isUUID4() {\n return makeValidator({\n test: (value, state) => {\n if (!uuid4RegExp.test(value))\n return pushError(state, `Expected to be a valid UUID v4 (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is a valid ISO8601\n * date.\n */\nfunction isISO8601() {\n return makeValidator({\n test: (value, state) => {\n if (!iso8601RegExp.test(value))\n return pushError(state, `Expected to be a valid ISO 8601 date string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is a valid hexadecimal\n * color. Setting the optional `alpha` parameter to `true` allows an additional\n * transparency channel to be included.\n */\nfunction isHexColor({ alpha = false, }) {\n return makeValidator({\n test: (value, state) => {\n const res = alpha\n ? colorStringRegExp.test(value)\n : colorStringAlphaRegExp.test(value);\n if (!res)\n return pushError(state, `Expected to be a valid hexadecimal color string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is valid base64.\n */\nfunction isBase64() {\n return makeValidator({\n test: (value, state) => {\n if (!base64RegExp.test(value))\n return pushError(state, `Expected to be a valid base 64 string (got ${getPrintable(value)})`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested string is valid JSON. A\n * optional spec can be passed as parameter, in which case the data will be\n * deserialized and validated against the spec (coercion will be disabled\n * for this check, and even if successful the returned value will still be\n * the original string).\n */\nfunction isJSON(spec = isUnknown()) {\n return makeValidator({\n test: (value, state) => {\n let data;\n try {\n data = JSON.parse(value);\n }\n catch (_a) {\n return pushError(state, `Expected to be a valid JSON string (got ${getPrintable(value)})`);\n }\n return spec(data, state);\n },\n });\n}\n\nfunction cascade(spec, ...followups) {\n const resolvedFollowups = Array.isArray(followups[0])\n ? followups[0]\n : followups;\n return makeValidator({\n test: (value, state) => {\n var _a, _b;\n const context = { value: value };\n const subCoercion = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`\n ? makeCoercionFn(context, `value`) : undefined;\n const subCoercions = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`\n ? [] : undefined;\n if (!spec(value, Object.assign(Object.assign({}, state), { coercion: subCoercion, coercions: subCoercions })))\n return false;\n const reverts = [];\n if (typeof subCoercions !== `undefined`)\n for (const [, coercion] of subCoercions)\n reverts.push(coercion());\n try {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {\n if (context.value !== value) {\n if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)\n return pushError(state, `Unbound coercion result`);\n state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, context.value)]);\n }\n (_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions);\n }\n return resolvedFollowups.every(spec => {\n return spec(context.value, state);\n });\n }\n finally {\n for (const revert of reverts) {\n revert();\n }\n }\n },\n });\n}\nfunction applyCascade(spec, ...followups) {\n const resolvedFollowups = Array.isArray(followups[0])\n ? followups[0]\n : followups;\n return cascade(spec, resolvedFollowups);\n}\n/**\n * Wraps the given spec to also allow `undefined`.\n */\nfunction isOptional(spec) {\n return makeValidator({\n test: (value, state) => {\n if (typeof value === `undefined`)\n return true;\n return spec(value, state);\n },\n });\n}\n/**\n * Wraps the given spec to also allow `null`.\n */\nfunction isNullable(spec) {\n return makeValidator({\n test: (value, state) => {\n if (value === null)\n return true;\n return spec(value, state);\n },\n });\n}\nconst checks = {\n missing: (keys, key) => keys.has(key),\n undefined: (keys, key, value) => keys.has(key) && typeof value[key] !== `undefined`,\n nil: (keys, key, value) => keys.has(key) && value[key] != null,\n falsy: (keys, key, value) => keys.has(key) && !!value[key],\n};\n/**\n * Create a validator that checks that the tested object contains the specified\n * keys.\n*/\nfunction hasRequiredKeys(requiredKeys, options) {\n var _a;\n const requiredSet = new Set(requiredKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n const problems = [];\n for (const key of requiredSet)\n if (!check(keys, key, value))\n problems.push(key);\n if (problems.length > 0)\n return pushError(state, `Missing required ${plural(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);\n return true;\n },\n });\n}\n/**\n* Create a validator that checks that the tested object contains at least one\n* of the specified keys.\n*/\nfunction hasAtLeastOneKey(requiredKeys, options) {\n var _a;\n const requiredSet = new Set(requiredKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = Object.keys(value);\n const valid = keys.some(key => check(requiredSet, key, value));\n if (!valid)\n return pushError(state, `Missing at least one property from ${getPrintableArray(Array.from(requiredSet), `or`)}`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested object contains none of the\n * specified keys.\n*/\nfunction hasForbiddenKeys(forbiddenKeys, options) {\n var _a;\n const forbiddenSet = new Set(forbiddenKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n const problems = [];\n for (const key of forbiddenSet)\n if (check(keys, key, value))\n problems.push(key);\n if (problems.length > 0)\n return pushError(state, `Forbidden ${plural(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);\n return true;\n },\n });\n}\n/**\n * Create a validator that checks that the tested object contains at most one\n * of the specified keys.\n */\nfunction hasMutuallyExclusiveKeys(exclusiveKeys, options) {\n var _a;\n const exclusiveSet = new Set(exclusiveKeys);\n const check = checks[(_a = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _a !== void 0 ? _a : 'missing'];\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n const used = [];\n for (const key of exclusiveSet)\n if (check(keys, key, value))\n used.push(key);\n if (used.length > 1)\n return pushError(state, `Mutually exclusive properties ${getPrintableArray(used, `and`)}`);\n return true;\n },\n });\n}\n(function (KeyRelationship) {\n KeyRelationship[\"Forbids\"] = \"Forbids\";\n KeyRelationship[\"Requires\"] = \"Requires\";\n})(exports.KeyRelationship || (exports.KeyRelationship = {}));\nconst keyRelationships = {\n [exports.KeyRelationship.Forbids]: {\n expect: false,\n message: `forbids using`,\n },\n [exports.KeyRelationship.Requires]: {\n expect: true,\n message: `requires using`,\n },\n};\n/**\n * Create a validator that checks that, when the specified subject property is\n * set, the relationship is satisfied.\n */\nfunction hasKeyRelationship(subject, relationship, others, options) {\n var _a, _b;\n const skipped = new Set((_a = options === null || options === void 0 ? void 0 : options.ignore) !== null && _a !== void 0 ? _a : []);\n const check = checks[(_b = options === null || options === void 0 ? void 0 : options.missingIf) !== null && _b !== void 0 ? _b : 'missing'];\n const otherSet = new Set(others);\n const spec = keyRelationships[relationship];\n const conjunction = relationship === exports.KeyRelationship.Forbids\n ? `or`\n : `and`;\n return makeValidator({\n test: (value, state) => {\n const keys = new Set(Object.keys(value));\n if (!check(keys, subject, value) || skipped.has(value[subject]))\n return true;\n const problems = [];\n for (const key of otherSet)\n if ((check(keys, key, value) && !skipped.has(value[key])) !== spec.expect)\n problems.push(key);\n if (problems.length >= 1)\n return pushError(state, `Property \"${subject}\" ${spec.message} ${plural(problems.length, `property`, `properties`)} ${getPrintableArray(problems, conjunction)}`);\n return true;\n },\n });\n}\n\nexports.TypeAssertionError = TypeAssertionError;\nexports.applyCascade = applyCascade;\nexports.as = as;\nexports.assert = assert;\nexports.assertWithErrors = assertWithErrors;\nexports.cascade = cascade;\nexports.fn = fn;\nexports.hasAtLeastOneKey = hasAtLeastOneKey;\nexports.hasExactLength = hasExactLength;\nexports.hasForbiddenKeys = hasForbiddenKeys;\nexports.hasKeyRelationship = hasKeyRelationship;\nexports.hasMaxLength = hasMaxLength;\nexports.hasMinLength = hasMinLength;\nexports.hasMutuallyExclusiveKeys = hasMutuallyExclusiveKeys;\nexports.hasRequiredKeys = hasRequiredKeys;\nexports.hasUniqueItems = hasUniqueItems;\nexports.isArray = isArray;\nexports.isAtLeast = isAtLeast;\nexports.isAtMost = isAtMost;\nexports.isBase64 = isBase64;\nexports.isBoolean = isBoolean;\nexports.isDate = isDate;\nexports.isDict = isDict;\nexports.isEnum = isEnum;\nexports.isHexColor = isHexColor;\nexports.isISO8601 = isISO8601;\nexports.isInExclusiveRange = isInExclusiveRange;\nexports.isInInclusiveRange = isInInclusiveRange;\nexports.isInstanceOf = isInstanceOf;\nexports.isInteger = isInteger;\nexports.isJSON = isJSON;\nexports.isLiteral = isLiteral;\nexports.isLowerCase = isLowerCase;\nexports.isMap = isMap;\nexports.isNegative = isNegative;\nexports.isNullable = isNullable;\nexports.isNumber = isNumber;\nexports.isObject = isObject;\nexports.isOneOf = isOneOf;\nexports.isOptional = isOptional;\nexports.isPartial = isPartial;\nexports.isPayload = isPayload;\nexports.isPositive = isPositive;\nexports.isRecord = isRecord;\nexports.isSet = isSet;\nexports.isString = isString;\nexports.isTuple = isTuple;\nexports.isUUID4 = isUUID4;\nexports.isUnknown = isUnknown;\nexports.isUpperCase = isUpperCase;\nexports.makeTrait = makeTrait;\nexports.makeValidator = makeValidator;\nexports.matchesRegExp = matchesRegExp;\nexports.softAssert = softAssert;\n","import { Command, Option } from 'clipanion';\nimport { isEnum } from 'typanion';\n\nimport type { ColorMode, LogLevel } from '../internal/Logger.js';\n\nimport { ManagedScript } from '../ManagedScript.js';\n\nconst isLogLevel = isEnum(['debug', 'error', 'info', 'silent', 'warn'] as const);\n\nconst isColorModes = isEnum(['always', 'auto', 'never'] as const);\n\nexport class RootCommand extends Command {\n static override paths = [Command.Default];\n static override usage = Command.Usage({\n description: 'Run a script from the managed-script configuration.',\n details: 'Resolves the script name from the first positional argument or npm_lifecycle_event, then executes it. Use --dry-run,-n to print the resolved command without executing it. Use --loglevel, --silent,-s or --verbose,-v to control status messages, forwarded to the script as MANAGED_SCRIPT_LOGLEVEL. Use --color[=WHEN] or --no-color to control ANSI colors (WHEN: auto, always, never).',\n });\n\n readonly color = Option.String('--color', {\n description: 'Control ANSI colors (auto, always, never). Bare --color means always.',\n required: false,\n tolerateBoolean: true,\n validator: isColorModes,\n });\n\n readonly cwd = Option.String('--cwd', {\n description: 'Working directory used to resolve configuration and run the script.',\n required: false,\n });\n\n readonly dryRun = Option.Boolean('--dry-run,-n', false, {\n description: 'Print the resolved command instead of executing it.',\n });\n\n readonly loglevel = Option.String('--loglevel', {\n description: 'Set the log level (silent, error, warn, info, debug). Default: info.',\n required: false,\n validator: isLogLevel,\n });\n\n readonly scriptArgs = Option.Rest();\n\n readonly silent = Option.Boolean('--silent,-s', false, {\n description: 'Alias for --loglevel silent.',\n });\n\n readonly verbose = Option.Boolean('--verbose,-v', false, {\n description: 'Alias for --loglevel debug.',\n });\n\n async execute(): Promise<number> {\n const [scriptName, ...scriptArgs] = this.scriptArgs;\n let color: ColorMode | undefined;\n if (this.color === true) {\n color = 'always';\n } else if (this.color === false) {\n color = 'never';\n } else if (this.color != null) {\n color = this.color;\n }\n let logLevel: LogLevel | undefined;\n if (this.silent) {\n logLevel = 'silent';\n } else if (this.verbose) {\n logLevel = 'debug';\n } else if (this.loglevel != null) {\n logLevel = this.loglevel;\n }\n\n try {\n await ManagedScript.runScript({\n context: {\n cli: { color, cwd: this.cwd, dryRun: this.dryRun, logLevel },\n stdio: ['inherit', this.context.stdout, this.context.stderr],\n },\n parameters: {\n scriptArgs,\n scriptName,\n },\n });\n return 0;\n } catch (error) {\n this.context.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n }\n}\n","import { Builtins, Cli } from 'clipanion';\n\nimport { meta } from '../meta.js';\nimport { RootCommand } from './RootCommand.js';\n\nexport async function runCLI(): Promise<void> {\n const cli = new Cli({\n binaryLabel: meta.binaryLabel,\n binaryName: meta.binaryName,\n binaryVersion: meta.binaryVersion,\n });\n\n cli.register(RootCommand);\n cli.register(Builtins.HelpCommand);\n cli.register(Builtins.VersionCommand);\n\n try {\n await cli.runExit(process.argv.slice(2), {\n stderr: process.stderr,\n stdin: process.stdin,\n stdout: process.stdout,\n });\n } catch (error) {\n console.error(error instanceof Error ? error.message : error);\n process.exitCode = 1;\n }\n}\n","#!/usr/bin/env node\nimport { runCLI } from './cli/runCLI.js';\n\nvoid runCLI();\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI;CACH,SAAU,cAAc;CACrB,aAAa,kBAAkB;CAC/B,aAAa,gBAAgB;CAC7B,aAAa,uBAAuB;AACxC,EAAA,CAAG,iBAAiB,eAAe,CAAC,EAAE;AACtC,IAAI;CACH,SAAU,UAAU;CACjB,SAAS,SAAS,iBAAiB,KAAK;CACxC,SAAS,SAAS,iBAAiB,KAAK;CACxC,SAAS,SAAS,eAAe,KAAK;CACtC,SAAS,SAAS,gBAAgB,KAAK;AAC3C,EAAA,CAAG,aAAa,WAAW,CAAC,EAAE;AAE9B,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,gBAAgB;AACtB,MAAM,WAAW,QAAQ,IAAI,cAAc;;;;;;;ACX3C,IAAM,aAAN,cAAyB,MAAM;CAC3B,YAAY,SAAS;EACjB,MAAM,OAAO;EACb,KAAK,YAAY,EAAE,MAAM,QAAQ;EACjC,KAAK,OAAO;CAChB;AACJ;AACA,IAAM,qBAAN,cAAiC,MAAM;CACnC,YAAY,OAAO,YAAY;EAC3B,MAAM;EACN,KAAK,QAAQ;EACb,KAAK,aAAa;EAClB,KAAK,YAAY,EAAE,MAAM,OAAO;EAChC,K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