ocx 2.0.2 → 2.0.3

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 (3) hide show
  1. package/dist/index.js +181 -21414
  2. package/package.json +3 -8
  3. package/dist/index.js.map +0 -141
package/dist/index.js.map DELETED
@@ -1,141 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/error.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/argument.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/help.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/option.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/suggestSimilar.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/command.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/index.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js", "../../../node_modules/.bun/zod@3.25.76/node_modules/zod/index.js", "../src/utils/url.ts", "../src/constants.ts", "../src/utils/errors.ts", "../src/utils/path-security.ts", "../src/schemas/registry.ts", "../src/utils/type-guards.ts", "../src/registry/fetcher.ts", "../../../node_modules/.bun/cli-spinners@2.9.2/node_modules/cli-spinners/index.js", "../../../node_modules/.bun/fuzzysort@3.1.0/node_modules/fuzzysort/fuzzysort.js", "../../../node_modules/.bun/commander@14.0.2/node_modules/commander/esm.mjs", "../src/commands/add.ts", "../src/schemas/config.ts", "../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js", "../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js", "../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js", "../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js", "../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js", "../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js", "../src/config/provider.ts", "../src/utils/paths.ts", "../src/utils/component-root-resolution.ts", "../src/config/resolver.ts", "../src/profile/manager.ts", "../src/schemas/ocx.ts", "../src/schemas/common.ts", "../src/utils/path-helpers.ts", "../src/profile/atomic.ts", "../src/profile/paths.ts", "../src/profile/schema.ts", "../../../node_modules/.bun/remeda@2.33.1/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js", "../../../node_modules/.bun/remeda@2.33.1/node_modules/remeda/dist/purry-GjwKKIlp.js", "../../../node_modules/.bun/remeda@2.33.1/node_modules/remeda/dist/isPlainObject.js", "../../../node_modules/.bun/remeda@2.33.1/node_modules/remeda/dist/mergeDeep.js", "../src/registry/merge.ts", "../src/utils/git-root.ts", "../src/utils/instruction-paths.ts", "../src/registry/resolver.ts", "../src/updaters/update-opencode-config.ts", "../src/utils/content.ts", "../src/utils/dep-invalidation.ts", "../../../node_modules/.bun/kleur@4.1.5/node_modules/kleur/index.mjs", "../src/utils/env.ts", "../src/utils/logger.ts", "../src/utils/dry-run.ts", "../src/utils/index.ts", "../src/utils/git-context.ts", "../src/utils/handle-error.ts", "../src/lib/build-registry.ts", "../src/utils/json-output.ts", "../src/utils/shared-options.ts", "../../../node_modules/.bun/ora@8.2.0/node_modules/ora/index.js", "../../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js", "../../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js", "../../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/utilities.js", "../../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/index.js", "../../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js", "../../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js", "../../../node_modules/.bun/mimic-function@5.0.1/node_modules/mimic-function/index.js", "../../../node_modules/.bun/onetime@7.0.0/node_modules/onetime/index.js", "../../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js", "../../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js", "../../../node_modules/.bun/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js", "../../../node_modules/.bun/log-symbols@6.0.0/node_modules/log-symbols/index.js", "../../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js", "../../../node_modules/.bun/strip-ansi@7.1.2/node_modules/strip-ansi/index.js", "../../../node_modules/.bun/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js", "../../../node_modules/.bun/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js", "../../../node_modules/.bun/emoji-regex@10.6.0/node_modules/emoji-regex/index.mjs", "../../../node_modules/.bun/string-width@7.2.0/node_modules/string-width/index.js", "../../../node_modules/.bun/is-interactive@2.0.0/node_modules/is-interactive/index.js", "../../../node_modules/.bun/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js", "../../../node_modules/.bun/stdin-discarder@0.2.2/node_modules/stdin-discarder/index.js", "../src/utils/spinner.ts", "../src/utils/version-compat.ts", "../src/utils/npm-registry.ts", "../src/utils/planned-writes.ts", "../src/utils/receipt.ts", "../src/commands/build.ts", "../src/lib/validators.ts", "../src/lib/validation-runner.ts", "../src/utils/validation-errors.ts", "../src/commands/config/edit.ts", "../src/commands/config/show.ts", "../src/commands/config/index.ts", "../src/commands/init.ts", "../src/commands/migrate/index.ts", "../src/commands/migrate/transform.ts", "../src/commands/opencode.ts", "../src/utils/terminal-title.ts", "../src/commands/opencode-overlay.ts", "../src/commands/profile/add.ts", "../src/commands/profile/install-from-registry.ts", "../src/commands/profile/list.ts", "../src/commands/profile/move.ts", "../src/commands/profile/remove.ts", "../src/commands/profile/show.ts", "../src/commands/profile/index.ts", "../src/commands/registry.ts", "../src/commands/remove.ts", "../src/utils/component-ref-resolver.ts", "../src/commands/search.ts", "../src/schemas/index.ts", "../src/commands/self/uninstall.ts", "../src/self-update/detect-method.ts", "../src/self-update/check.ts", "../src/self-update/version-provider.ts", "../src/self-update/download.ts", "../src/self-update/notify.ts", "../src/self-update/verify.ts", "../src/commands/self/update.ts", "../src/commands/self/index.ts", "../src/commands/update.ts", "../src/commands/validate.ts", "../src/commands/verify.ts", "../src/self-update/index.ts", "../src/index.ts"],
4
- "sourcesContent": [
5
- "/**\n * CommanderError class\n */\nclass CommanderError extends Error {\n /**\n * Constructs the CommanderError class\n * @param {number} exitCode suggested exit code which could be used with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n */\n constructor(exitCode, code, message) {\n super(message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n this.code = code;\n this.exitCode = exitCode;\n this.nestedError = undefined;\n }\n}\n\n/**\n * InvalidArgumentError class\n */\nclass InvalidArgumentError extends CommanderError {\n /**\n * Constructs the InvalidArgumentError class\n * @param {string} [message] explanation of why argument is invalid\n */\n constructor(message) {\n super(1, 'commander.invalidArgument', message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n }\n}\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\n",
6
- "const { InvalidArgumentError } = require('./error.js');\n\nclass Argument {\n /**\n * Initialize a new command argument with the given name and description.\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @param {string} name\n * @param {string} [description]\n */\n\n constructor(name, description) {\n this.description = description || '';\n this.variadic = false;\n this.parseArg = undefined;\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.argChoices = undefined;\n\n switch (name[0]) {\n case '<': // e.g. <required>\n this.required = true;\n this._name = name.slice(1, -1);\n break;\n case '[': // e.g. [optional]\n this.required = false;\n this._name = name.slice(1, -1);\n break;\n default:\n this.required = true;\n this._name = name;\n break;\n }\n\n if (this._name.endsWith('...')) {\n this.variadic = true;\n this._name = this._name.slice(0, -3);\n }\n }\n\n /**\n * Return argument name.\n *\n * @return {string}\n */\n\n name() {\n return this._name;\n }\n\n /**\n * @package\n */\n\n _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Argument}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI command arguments into argument values.\n *\n * @param {Function} [fn]\n * @return {Argument}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Only allow argument value to be one of choices.\n *\n * @param {string[]} values\n * @return {Argument}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._collectValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Make argument required.\n *\n * @returns {Argument}\n */\n argRequired() {\n this.required = true;\n return this;\n }\n\n /**\n * Make argument optional.\n *\n * @returns {Argument}\n */\n argOptional() {\n this.required = false;\n return this;\n }\n}\n\n/**\n * Takes an argument and returns its human readable equivalent for help usage.\n *\n * @param {Argument} arg\n * @return {string}\n * @private\n */\n\nfunction humanReadableArgName(arg) {\n const nameOutput = arg.name() + (arg.variadic === true ? '...' : '');\n\n return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';\n}\n\nexports.Argument = Argument;\nexports.humanReadableArgName = humanReadableArgName;\n",
7
- "const { humanReadableArgName } = require('./argument.js');\n\n/**\n * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`\n * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types\n * @typedef { import(\"./argument.js\").Argument } Argument\n * @typedef { import(\"./command.js\").Command } Command\n * @typedef { import(\"./option.js\").Option } Option\n */\n\n// Although this is a class, methods are static in style to allow override using subclass or just functions.\nclass Help {\n constructor() {\n this.helpWidth = undefined;\n this.minWidthToWrap = 40;\n this.sortSubcommands = false;\n this.sortOptions = false;\n this.showGlobalOptions = false;\n }\n\n /**\n * prepareContext is called by Commander after applying overrides from `Command.configureHelp()`\n * and just before calling `formatHelp()`.\n *\n * Commander just uses the helpWidth and the rest is provided for optional use by more complex subclasses.\n *\n * @param {{ error?: boolean, helpWidth?: number, outputHasColors?: boolean }} contextOptions\n */\n prepareContext(contextOptions) {\n this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;\n }\n\n /**\n * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.\n *\n * @param {Command} cmd\n * @returns {Command[]}\n */\n\n visibleCommands(cmd) {\n const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);\n const helpCommand = cmd._getHelpCommand();\n if (helpCommand && !helpCommand._hidden) {\n visibleCommands.push(helpCommand);\n }\n if (this.sortSubcommands) {\n visibleCommands.sort((a, b) => {\n // @ts-ignore: because overloaded return type\n return a.name().localeCompare(b.name());\n });\n }\n return visibleCommands;\n }\n\n /**\n * Compare options for sort.\n *\n * @param {Option} a\n * @param {Option} b\n * @returns {number}\n */\n compareOptions(a, b) {\n const getSortKey = (option) => {\n // WYSIWYG for order displayed in help. Short used for comparison if present. No special handling for negated.\n return option.short\n ? option.short.replace(/^-/, '')\n : option.long.replace(/^--/, '');\n };\n return getSortKey(a).localeCompare(getSortKey(b));\n }\n\n /**\n * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleOptions(cmd) {\n const visibleOptions = cmd.options.filter((option) => !option.hidden);\n // Built-in help option.\n const helpOption = cmd._getHelpOption();\n if (helpOption && !helpOption.hidden) {\n // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs.\n const removeShort = helpOption.short && cmd._findOption(helpOption.short);\n const removeLong = helpOption.long && cmd._findOption(helpOption.long);\n if (!removeShort && !removeLong) {\n visibleOptions.push(helpOption); // no changes needed\n } else if (helpOption.long && !removeLong) {\n visibleOptions.push(\n cmd.createOption(helpOption.long, helpOption.description),\n );\n } else if (helpOption.short && !removeShort) {\n visibleOptions.push(\n cmd.createOption(helpOption.short, helpOption.description),\n );\n }\n }\n if (this.sortOptions) {\n visibleOptions.sort(this.compareOptions);\n }\n return visibleOptions;\n }\n\n /**\n * Get an array of the visible global options. (Not including help.)\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleGlobalOptions(cmd) {\n if (!this.showGlobalOptions) return [];\n\n const globalOptions = [];\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n const visibleOptions = ancestorCmd.options.filter(\n (option) => !option.hidden,\n );\n globalOptions.push(...visibleOptions);\n }\n if (this.sortOptions) {\n globalOptions.sort(this.compareOptions);\n }\n return globalOptions;\n }\n\n /**\n * Get an array of the arguments if any have a description.\n *\n * @param {Command} cmd\n * @returns {Argument[]}\n */\n\n visibleArguments(cmd) {\n // Side effect! Apply the legacy descriptions before the arguments are displayed.\n if (cmd._argsDescription) {\n cmd.registeredArguments.forEach((argument) => {\n argument.description =\n argument.description || cmd._argsDescription[argument.name()] || '';\n });\n }\n\n // If there are any arguments with a description then return all the arguments.\n if (cmd.registeredArguments.find((argument) => argument.description)) {\n return cmd.registeredArguments;\n }\n return [];\n }\n\n /**\n * Get the command term to show in the list of subcommands.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandTerm(cmd) {\n // Legacy. Ignores custom usage string, and nested commands.\n const args = cmd.registeredArguments\n .map((arg) => humanReadableArgName(arg))\n .join(' ');\n return (\n cmd._name +\n (cmd._aliases[0] ? '|' + cmd._aliases[0] : '') +\n (cmd.options.length ? ' [options]' : '') + // simplistic check for non-help option\n (args ? ' ' + args : '')\n );\n }\n\n /**\n * Get the option term to show in the list of options.\n *\n * @param {Option} option\n * @returns {string}\n */\n\n optionTerm(option) {\n return option.flags;\n }\n\n /**\n * Get the argument term to show in the list of arguments.\n *\n * @param {Argument} argument\n * @returns {string}\n */\n\n argumentTerm(argument) {\n return argument.name();\n }\n\n /**\n * Get the longest command term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestSubcommandTermLength(cmd, helper) {\n return helper.visibleCommands(cmd).reduce((max, command) => {\n return Math.max(\n max,\n this.displayWidth(\n helper.styleSubcommandTerm(helper.subcommandTerm(command)),\n ),\n );\n }, 0);\n }\n\n /**\n * Get the longest option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestOptionTermLength(cmd, helper) {\n return helper.visibleOptions(cmd).reduce((max, option) => {\n return Math.max(\n max,\n this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),\n );\n }, 0);\n }\n\n /**\n * Get the longest global option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestGlobalOptionTermLength(cmd, helper) {\n return helper.visibleGlobalOptions(cmd).reduce((max, option) => {\n return Math.max(\n max,\n this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),\n );\n }, 0);\n }\n\n /**\n * Get the longest argument term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestArgumentTermLength(cmd, helper) {\n return helper.visibleArguments(cmd).reduce((max, argument) => {\n return Math.max(\n max,\n this.displayWidth(\n helper.styleArgumentTerm(helper.argumentTerm(argument)),\n ),\n );\n }, 0);\n }\n\n /**\n * Get the command usage to be displayed at the top of the built-in help.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandUsage(cmd) {\n // Usage\n let cmdName = cmd._name;\n if (cmd._aliases[0]) {\n cmdName = cmdName + '|' + cmd._aliases[0];\n }\n let ancestorCmdNames = '';\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames;\n }\n return ancestorCmdNames + cmdName + ' ' + cmd.usage();\n }\n\n /**\n * Get the description for the command.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.description();\n }\n\n /**\n * Get the subcommand summary to show in the list of subcommands.\n * (Fallback to description for backwards compatibility.)\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.summary() || cmd.description();\n }\n\n /**\n * Get the option description to show in the list of options.\n *\n * @param {Option} option\n * @return {string}\n */\n\n optionDescription(option) {\n const extraInfo = [];\n\n if (option.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (option.defaultValue !== undefined) {\n // default for boolean and negated more for programmer than end user,\n // but show true/false for boolean option as may be for hand-rolled env or config processing.\n const showDefault =\n option.required ||\n option.optional ||\n (option.isBoolean() && typeof option.defaultValue === 'boolean');\n if (showDefault) {\n extraInfo.push(\n `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`,\n );\n }\n }\n // preset for boolean and negated are more for programmer than end user\n if (option.presetArg !== undefined && option.optional) {\n extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);\n }\n if (option.envVar !== undefined) {\n extraInfo.push(`env: ${option.envVar}`);\n }\n if (extraInfo.length > 0) {\n const extraDescription = `(${extraInfo.join(', ')})`;\n if (option.description) {\n return `${option.description} ${extraDescription}`;\n }\n return extraDescription;\n }\n\n return option.description;\n }\n\n /**\n * Get the argument description to show in the list of arguments.\n *\n * @param {Argument} argument\n * @return {string}\n */\n\n argumentDescription(argument) {\n const extraInfo = [];\n if (argument.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (argument.defaultValue !== undefined) {\n extraInfo.push(\n `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`,\n );\n }\n if (extraInfo.length > 0) {\n const extraDescription = `(${extraInfo.join(', ')})`;\n if (argument.description) {\n return `${argument.description} ${extraDescription}`;\n }\n return extraDescription;\n }\n return argument.description;\n }\n\n /**\n * Format a list of items, given a heading and an array of formatted items.\n *\n * @param {string} heading\n * @param {string[]} items\n * @param {Help} helper\n * @returns string[]\n */\n formatItemList(heading, items, helper) {\n if (items.length === 0) return [];\n\n return [helper.styleTitle(heading), ...items, ''];\n }\n\n /**\n * Group items by their help group heading.\n *\n * @param {Command[] | Option[]} unsortedItems\n * @param {Command[] | Option[]} visibleItems\n * @param {Function} getGroup\n * @returns {Map<string, Command[] | Option[]>}\n */\n groupItems(unsortedItems, visibleItems, getGroup) {\n const result = new Map();\n // Add groups in order of appearance in unsortedItems.\n unsortedItems.forEach((item) => {\n const group = getGroup(item);\n if (!result.has(group)) result.set(group, []);\n });\n // Add items in order of appearance in visibleItems.\n visibleItems.forEach((item) => {\n const group = getGroup(item);\n if (!result.has(group)) {\n result.set(group, []);\n }\n result.get(group).push(item);\n });\n return result;\n }\n\n /**\n * Generate the built-in help text.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {string}\n */\n\n formatHelp(cmd, helper) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth ?? 80; // in case prepareContext() was not called\n\n function callFormatItem(term, description) {\n return helper.formatItem(term, termWidth, description, helper);\n }\n\n // Usage\n let output = [\n `${helper.styleTitle('Usage:')} ${helper.styleUsage(helper.commandUsage(cmd))}`,\n '',\n ];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(\n helper.styleCommandDescription(commandDescription),\n helpWidth,\n ),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument) => {\n return callFormatItem(\n helper.styleArgumentTerm(helper.argumentTerm(argument)),\n helper.styleArgumentDescription(helper.argumentDescription(argument)),\n );\n });\n output = output.concat(\n this.formatItemList('Arguments:', argumentList, helper),\n );\n\n // Options\n const optionGroups = this.groupItems(\n cmd.options,\n helper.visibleOptions(cmd),\n (option) => option.helpGroupHeading ?? 'Options:',\n );\n optionGroups.forEach((options, group) => {\n const optionList = options.map((option) => {\n return callFormatItem(\n helper.styleOptionTerm(helper.optionTerm(option)),\n helper.styleOptionDescription(helper.optionDescription(option)),\n );\n });\n output = output.concat(this.formatItemList(group, optionList, helper));\n });\n\n if (helper.showGlobalOptions) {\n const globalOptionList = helper\n .visibleGlobalOptions(cmd)\n .map((option) => {\n return callFormatItem(\n helper.styleOptionTerm(helper.optionTerm(option)),\n helper.styleOptionDescription(helper.optionDescription(option)),\n );\n });\n output = output.concat(\n this.formatItemList('Global Options:', globalOptionList, helper),\n );\n }\n\n // Commands\n const commandGroups = this.groupItems(\n cmd.commands,\n helper.visibleCommands(cmd),\n (sub) => sub.helpGroup() || 'Commands:',\n );\n commandGroups.forEach((commands, group) => {\n const commandList = commands.map((sub) => {\n return callFormatItem(\n helper.styleSubcommandTerm(helper.subcommandTerm(sub)),\n helper.styleSubcommandDescription(helper.subcommandDescription(sub)),\n );\n });\n output = output.concat(this.formatItemList(group, commandList, helper));\n });\n\n return output.join('\\n');\n }\n\n /**\n * Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations.\n *\n * @param {string} str\n * @returns {number}\n */\n displayWidth(str) {\n return stripColor(str).length;\n }\n\n /**\n * Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.\n *\n * @param {string} str\n * @returns {string}\n */\n styleTitle(str) {\n return str;\n }\n\n styleUsage(str) {\n // Usage has lots of parts the user might like to color separately! Assume default usage string which is formed like:\n // command subcommand [options] [command] <foo> [bar]\n return str\n .split(' ')\n .map((word) => {\n if (word === '[options]') return this.styleOptionText(word);\n if (word === '[command]') return this.styleSubcommandText(word);\n if (word[0] === '[' || word[0] === '<')\n return this.styleArgumentText(word);\n return this.styleCommandText(word); // Restrict to initial words?\n })\n .join(' ');\n }\n styleCommandDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleOptionDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleSubcommandDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleArgumentDescription(str) {\n return this.styleDescriptionText(str);\n }\n styleDescriptionText(str) {\n return str;\n }\n styleOptionTerm(str) {\n return this.styleOptionText(str);\n }\n styleSubcommandTerm(str) {\n // This is very like usage with lots of parts! Assume default string which is formed like:\n // subcommand [options] <foo> [bar]\n return str\n .split(' ')\n .map((word) => {\n if (word === '[options]') return this.styleOptionText(word);\n if (word[0] === '[' || word[0] === '<')\n return this.styleArgumentText(word);\n return this.styleSubcommandText(word); // Restrict to initial words?\n })\n .join(' ');\n }\n styleArgumentTerm(str) {\n return this.styleArgumentText(str);\n }\n styleOptionText(str) {\n return str;\n }\n styleArgumentText(str) {\n return str;\n }\n styleSubcommandText(str) {\n return str;\n }\n styleCommandText(str) {\n return str;\n }\n\n /**\n * Calculate the pad width from the maximum term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n padWidth(cmd, helper) {\n return Math.max(\n helper.longestOptionTermLength(cmd, helper),\n helper.longestGlobalOptionTermLength(cmd, helper),\n helper.longestSubcommandTermLength(cmd, helper),\n helper.longestArgumentTermLength(cmd, helper),\n );\n }\n\n /**\n * Detect manually wrapped and indented strings by checking for line break followed by whitespace.\n *\n * @param {string} str\n * @returns {boolean}\n */\n preformatted(str) {\n return /\\n[^\\S\\r\\n]/.test(str);\n }\n\n /**\n * Format the \"item\", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.\n *\n * So \"TTT\", 5, \"DDD DDDD DD DDD\" might be formatted for this.helpWidth=17 like so:\n * TTT DDD DDDD\n * DD DDD\n *\n * @param {string} term\n * @param {number} termWidth\n * @param {string} description\n * @param {Help} helper\n * @returns {string}\n */\n formatItem(term, termWidth, description, helper) {\n const itemIndent = 2;\n const itemIndentStr = ' '.repeat(itemIndent);\n if (!description) return itemIndentStr + term;\n\n // Pad the term out to a consistent width, so descriptions are aligned.\n const paddedTerm = term.padEnd(\n termWidth + term.length - helper.displayWidth(term),\n );\n\n // Format the description.\n const spacerWidth = 2; // between term and description\n const helpWidth = this.helpWidth ?? 80; // in case prepareContext() was not called\n const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;\n let formattedDescription;\n if (\n remainingWidth < this.minWidthToWrap ||\n helper.preformatted(description)\n ) {\n formattedDescription = description;\n } else {\n const wrappedDescription = helper.boxWrap(description, remainingWidth);\n formattedDescription = wrappedDescription.replace(\n /\\n/g,\n '\\n' + ' '.repeat(termWidth + spacerWidth),\n );\n }\n\n // Construct and overall indent.\n return (\n itemIndentStr +\n paddedTerm +\n ' '.repeat(spacerWidth) +\n formattedDescription.replace(/\\n/g, `\\n${itemIndentStr}`)\n );\n }\n\n /**\n * Wrap a string at whitespace, preserving existing line breaks.\n * Wrapping is skipped if the width is less than `minWidthToWrap`.\n *\n * @param {string} str\n * @param {number} width\n * @returns {string}\n */\n boxWrap(str, width) {\n if (width < this.minWidthToWrap) return str;\n\n const rawLines = str.split(/\\r\\n|\\n/);\n // split up text by whitespace\n const chunkPattern = /[\\s]*[^\\s]+/g;\n const wrappedLines = [];\n rawLines.forEach((line) => {\n const chunks = line.match(chunkPattern);\n if (chunks === null) {\n wrappedLines.push('');\n return;\n }\n\n let sumChunks = [chunks.shift()];\n let sumWidth = this.displayWidth(sumChunks[0]);\n chunks.forEach((chunk) => {\n const visibleWidth = this.displayWidth(chunk);\n // Accumulate chunks while they fit into width.\n if (sumWidth + visibleWidth <= width) {\n sumChunks.push(chunk);\n sumWidth += visibleWidth;\n return;\n }\n wrappedLines.push(sumChunks.join(''));\n\n const nextChunk = chunk.trimStart(); // trim space at line break\n sumChunks = [nextChunk];\n sumWidth = this.displayWidth(nextChunk);\n });\n wrappedLines.push(sumChunks.join(''));\n });\n\n return wrappedLines.join('\\n');\n }\n}\n\n/**\n * Strip style ANSI escape sequences from the string. In particular, SGR (Select Graphic Rendition) codes.\n *\n * @param {string} str\n * @returns {string}\n * @package\n */\n\nfunction stripColor(str) {\n // eslint-disable-next-line no-control-regex\n const sgrPattern = /\\x1b\\[\\d*(;\\d*)*m/g;\n return str.replace(sgrPattern, '');\n}\n\nexports.Help = Help;\nexports.stripColor = stripColor;\n",
8
- "const { InvalidArgumentError } = require('./error.js');\n\nclass Option {\n /**\n * Initialize a new `Option` with the given `flags` and `description`.\n *\n * @param {string} flags\n * @param {string} [description]\n */\n\n constructor(flags, description) {\n this.flags = flags;\n this.description = description || '';\n\n this.required = flags.includes('<'); // A value must be supplied when the option is specified.\n this.optional = flags.includes('['); // A value is optional when the option is specified.\n // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument\n this.variadic = /\\w\\.\\.\\.[>\\]]$/.test(flags); // The option can take multiple values.\n this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.\n const optionFlags = splitOptionFlags(flags);\n this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).\n this.long = optionFlags.longFlag;\n this.negate = false;\n if (this.long) {\n this.negate = this.long.startsWith('--no-');\n }\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.presetArg = undefined;\n this.envVar = undefined;\n this.parseArg = undefined;\n this.hidden = false;\n this.argChoices = undefined;\n this.conflictsWith = [];\n this.implied = undefined;\n this.helpGroupHeading = undefined; // soft initialised when option added to command\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Option}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Preset to use when option used without option-argument, especially optional but also boolean and negated.\n * The custom processing (parseArg) is called.\n *\n * @example\n * new Option('--color').default('GREYSCALE').preset('RGB');\n * new Option('--donate [amount]').preset('20').argParser(parseFloat);\n *\n * @param {*} arg\n * @return {Option}\n */\n\n preset(arg) {\n this.presetArg = arg;\n return this;\n }\n\n /**\n * Add option name(s) that conflict with this option.\n * An error will be displayed if conflicting options are found during parsing.\n *\n * @example\n * new Option('--rgb').conflicts('cmyk');\n * new Option('--js').conflicts(['ts', 'jsx']);\n *\n * @param {(string | string[])} names\n * @return {Option}\n */\n\n conflicts(names) {\n this.conflictsWith = this.conflictsWith.concat(names);\n return this;\n }\n\n /**\n * Specify implied option values for when this option is set and the implied options are not.\n *\n * The custom processing (parseArg) is not called on the implied values.\n *\n * @example\n * program\n * .addOption(new Option('--log', 'write logging information to file'))\n * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));\n *\n * @param {object} impliedOptionValues\n * @return {Option}\n */\n implies(impliedOptionValues) {\n let newImplied = impliedOptionValues;\n if (typeof impliedOptionValues === 'string') {\n // string is not documented, but easy mistake and we can do what user probably intended.\n newImplied = { [impliedOptionValues]: true };\n }\n this.implied = Object.assign(this.implied || {}, newImplied);\n return this;\n }\n\n /**\n * Set environment variable to check for option value.\n *\n * An environment variable is only used if when processed the current option value is\n * undefined, or the source of the current value is 'default' or 'config' or 'env'.\n *\n * @param {string} name\n * @return {Option}\n */\n\n env(name) {\n this.envVar = name;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI option arguments into option values.\n *\n * @param {Function} [fn]\n * @return {Option}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Whether the option is mandatory and must have a value after parsing.\n *\n * @param {boolean} [mandatory=true]\n * @return {Option}\n */\n\n makeOptionMandatory(mandatory = true) {\n this.mandatory = !!mandatory;\n return this;\n }\n\n /**\n * Hide option in help.\n *\n * @param {boolean} [hide=true]\n * @return {Option}\n */\n\n hideHelp(hide = true) {\n this.hidden = !!hide;\n return this;\n }\n\n /**\n * @package\n */\n\n _collectValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n previous.push(value);\n return previous;\n }\n\n /**\n * Only allow option value to be one of choices.\n *\n * @param {string[]} values\n * @return {Option}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._collectValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Return option name.\n *\n * @return {string}\n */\n\n name() {\n if (this.long) {\n return this.long.replace(/^--/, '');\n }\n return this.short.replace(/^-/, '');\n }\n\n /**\n * Return option name, in a camelcase format that can be used\n * as an object attribute key.\n *\n * @return {string}\n */\n\n attributeName() {\n if (this.negate) {\n return camelcase(this.name().replace(/^no-/, ''));\n }\n return camelcase(this.name());\n }\n\n /**\n * Set the help group heading.\n *\n * @param {string} heading\n * @return {Option}\n */\n helpGroup(heading) {\n this.helpGroupHeading = heading;\n return this;\n }\n\n /**\n * Check if `arg` matches the short or long flag.\n *\n * @param {string} arg\n * @return {boolean}\n * @package\n */\n\n is(arg) {\n return this.short === arg || this.long === arg;\n }\n\n /**\n * Return whether a boolean option.\n *\n * Options are one of boolean, negated, required argument, or optional argument.\n *\n * @return {boolean}\n * @package\n */\n\n isBoolean() {\n return !this.required && !this.optional && !this.negate;\n }\n}\n\n/**\n * This class is to make it easier to work with dual options, without changing the existing\n * implementation. We support separate dual options for separate positive and negative options,\n * like `--build` and `--no-build`, which share a single option value. This works nicely for some\n * use cases, but is tricky for others where we want separate behaviours despite\n * the single shared option value.\n */\nclass DualOptions {\n /**\n * @param {Option[]} options\n */\n constructor(options) {\n this.positiveOptions = new Map();\n this.negativeOptions = new Map();\n this.dualOptions = new Set();\n options.forEach((option) => {\n if (option.negate) {\n this.negativeOptions.set(option.attributeName(), option);\n } else {\n this.positiveOptions.set(option.attributeName(), option);\n }\n });\n this.negativeOptions.forEach((value, key) => {\n if (this.positiveOptions.has(key)) {\n this.dualOptions.add(key);\n }\n });\n }\n\n /**\n * Did the value come from the option, and not from possible matching dual option?\n *\n * @param {*} value\n * @param {Option} option\n * @returns {boolean}\n */\n valueFromOption(value, option) {\n const optionKey = option.attributeName();\n if (!this.dualOptions.has(optionKey)) return true;\n\n // Use the value to deduce if (probably) came from the option.\n const preset = this.negativeOptions.get(optionKey).presetArg;\n const negativeValue = preset !== undefined ? preset : false;\n return option.negate === (negativeValue === value);\n }\n}\n\n/**\n * Convert string from kebab-case to camelCase.\n *\n * @param {string} str\n * @return {string}\n * @private\n */\n\nfunction camelcase(str) {\n return str.split('-').reduce((str, word) => {\n return str + word[0].toUpperCase() + word.slice(1);\n });\n}\n\n/**\n * Split the short and long flag out of something like '-m,--mixed <value>'\n *\n * @private\n */\n\nfunction splitOptionFlags(flags) {\n let shortFlag;\n let longFlag;\n // short flag, single dash and single character\n const shortFlagExp = /^-[^-]$/;\n // long flag, double dash and at least one character\n const longFlagExp = /^--[^-]/;\n\n const flagParts = flags.split(/[ |,]+/).concat('guard');\n // Normal is short and/or long.\n if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();\n if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();\n // Long then short. Rarely used but fine.\n if (!shortFlag && shortFlagExp.test(flagParts[0]))\n shortFlag = flagParts.shift();\n // Allow two long flags, like '--ws, --workspace'\n // This is the supported way to have a shortish option flag.\n if (!shortFlag && longFlagExp.test(flagParts[0])) {\n shortFlag = longFlag;\n longFlag = flagParts.shift();\n }\n\n // Check for unprocessed flag. Fail noisily rather than silently ignore.\n if (flagParts[0].startsWith('-')) {\n const unsupportedFlag = flagParts[0];\n const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;\n if (/^-[^-][^-]/.test(unsupportedFlag))\n throw new Error(\n `${baseError}\n- a short flag is a single dash and a single character\n - either use a single dash and a single character (for a short flag)\n - or use a double dash for a long option (and can have two, like '--ws, --workspace')`,\n );\n if (shortFlagExp.test(unsupportedFlag))\n throw new Error(`${baseError}\n- too many short flags`);\n if (longFlagExp.test(unsupportedFlag))\n throw new Error(`${baseError}\n- too many long flags`);\n\n throw new Error(`${baseError}\n- unrecognised flag format`);\n }\n if (shortFlag === undefined && longFlag === undefined)\n throw new Error(\n `option creation failed due to no flags found in '${flags}'.`,\n );\n\n return { shortFlag, longFlag };\n}\n\nexports.Option = Option;\nexports.DualOptions = DualOptions;\n",
9
- "const maxDistance = 3;\n\nfunction editDistance(a, b) {\n // https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance\n // Calculating optimal string alignment distance, no substring is edited more than once.\n // (Simple implementation.)\n\n // Quick early exit, return worst case.\n if (Math.abs(a.length - b.length) > maxDistance)\n return Math.max(a.length, b.length);\n\n // distance between prefix substrings of a and b\n const d = [];\n\n // pure deletions turn a into empty string\n for (let i = 0; i <= a.length; i++) {\n d[i] = [i];\n }\n // pure insertions turn empty string into b\n for (let j = 0; j <= b.length; j++) {\n d[0][j] = j;\n }\n\n // fill matrix\n for (let j = 1; j <= b.length; j++) {\n for (let i = 1; i <= a.length; i++) {\n let cost = 1;\n if (a[i - 1] === b[j - 1]) {\n cost = 0;\n } else {\n cost = 1;\n }\n d[i][j] = Math.min(\n d[i - 1][j] + 1, // deletion\n d[i][j - 1] + 1, // insertion\n d[i - 1][j - 1] + cost, // substitution\n );\n // transposition\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);\n }\n }\n }\n\n return d[a.length][b.length];\n}\n\n/**\n * Find close matches, restricted to same number of edits.\n *\n * @param {string} word\n * @param {string[]} candidates\n * @returns {string}\n */\n\nfunction suggestSimilar(word, candidates) {\n if (!candidates || candidates.length === 0) return '';\n // remove possible duplicates\n candidates = Array.from(new Set(candidates));\n\n const searchingOptions = word.startsWith('--');\n if (searchingOptions) {\n word = word.slice(2);\n candidates = candidates.map((candidate) => candidate.slice(2));\n }\n\n let similar = [];\n let bestDistance = maxDistance;\n const minSimilarity = 0.4;\n candidates.forEach((candidate) => {\n if (candidate.length <= 1) return; // no one character guesses\n\n const distance = editDistance(word, candidate);\n const length = Math.max(word.length, candidate.length);\n const similarity = (length - distance) / length;\n if (similarity > minSimilarity) {\n if (distance < bestDistance) {\n // better edit distance, throw away previous worse matches\n bestDistance = distance;\n similar = [candidate];\n } else if (distance === bestDistance) {\n similar.push(candidate);\n }\n }\n });\n\n similar.sort((a, b) => a.localeCompare(b));\n if (searchingOptions) {\n similar = similar.map((candidate) => `--${candidate}`);\n }\n\n if (similar.length > 1) {\n return `\\n(Did you mean one of ${similar.join(', ')}?)`;\n }\n if (similar.length === 1) {\n return `\\n(Did you mean ${similar[0]}?)`;\n }\n return '';\n}\n\nexports.suggestSimilar = suggestSimilar;\n",
10
- "const EventEmitter = require('node:events').EventEmitter;\nconst childProcess = require('node:child_process');\nconst path = require('node:path');\nconst fs = require('node:fs');\nconst process = require('node:process');\n\nconst { Argument, humanReadableArgName } = require('./argument.js');\nconst { CommanderError } = require('./error.js');\nconst { Help, stripColor } = require('./help.js');\nconst { Option, DualOptions } = require('./option.js');\nconst { suggestSimilar } = require('./suggestSimilar');\n\nclass Command extends EventEmitter {\n /**\n * Initialize a new `Command`.\n *\n * @param {string} [name]\n */\n\n constructor(name) {\n super();\n /** @type {Command[]} */\n this.commands = [];\n /** @type {Option[]} */\n this.options = [];\n this.parent = null;\n this._allowUnknownOption = false;\n this._allowExcessArguments = false;\n /** @type {Argument[]} */\n this.registeredArguments = [];\n this._args = this.registeredArguments; // deprecated old name\n /** @type {string[]} */\n this.args = []; // cli args with options removed\n this.rawArgs = [];\n this.processedArgs = []; // like .args but after custom processing and collecting variadic\n this._scriptPath = null;\n this._name = name || '';\n this._optionValues = {};\n this._optionValueSources = {}; // default, env, cli etc\n this._storeOptionsAsProperties = false;\n this._actionHandler = null;\n this._executableHandler = false;\n this._executableFile = null; // custom name for executable\n this._executableDir = null; // custom search directory for subcommands\n this._defaultCommandName = null;\n this._exitCallback = null;\n this._aliases = [];\n this._combineFlagAndOptionalValue = true;\n this._description = '';\n this._summary = '';\n this._argsDescription = undefined; // legacy\n this._enablePositionalOptions = false;\n this._passThroughOptions = false;\n this._lifeCycleHooks = {}; // a hash of arrays\n /** @type {(boolean | string)} */\n this._showHelpAfterError = false;\n this._showSuggestionAfterError = true;\n this._savedState = null; // used in save/restoreStateBeforeParse\n\n // see configureOutput() for docs\n this._outputConfiguration = {\n writeOut: (str) => process.stdout.write(str),\n writeErr: (str) => process.stderr.write(str),\n outputError: (str, write) => write(str),\n getOutHelpWidth: () =>\n process.stdout.isTTY ? process.stdout.columns : undefined,\n getErrHelpWidth: () =>\n process.stderr.isTTY ? process.stderr.columns : undefined,\n getOutHasColors: () =>\n useColor() ?? (process.stdout.isTTY && process.stdout.hasColors?.()),\n getErrHasColors: () =>\n useColor() ?? (process.stderr.isTTY && process.stderr.hasColors?.()),\n stripColor: (str) => stripColor(str),\n };\n\n this._hidden = false;\n /** @type {(Option | null | undefined)} */\n this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled.\n this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited\n /** @type {Command} */\n this._helpCommand = undefined; // lazy initialised, inherited\n this._helpConfiguration = {};\n /** @type {string | undefined} */\n this._helpGroupHeading = undefined; // soft initialised when added to parent\n /** @type {string | undefined} */\n this._defaultCommandGroup = undefined;\n /** @type {string | undefined} */\n this._defaultOptionGroup = undefined;\n }\n\n /**\n * Copy settings that are useful to have in common across root command and subcommands.\n *\n * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)\n *\n * @param {Command} sourceCommand\n * @return {Command} `this` command for chaining\n */\n copyInheritedSettings(sourceCommand) {\n this._outputConfiguration = sourceCommand._outputConfiguration;\n this._helpOption = sourceCommand._helpOption;\n this._helpCommand = sourceCommand._helpCommand;\n this._helpConfiguration = sourceCommand._helpConfiguration;\n this._exitCallback = sourceCommand._exitCallback;\n this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;\n this._combineFlagAndOptionalValue =\n sourceCommand._combineFlagAndOptionalValue;\n this._allowExcessArguments = sourceCommand._allowExcessArguments;\n this._enablePositionalOptions = sourceCommand._enablePositionalOptions;\n this._showHelpAfterError = sourceCommand._showHelpAfterError;\n this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;\n\n return this;\n }\n\n /**\n * @returns {Command[]}\n * @private\n */\n\n _getCommandAndAncestors() {\n const result = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n for (let command = this; command; command = command.parent) {\n result.push(command);\n }\n return result;\n }\n\n /**\n * Define a command.\n *\n * There are two styles of command: pay attention to where to put the description.\n *\n * @example\n * // Command implemented using action handler (description is supplied separately to `.command`)\n * program\n * .command('clone <source> [destination]')\n * .description('clone a repository into a newly created directory')\n * .action((source, destination) => {\n * console.log('clone command called');\n * });\n *\n * // Command implemented using separate executable file (description is second parameter to `.command`)\n * program\n * .command('start <service>', 'start named service')\n * .command('stop [service]', 'stop named service, or all if no name supplied');\n *\n * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`\n * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)\n * @param {object} [execOpts] - configuration options (for executable)\n * @return {Command} returns new command for action handler, or `this` for executable command\n */\n\n command(nameAndArgs, actionOptsOrExecDesc, execOpts) {\n let desc = actionOptsOrExecDesc;\n let opts = execOpts;\n if (typeof desc === 'object' && desc !== null) {\n opts = desc;\n desc = null;\n }\n opts = opts || {};\n const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);\n\n const cmd = this.createCommand(name);\n if (desc) {\n cmd.description(desc);\n cmd._executableHandler = true;\n }\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden\n cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor\n if (args) cmd.arguments(args);\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd.copyInheritedSettings(this);\n\n if (desc) return this;\n return cmd;\n }\n\n /**\n * Factory routine to create a new unattached command.\n *\n * See .command() for creating an attached subcommand, which uses this routine to\n * create the command. You can override createCommand to customise subcommands.\n *\n * @param {string} [name]\n * @return {Command} new command\n */\n\n createCommand(name) {\n return new Command(name);\n }\n\n /**\n * You can customise the help with a subclass of Help by overriding createHelp,\n * or by overriding Help properties using configureHelp().\n *\n * @return {Help}\n */\n\n createHelp() {\n return Object.assign(new Help(), this.configureHelp());\n }\n\n /**\n * You can customise the help by overriding Help properties using configureHelp(),\n * or with a subclass of Help by overriding createHelp().\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureHelp(configuration) {\n if (configuration === undefined) return this._helpConfiguration;\n\n this._helpConfiguration = configuration;\n return this;\n }\n\n /**\n * The default output goes to stdout and stderr. You can customise this for special\n * applications. You can also customise the display of errors by overriding outputError.\n *\n * The configuration properties are all functions:\n *\n * // change how output being written, defaults to stdout and stderr\n * writeOut(str)\n * writeErr(str)\n * // change how output being written for errors, defaults to writeErr\n * outputError(str, write) // used for displaying errors and not used for displaying help\n * // specify width for wrapping help\n * getOutHelpWidth()\n * getErrHelpWidth()\n * // color support, currently only used with Help\n * getOutHasColors()\n * getErrHasColors()\n * stripColor() // used to remove ANSI escape codes if output does not have colors\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureOutput(configuration) {\n if (configuration === undefined) return this._outputConfiguration;\n\n this._outputConfiguration = {\n ...this._outputConfiguration,\n ...configuration,\n };\n return this;\n }\n\n /**\n * Display the help or a custom message after an error occurs.\n *\n * @param {(boolean|string)} [displayHelp]\n * @return {Command} `this` command for chaining\n */\n showHelpAfterError(displayHelp = true) {\n if (typeof displayHelp !== 'string') displayHelp = !!displayHelp;\n this._showHelpAfterError = displayHelp;\n return this;\n }\n\n /**\n * Display suggestion of similar commands for unknown commands, or options for unknown options.\n *\n * @param {boolean} [displaySuggestion]\n * @return {Command} `this` command for chaining\n */\n showSuggestionAfterError(displaySuggestion = true) {\n this._showSuggestionAfterError = !!displaySuggestion;\n return this;\n }\n\n /**\n * Add a prepared subcommand.\n *\n * See .command() for creating an attached subcommand which inherits settings from its parent.\n *\n * @param {Command} cmd - new subcommand\n * @param {object} [opts] - configuration options\n * @return {Command} `this` command for chaining\n */\n\n addCommand(cmd, opts) {\n if (!cmd._name) {\n throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`);\n }\n\n opts = opts || {};\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation\n\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd._checkForBrokenPassThrough();\n\n return this;\n }\n\n /**\n * Factory routine to create a new unattached argument.\n *\n * See .argument() for creating an attached argument, which uses this routine to\n * create the argument. You can override createArgument to return a custom argument.\n *\n * @param {string} name\n * @param {string} [description]\n * @return {Argument} new argument\n */\n\n createArgument(name, description) {\n return new Argument(name, description);\n }\n\n /**\n * Define argument syntax for command.\n *\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @example\n * program.argument('<input-file>');\n * program.argument('[output-file]');\n *\n * @param {string} name\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom argument processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n argument(name, description, parseArg, defaultValue) {\n const argument = this.createArgument(name, description);\n if (typeof parseArg === 'function') {\n argument.default(defaultValue).argParser(parseArg);\n } else {\n argument.default(parseArg);\n }\n this.addArgument(argument);\n return this;\n }\n\n /**\n * Define argument syntax for command, adding multiple at once (without descriptions).\n *\n * See also .argument().\n *\n * @example\n * program.arguments('<cmd> [env]');\n *\n * @param {string} names\n * @return {Command} `this` command for chaining\n */\n\n arguments(names) {\n names\n .trim()\n .split(/ +/)\n .forEach((detail) => {\n this.argument(detail);\n });\n return this;\n }\n\n /**\n * Define argument syntax for command, adding a prepared argument.\n *\n * @param {Argument} argument\n * @return {Command} `this` command for chaining\n */\n addArgument(argument) {\n const previousArgument = this.registeredArguments.slice(-1)[0];\n if (previousArgument?.variadic) {\n throw new Error(\n `only the last argument can be variadic '${previousArgument.name()}'`,\n );\n }\n if (\n argument.required &&\n argument.defaultValue !== undefined &&\n argument.parseArg === undefined\n ) {\n throw new Error(\n `a default value for a required argument is never used: '${argument.name()}'`,\n );\n }\n this.registeredArguments.push(argument);\n return this;\n }\n\n /**\n * Customise or override default help command. By default a help command is automatically added if your command has subcommands.\n *\n * @example\n * program.helpCommand('help [cmd]');\n * program.helpCommand('help [cmd]', 'show help');\n * program.helpCommand(false); // suppress default help command\n * program.helpCommand(true); // add help command even if no subcommands\n *\n * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added\n * @param {string} [description] - custom description\n * @return {Command} `this` command for chaining\n */\n\n helpCommand(enableOrNameAndArgs, description) {\n if (typeof enableOrNameAndArgs === 'boolean') {\n this._addImplicitHelpCommand = enableOrNameAndArgs;\n if (enableOrNameAndArgs && this._defaultCommandGroup) {\n // make the command to store the group\n this._initCommandGroup(this._getHelpCommand());\n }\n return this;\n }\n\n const nameAndArgs = enableOrNameAndArgs ?? 'help [command]';\n const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);\n const helpDescription = description ?? 'display help for command';\n\n const helpCommand = this.createCommand(helpName);\n helpCommand.helpOption(false);\n if (helpArgs) helpCommand.arguments(helpArgs);\n if (helpDescription) helpCommand.description(helpDescription);\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n // init group unless lazy create\n if (enableOrNameAndArgs || description) this._initCommandGroup(helpCommand);\n\n return this;\n }\n\n /**\n * Add prepared custom help command.\n *\n * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()`\n * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only\n * @return {Command} `this` command for chaining\n */\n addHelpCommand(helpCommand, deprecatedDescription) {\n // If not passed an object, call through to helpCommand for backwards compatibility,\n // as addHelpCommand was originally used like helpCommand is now.\n if (typeof helpCommand !== 'object') {\n this.helpCommand(helpCommand, deprecatedDescription);\n return this;\n }\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n this._initCommandGroup(helpCommand);\n return this;\n }\n\n /**\n * Lazy create help command.\n *\n * @return {(Command|null)}\n * @package\n */\n _getHelpCommand() {\n const hasImplicitHelpCommand =\n this._addImplicitHelpCommand ??\n (this.commands.length &&\n !this._actionHandler &&\n !this._findCommand('help'));\n\n if (hasImplicitHelpCommand) {\n if (this._helpCommand === undefined) {\n this.helpCommand(undefined, undefined); // use default name and description\n }\n return this._helpCommand;\n }\n return null;\n }\n\n /**\n * Add hook for life cycle event.\n *\n * @param {string} event\n * @param {Function} listener\n * @return {Command} `this` command for chaining\n */\n\n hook(event, listener) {\n const allowedValues = ['preSubcommand', 'preAction', 'postAction'];\n if (!allowedValues.includes(event)) {\n throw new Error(`Unexpected value for event passed to hook : '${event}'.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n if (this._lifeCycleHooks[event]) {\n this._lifeCycleHooks[event].push(listener);\n } else {\n this._lifeCycleHooks[event] = [listener];\n }\n return this;\n }\n\n /**\n * Register callback to use as replacement for calling process.exit.\n *\n * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing\n * @return {Command} `this` command for chaining\n */\n\n exitOverride(fn) {\n if (fn) {\n this._exitCallback = fn;\n } else {\n this._exitCallback = (err) => {\n if (err.code !== 'commander.executeSubCommandAsync') {\n throw err;\n } else {\n // Async callback from spawn events, not useful to throw.\n }\n };\n }\n return this;\n }\n\n /**\n * Call process.exit, and _exitCallback if defined.\n *\n * @param {number} exitCode exit code for using with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n * @return never\n * @private\n */\n\n _exit(exitCode, code, message) {\n if (this._exitCallback) {\n this._exitCallback(new CommanderError(exitCode, code, message));\n // Expecting this line is not reached.\n }\n process.exit(exitCode);\n }\n\n /**\n * Register callback `fn` for the command.\n *\n * @example\n * program\n * .command('serve')\n * .description('start service')\n * .action(function() {\n * // do work here\n * });\n *\n * @param {Function} fn\n * @return {Command} `this` command for chaining\n */\n\n action(fn) {\n const listener = (args) => {\n // The .action callback takes an extra parameter which is the command or options.\n const expectedArgsCount = this.registeredArguments.length;\n const actionArgs = args.slice(0, expectedArgsCount);\n if (this._storeOptionsAsProperties) {\n actionArgs[expectedArgsCount] = this; // backwards compatible \"options\"\n } else {\n actionArgs[expectedArgsCount] = this.opts();\n }\n actionArgs.push(this);\n\n return fn.apply(this, actionArgs);\n };\n this._actionHandler = listener;\n return this;\n }\n\n /**\n * Factory routine to create a new unattached option.\n *\n * See .option() for creating an attached option, which uses this routine to\n * create the option. You can override createOption to return a custom option.\n *\n * @param {string} flags\n * @param {string} [description]\n * @return {Option} new option\n */\n\n createOption(flags, description) {\n return new Option(flags, description);\n }\n\n /**\n * Wrap parseArgs to catch 'commander.invalidArgument'.\n *\n * @param {(Option | Argument)} target\n * @param {string} value\n * @param {*} previous\n * @param {string} invalidArgumentMessage\n * @private\n */\n\n _callParseArg(target, value, previous, invalidArgumentMessage) {\n try {\n return target.parseArg(value, previous);\n } catch (err) {\n if (err.code === 'commander.invalidArgument') {\n const message = `${invalidArgumentMessage} ${err.message}`;\n this.error(message, { exitCode: err.exitCode, code: err.code });\n }\n throw err;\n }\n }\n\n /**\n * Check for option flag conflicts.\n * Register option if no conflicts found, or throw on conflict.\n *\n * @param {Option} option\n * @private\n */\n\n _registerOption(option) {\n const matchingOption =\n (option.short && this._findOption(option.short)) ||\n (option.long && this._findOption(option.long));\n if (matchingOption) {\n const matchingFlag =\n option.long && this._findOption(option.long)\n ? option.long\n : option.short;\n throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'\n- already used by option '${matchingOption.flags}'`);\n }\n\n this._initOptionGroup(option);\n this.options.push(option);\n }\n\n /**\n * Check for command name and alias conflicts with existing commands.\n * Register command if no conflicts found, or throw on conflict.\n *\n * @param {Command} command\n * @private\n */\n\n _registerCommand(command) {\n const knownBy = (cmd) => {\n return [cmd.name()].concat(cmd.aliases());\n };\n\n const alreadyUsed = knownBy(command).find((name) =>\n this._findCommand(name),\n );\n if (alreadyUsed) {\n const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|');\n const newCmd = knownBy(command).join('|');\n throw new Error(\n `cannot add command '${newCmd}' as already have command '${existingCmd}'`,\n );\n }\n\n this._initCommandGroup(command);\n this.commands.push(command);\n }\n\n /**\n * Add an option.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addOption(option) {\n this._registerOption(option);\n\n const oname = option.name();\n const name = option.attributeName();\n\n // store default value\n if (option.negate) {\n // --no-foo is special and defaults foo to true, unless a --foo option is already defined\n const positiveLongFlag = option.long.replace(/^--no-/, '--');\n if (!this._findOption(positiveLongFlag)) {\n this.setOptionValueWithSource(\n name,\n option.defaultValue === undefined ? true : option.defaultValue,\n 'default',\n );\n }\n } else if (option.defaultValue !== undefined) {\n this.setOptionValueWithSource(name, option.defaultValue, 'default');\n }\n\n // handler for cli and env supplied values\n const handleOptionValue = (val, invalidValueMessage, valueSource) => {\n // val is null for optional option used without an optional-argument.\n // val is undefined for boolean and negated option.\n if (val == null && option.presetArg !== undefined) {\n val = option.presetArg;\n }\n\n // custom processing\n const oldValue = this.getOptionValue(name);\n if (val !== null && option.parseArg) {\n val = this._callParseArg(option, val, oldValue, invalidValueMessage);\n } else if (val !== null && option.variadic) {\n val = option._collectValue(val, oldValue);\n }\n\n // Fill-in appropriate missing values. Long winded but easy to follow.\n if (val == null) {\n if (option.negate) {\n val = false;\n } else if (option.isBoolean() || option.optional) {\n val = true;\n } else {\n val = ''; // not normal, parseArg might have failed or be a mock function for testing\n }\n }\n this.setOptionValueWithSource(name, val, valueSource);\n };\n\n this.on('option:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'cli');\n });\n\n if (option.envVar) {\n this.on('optionEnv:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'env');\n });\n }\n\n return this;\n }\n\n /**\n * Internal implementation shared by .option() and .requiredOption()\n *\n * @return {Command} `this` command for chaining\n * @private\n */\n _optionEx(config, flags, description, fn, defaultValue) {\n if (typeof flags === 'object' && flags instanceof Option) {\n throw new Error(\n 'To add an Option object use addOption() instead of option() or requiredOption()',\n );\n }\n const option = this.createOption(flags, description);\n option.makeOptionMandatory(!!config.mandatory);\n if (typeof fn === 'function') {\n option.default(defaultValue).argParser(fn);\n } else if (fn instanceof RegExp) {\n // deprecated\n const regex = fn;\n fn = (val, def) => {\n const m = regex.exec(val);\n return m ? m[0] : def;\n };\n option.default(defaultValue).argParser(fn);\n } else {\n option.default(fn);\n }\n\n return this.addOption(option);\n }\n\n /**\n * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. A required\n * option-argument is indicated by `<>` and an optional option-argument by `[]`.\n *\n * See the README for more details, and see also addOption() and requiredOption().\n *\n * @example\n * program\n * .option('-p, --pepper', 'add pepper')\n * .option('--pt, --pizza-type <TYPE>', 'type of pizza') // required option-argument\n * .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default\n * .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n option(flags, description, parseArg, defaultValue) {\n return this._optionEx({}, flags, description, parseArg, defaultValue);\n }\n\n /**\n * Add a required option which must have a value after parsing. This usually means\n * the option must be specified on the command line. (Otherwise the same as .option().)\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n requiredOption(flags, description, parseArg, defaultValue) {\n return this._optionEx(\n { mandatory: true },\n flags,\n description,\n parseArg,\n defaultValue,\n );\n }\n\n /**\n * Alter parsing of short flags with optional values.\n *\n * @example\n * // for `.option('-f,--flag [value]'):\n * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour\n * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`\n *\n * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.\n * @return {Command} `this` command for chaining\n */\n combineFlagAndOptionalValue(combine = true) {\n this._combineFlagAndOptionalValue = !!combine;\n return this;\n }\n\n /**\n * Allow unknown options on the command line.\n *\n * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options.\n * @return {Command} `this` command for chaining\n */\n allowUnknownOption(allowUnknown = true) {\n this._allowUnknownOption = !!allowUnknown;\n return this;\n }\n\n /**\n * Allow excess command-arguments on the command line. Pass false to make excess arguments an error.\n *\n * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments.\n * @return {Command} `this` command for chaining\n */\n allowExcessArguments(allowExcess = true) {\n this._allowExcessArguments = !!allowExcess;\n return this;\n }\n\n /**\n * Enable positional options. Positional means global options are specified before subcommands which lets\n * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.\n * The default behaviour is non-positional and global options may appear anywhere on the command line.\n *\n * @param {boolean} [positional]\n * @return {Command} `this` command for chaining\n */\n enablePositionalOptions(positional = true) {\n this._enablePositionalOptions = !!positional;\n return this;\n }\n\n /**\n * Pass through options that come after command-arguments rather than treat them as command-options,\n * so actual command-options come before command-arguments. Turning this on for a subcommand requires\n * positional options to have been enabled on the program (parent commands).\n * The default behaviour is non-positional and options may appear before or after command-arguments.\n *\n * @param {boolean} [passThrough] for unknown options.\n * @return {Command} `this` command for chaining\n */\n passThroughOptions(passThrough = true) {\n this._passThroughOptions = !!passThrough;\n this._checkForBrokenPassThrough();\n return this;\n }\n\n /**\n * @private\n */\n\n _checkForBrokenPassThrough() {\n if (\n this.parent &&\n this._passThroughOptions &&\n !this.parent._enablePositionalOptions\n ) {\n throw new Error(\n `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`,\n );\n }\n }\n\n /**\n * Whether to store option values as properties on command object,\n * or store separately (specify false). In both cases the option values can be accessed using .opts().\n *\n * @param {boolean} [storeAsProperties=true]\n * @return {Command} `this` command for chaining\n */\n\n storeOptionsAsProperties(storeAsProperties = true) {\n if (this.options.length) {\n throw new Error('call .storeOptionsAsProperties() before adding options');\n }\n if (Object.keys(this._optionValues).length) {\n throw new Error(\n 'call .storeOptionsAsProperties() before setting option values',\n );\n }\n this._storeOptionsAsProperties = !!storeAsProperties;\n return this;\n }\n\n /**\n * Retrieve option value.\n *\n * @param {string} key\n * @return {object} value\n */\n\n getOptionValue(key) {\n if (this._storeOptionsAsProperties) {\n return this[key];\n }\n return this._optionValues[key];\n }\n\n /**\n * Store option value.\n *\n * @param {string} key\n * @param {object} value\n * @return {Command} `this` command for chaining\n */\n\n setOptionValue(key, value) {\n return this.setOptionValueWithSource(key, value, undefined);\n }\n\n /**\n * Store option value and where the value came from.\n *\n * @param {string} key\n * @param {object} value\n * @param {string} source - expected values are default/config/env/cli/implied\n * @return {Command} `this` command for chaining\n */\n\n setOptionValueWithSource(key, value, source) {\n if (this._storeOptionsAsProperties) {\n this[key] = value;\n } else {\n this._optionValues[key] = value;\n }\n this._optionValueSources[key] = source;\n return this;\n }\n\n /**\n * Get source of option value.\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSource(key) {\n return this._optionValueSources[key];\n }\n\n /**\n * Get source of option value. See also .optsWithGlobals().\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSourceWithGlobals(key) {\n // global overwrites local, like optsWithGlobals\n let source;\n this._getCommandAndAncestors().forEach((cmd) => {\n if (cmd.getOptionValueSource(key) !== undefined) {\n source = cmd.getOptionValueSource(key);\n }\n });\n return source;\n }\n\n /**\n * Get user arguments from implied or explicit arguments.\n * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches.\n *\n * @private\n */\n\n _prepareUserArgs(argv, parseOptions) {\n if (argv !== undefined && !Array.isArray(argv)) {\n throw new Error('first parameter to parse must be array or undefined');\n }\n parseOptions = parseOptions || {};\n\n // auto-detect argument conventions if nothing supplied\n if (argv === undefined && parseOptions.from === undefined) {\n if (process.versions?.electron) {\n parseOptions.from = 'electron';\n }\n // check node specific options for scenarios where user CLI args follow executable without scriptname\n const execArgv = process.execArgv ?? [];\n if (\n execArgv.includes('-e') ||\n execArgv.includes('--eval') ||\n execArgv.includes('-p') ||\n execArgv.includes('--print')\n ) {\n parseOptions.from = 'eval'; // internal usage, not documented\n }\n }\n\n // default to using process.argv\n if (argv === undefined) {\n argv = process.argv;\n }\n this.rawArgs = argv.slice();\n\n // extract the user args and scriptPath\n let userArgs;\n switch (parseOptions.from) {\n case undefined:\n case 'node':\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n break;\n case 'electron':\n // @ts-ignore: because defaultApp is an unknown property\n if (process.defaultApp) {\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n } else {\n userArgs = argv.slice(1);\n }\n break;\n case 'user':\n userArgs = argv.slice(0);\n break;\n case 'eval':\n userArgs = argv.slice(1);\n break;\n default:\n throw new Error(\n `unexpected parse option { from: '${parseOptions.from}' }`,\n );\n }\n\n // Find default name for program from arguments.\n if (!this._name && this._scriptPath)\n this.nameFromFilename(this._scriptPath);\n this._name = this._name || 'program';\n\n return userArgs;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Use parseAsync instead of parse if any of your action handlers are async.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * program.parse(); // parse process.argv and auto-detect electron and special node flags\n * program.parse(process.argv); // assume argv[0] is app and argv[1] is script\n * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv] - optional, defaults to process.argv\n * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron\n * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'\n * @return {Command} `this` command for chaining\n */\n\n parse(argv, parseOptions) {\n this._prepareForParse();\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n this._parseCommand([], userArgs);\n\n return this;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags\n * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script\n * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv]\n * @param {object} [parseOptions]\n * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'\n * @return {Promise}\n */\n\n async parseAsync(argv, parseOptions) {\n this._prepareForParse();\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n await this._parseCommand([], userArgs);\n\n return this;\n }\n\n _prepareForParse() {\n if (this._savedState === null) {\n this.saveStateBeforeParse();\n } else {\n this.restoreStateBeforeParse();\n }\n }\n\n /**\n * Called the first time parse is called to save state and allow a restore before subsequent calls to parse.\n * Not usually called directly, but available for subclasses to save their custom state.\n *\n * This is called in a lazy way. Only commands used in parsing chain will have state saved.\n */\n saveStateBeforeParse() {\n this._savedState = {\n // name is stable if supplied by author, but may be unspecified for root command and deduced during parsing\n _name: this._name,\n // option values before parse have default values (including false for negated options)\n // shallow clones\n _optionValues: { ...this._optionValues },\n _optionValueSources: { ...this._optionValueSources },\n };\n }\n\n /**\n * Restore state before parse for calls after the first.\n * Not usually called directly, but available for subclasses to save their custom state.\n *\n * This is called in a lazy way. Only commands used in parsing chain will have state restored.\n */\n restoreStateBeforeParse() {\n if (this._storeOptionsAsProperties)\n throw new Error(`Can not call parse again when storeOptionsAsProperties is true.\n- either make a new Command for each call to parse, or stop storing options as properties`);\n\n // clear state from _prepareUserArgs\n this._name = this._savedState._name;\n this._scriptPath = null;\n this.rawArgs = [];\n // clear state from setOptionValueWithSource\n this._optionValues = { ...this._savedState._optionValues };\n this._optionValueSources = { ...this._savedState._optionValueSources };\n // clear state from _parseCommand\n this.args = [];\n // clear state from _processArguments\n this.processedArgs = [];\n }\n\n /**\n * Throw if expected executable is missing. Add lots of help for author.\n *\n * @param {string} executableFile\n * @param {string} executableDir\n * @param {string} subcommandName\n */\n _checkForMissingExecutable(executableFile, executableDir, subcommandName) {\n if (fs.existsSync(executableFile)) return;\n\n const executableDirMessage = executableDir\n ? `searched for local subcommand relative to directory '${executableDir}'`\n : 'no directory for search for local subcommand, use .executableDir() to supply a custom directory';\n const executableMissing = `'${executableFile}' does not exist\n - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${executableDirMessage}`;\n throw new Error(executableMissing);\n }\n\n /**\n * Execute a sub-command executable.\n *\n * @private\n */\n\n _executeSubCommand(subcommand, args) {\n args = args.slice();\n let launchWithNode = false; // Use node for source targets so do not need to get permissions correct, and on Windows.\n const sourceExt = ['.js', '.ts', '.tsx', '.mjs', '.cjs'];\n\n function findFile(baseDir, baseName) {\n // Look for specified file\n const localBin = path.resolve(baseDir, baseName);\n if (fs.existsSync(localBin)) return localBin;\n\n // Stop looking if candidate already has an expected extension.\n if (sourceExt.includes(path.extname(baseName))) return undefined;\n\n // Try all the extensions.\n const foundExt = sourceExt.find((ext) =>\n fs.existsSync(`${localBin}${ext}`),\n );\n if (foundExt) return `${localBin}${foundExt}`;\n\n return undefined;\n }\n\n // Not checking for help first. Unlikely to have mandatory and executable, and can't robustly test for help flags in external command.\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // executableFile and executableDir might be full path, or just a name\n let executableFile =\n subcommand._executableFile || `${this._name}-${subcommand._name}`;\n let executableDir = this._executableDir || '';\n if (this._scriptPath) {\n let resolvedScriptPath; // resolve possible symlink for installed npm binary\n try {\n resolvedScriptPath = fs.realpathSync(this._scriptPath);\n } catch {\n resolvedScriptPath = this._scriptPath;\n }\n executableDir = path.resolve(\n path.dirname(resolvedScriptPath),\n executableDir,\n );\n }\n\n // Look for a local file in preference to a command in PATH.\n if (executableDir) {\n let localFile = findFile(executableDir, executableFile);\n\n // Legacy search using prefix of script name instead of command name\n if (!localFile && !subcommand._executableFile && this._scriptPath) {\n const legacyName = path.basename(\n this._scriptPath,\n path.extname(this._scriptPath),\n );\n if (legacyName !== this._name) {\n localFile = findFile(\n executableDir,\n `${legacyName}-${subcommand._name}`,\n );\n }\n }\n executableFile = localFile || executableFile;\n }\n\n launchWithNode = sourceExt.includes(path.extname(executableFile));\n\n let proc;\n if (process.platform !== 'win32') {\n if (launchWithNode) {\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n\n proc = childProcess.spawn(process.argv[0], args, { stdio: 'inherit' });\n } else {\n proc = childProcess.spawn(executableFile, args, { stdio: 'inherit' });\n }\n } else {\n this._checkForMissingExecutable(\n executableFile,\n executableDir,\n subcommand._name,\n );\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n proc = childProcess.spawn(process.execPath, args, { stdio: 'inherit' });\n }\n\n if (!proc.killed) {\n // testing mainly to avoid leak warnings during unit tests with mocked spawn\n const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];\n signals.forEach((signal) => {\n process.on(signal, () => {\n if (proc.killed === false && proc.exitCode === null) {\n // @ts-ignore because signals not typed to known strings\n proc.kill(signal);\n }\n });\n });\n }\n\n // By default terminate process when spawned process terminates.\n const exitCallback = this._exitCallback;\n proc.on('close', (code) => {\n code = code ?? 1; // code is null if spawned process terminated due to a signal\n if (!exitCallback) {\n process.exit(code);\n } else {\n exitCallback(\n new CommanderError(\n code,\n 'commander.executeSubCommandAsync',\n '(close)',\n ),\n );\n }\n });\n proc.on('error', (err) => {\n // @ts-ignore: because err.code is an unknown property\n if (err.code === 'ENOENT') {\n this._checkForMissingExecutable(\n executableFile,\n executableDir,\n subcommand._name,\n );\n // @ts-ignore: because err.code is an unknown property\n } else if (err.code === 'EACCES') {\n throw new Error(`'${executableFile}' not executable`);\n }\n if (!exitCallback) {\n process.exit(1);\n } else {\n const wrappedError = new CommanderError(\n 1,\n 'commander.executeSubCommandAsync',\n '(error)',\n );\n wrappedError.nestedError = err;\n exitCallback(wrappedError);\n }\n });\n\n // Store the reference to the child process\n this.runningCommand = proc;\n }\n\n /**\n * @private\n */\n\n _dispatchSubcommand(commandName, operands, unknown) {\n const subCommand = this._findCommand(commandName);\n if (!subCommand) this.help({ error: true });\n\n subCommand._prepareForParse();\n let promiseChain;\n promiseChain = this._chainOrCallSubCommandHook(\n promiseChain,\n subCommand,\n 'preSubcommand',\n );\n promiseChain = this._chainOrCall(promiseChain, () => {\n if (subCommand._executableHandler) {\n this._executeSubCommand(subCommand, operands.concat(unknown));\n } else {\n return subCommand._parseCommand(operands, unknown);\n }\n });\n return promiseChain;\n }\n\n /**\n * Invoke help directly if possible, or dispatch if necessary.\n * e.g. help foo\n *\n * @private\n */\n\n _dispatchHelpCommand(subcommandName) {\n if (!subcommandName) {\n this.help();\n }\n const subCommand = this._findCommand(subcommandName);\n if (subCommand && !subCommand._executableHandler) {\n subCommand.help();\n }\n\n // Fallback to parsing the help flag to invoke the help.\n return this._dispatchSubcommand(\n subcommandName,\n [],\n [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help'],\n );\n }\n\n /**\n * Check this.args against expected this.registeredArguments.\n *\n * @private\n */\n\n _checkNumberOfArguments() {\n // too few\n this.registeredArguments.forEach((arg, i) => {\n if (arg.required && this.args[i] == null) {\n this.missingArgument(arg.name());\n }\n });\n // too many\n if (\n this.registeredArguments.length > 0 &&\n this.registeredArguments[this.registeredArguments.length - 1].variadic\n ) {\n return;\n }\n if (this.args.length > this.registeredArguments.length) {\n this._excessArguments(this.args);\n }\n }\n\n /**\n * Process this.args using this.registeredArguments and save as this.processedArgs!\n *\n * @private\n */\n\n _processArguments() {\n const myParseArg = (argument, value, previous) => {\n // Extra processing for nice error message on parsing failure.\n let parsedValue = value;\n if (value !== null && argument.parseArg) {\n const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;\n parsedValue = this._callParseArg(\n argument,\n value,\n previous,\n invalidValueMessage,\n );\n }\n return parsedValue;\n };\n\n this._checkNumberOfArguments();\n\n const processedArgs = [];\n this.registeredArguments.forEach((declaredArg, index) => {\n let value = declaredArg.defaultValue;\n if (declaredArg.variadic) {\n // Collect together remaining arguments for passing together as an array.\n if (index < this.args.length) {\n value = this.args.slice(index);\n if (declaredArg.parseArg) {\n value = value.reduce((processed, v) => {\n return myParseArg(declaredArg, v, processed);\n }, declaredArg.defaultValue);\n }\n } else if (value === undefined) {\n value = [];\n }\n } else if (index < this.args.length) {\n value = this.args[index];\n if (declaredArg.parseArg) {\n value = myParseArg(declaredArg, value, declaredArg.defaultValue);\n }\n }\n processedArgs[index] = value;\n });\n this.processedArgs = processedArgs;\n }\n\n /**\n * Once we have a promise we chain, but call synchronously until then.\n *\n * @param {(Promise|undefined)} promise\n * @param {Function} fn\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCall(promise, fn) {\n // thenable\n if (promise?.then && typeof promise.then === 'function') {\n // already have a promise, chain callback\n return promise.then(() => fn());\n }\n // callback might return a promise\n return fn();\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallHooks(promise, event) {\n let result = promise;\n const hooks = [];\n this._getCommandAndAncestors()\n .reverse()\n .filter((cmd) => cmd._lifeCycleHooks[event] !== undefined)\n .forEach((hookedCommand) => {\n hookedCommand._lifeCycleHooks[event].forEach((callback) => {\n hooks.push({ hookedCommand, callback });\n });\n });\n if (event === 'postAction') {\n hooks.reverse();\n }\n\n hooks.forEach((hookDetail) => {\n result = this._chainOrCall(result, () => {\n return hookDetail.callback(hookDetail.hookedCommand, this);\n });\n });\n return result;\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {Command} subCommand\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallSubCommandHook(promise, subCommand, event) {\n let result = promise;\n if (this._lifeCycleHooks[event] !== undefined) {\n this._lifeCycleHooks[event].forEach((hook) => {\n result = this._chainOrCall(result, () => {\n return hook(this, subCommand);\n });\n });\n }\n return result;\n }\n\n /**\n * Process arguments in context of this command.\n * Returns action result, in case it is a promise.\n *\n * @private\n */\n\n _parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n this._parseOptionsEnv(); // after cli, so parseArg not called on both cli and env\n this._parseOptionsImplied();\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n }\n if (\n this._getHelpCommand() &&\n operands[0] === this._getHelpCommand().name()\n ) {\n return this._dispatchHelpCommand(operands[1]);\n }\n if (this._defaultCommandName) {\n this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command\n return this._dispatchSubcommand(\n this._defaultCommandName,\n operands,\n unknown,\n );\n }\n if (\n this.commands.length &&\n this.args.length === 0 &&\n !this._actionHandler &&\n !this._defaultCommandName\n ) {\n // probably missing subcommand and no handler, user needs help (and exit)\n this.help({ error: true });\n }\n\n this._outputHelpIfRequested(parsed.unknown);\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // We do not always call this check to avoid masking a \"better\" error, like unknown command.\n const checkForUnknownOptions = () => {\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n };\n\n const commandEvent = `command:${this.name()}`;\n if (this._actionHandler) {\n checkForUnknownOptions();\n this._processArguments();\n\n let promiseChain;\n promiseChain = this._chainOrCallHooks(promiseChain, 'preAction');\n promiseChain = this._chainOrCall(promiseChain, () =>\n this._actionHandler(this.processedArgs),\n );\n if (this.parent) {\n promiseChain = this._chainOrCall(promiseChain, () => {\n this.parent.emit(commandEvent, operands, unknown); // legacy\n });\n }\n promiseChain = this._chainOrCallHooks(promiseChain, 'postAction');\n return promiseChain;\n }\n if (this.parent?.listenerCount(commandEvent)) {\n checkForUnknownOptions();\n this._processArguments();\n this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (operands.length) {\n if (this._findCommand('*')) {\n // legacy default command\n return this._dispatchSubcommand('*', operands, unknown);\n }\n if (this.listenerCount('command:*')) {\n // skip option check, emit event for possible misspelling suggestion\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n } else {\n checkForUnknownOptions();\n this._processArguments();\n }\n } else if (this.commands.length) {\n checkForUnknownOptions();\n // This command has subcommands and nothing hooked up at this level, so display help (and exit).\n this.help({ error: true });\n } else {\n checkForUnknownOptions();\n this._processArguments();\n // fall through for caller to handle after calling .parse()\n }\n }\n\n /**\n * Find matching command.\n *\n * @private\n * @return {Command | undefined}\n */\n _findCommand(name) {\n if (!name) return undefined;\n return this.commands.find(\n (cmd) => cmd._name === name || cmd._aliases.includes(name),\n );\n }\n\n /**\n * Return an option matching `arg` if any.\n *\n * @param {string} arg\n * @return {Option}\n * @package\n */\n\n _findOption(arg) {\n return this.options.find((option) => option.is(arg));\n }\n\n /**\n * Display an error message if a mandatory option does not have a value.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n\n _checkForMissingMandatoryOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd.options.forEach((anOption) => {\n if (\n anOption.mandatory &&\n cmd.getOptionValue(anOption.attributeName()) === undefined\n ) {\n cmd.missingMandatoryOptionValue(anOption);\n }\n });\n });\n }\n\n /**\n * Display an error message if conflicting options are used together in this.\n *\n * @private\n */\n _checkForConflictingLocalOptions() {\n const definedNonDefaultOptions = this.options.filter((option) => {\n const optionKey = option.attributeName();\n if (this.getOptionValue(optionKey) === undefined) {\n return false;\n }\n return this.getOptionValueSource(optionKey) !== 'default';\n });\n\n const optionsWithConflicting = definedNonDefaultOptions.filter(\n (option) => option.conflictsWith.length > 0,\n );\n\n optionsWithConflicting.forEach((option) => {\n const conflictingAndDefined = definedNonDefaultOptions.find((defined) =>\n option.conflictsWith.includes(defined.attributeName()),\n );\n if (conflictingAndDefined) {\n this._conflictingOption(option, conflictingAndDefined);\n }\n });\n }\n\n /**\n * Display an error message if conflicting options are used together.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n _checkForConflictingOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd._checkForConflictingLocalOptions();\n });\n }\n\n /**\n * Parse options from `argv` removing known options,\n * and return argv split into operands and unknown arguments.\n *\n * Side effects: modifies command by storing options. Does not reset state if called again.\n *\n * Examples:\n *\n * argv => operands, unknown\n * --known kkk op => [op], []\n * op --known kkk => [op], []\n * sub --unknown uuu op => [sub], [--unknown uuu op]\n * sub -- --unknown uuu op => [sub --unknown uuu op], []\n *\n * @param {string[]} args\n * @return {{operands: string[], unknown: string[]}}\n */\n\n parseOptions(args) {\n const operands = []; // operands, not options or values\n const unknown = []; // first unknown option and remaining unknown args\n let dest = operands;\n\n function maybeOption(arg) {\n return arg.length > 1 && arg[0] === '-';\n }\n\n const negativeNumberArg = (arg) => {\n // return false if not a negative number\n if (!/^-(\\d+|\\d*\\.\\d+)(e[+-]?\\d+)?$/.test(arg)) return false;\n // negative number is ok unless digit used as an option in command hierarchy\n return !this._getCommandAndAncestors().some((cmd) =>\n cmd.options\n .map((opt) => opt.short)\n .some((short) => /^-\\d$/.test(short)),\n );\n };\n\n // parse options\n let activeVariadicOption = null;\n let activeGroup = null; // working through group of short options, like -abc\n let i = 0;\n while (i < args.length || activeGroup) {\n const arg = activeGroup ?? args[i++];\n activeGroup = null;\n\n // literal\n if (arg === '--') {\n if (dest === unknown) dest.push(arg);\n dest.push(...args.slice(i));\n break;\n }\n\n if (\n activeVariadicOption &&\n (!maybeOption(arg) || negativeNumberArg(arg))\n ) {\n this.emit(`option:${activeVariadicOption.name()}`, arg);\n continue;\n }\n activeVariadicOption = null;\n\n if (maybeOption(arg)) {\n const option = this._findOption(arg);\n // recognised option, call listener to assign value with possible custom processing\n if (option) {\n if (option.required) {\n const value = args[i++];\n if (value === undefined) this.optionMissingArgument(option);\n this.emit(`option:${option.name()}`, value);\n } else if (option.optional) {\n let value = null;\n // historical behaviour is optional value is following arg unless an option\n if (\n i < args.length &&\n (!maybeOption(args[i]) || negativeNumberArg(args[i]))\n ) {\n value = args[i++];\n }\n this.emit(`option:${option.name()}`, value);\n } else {\n // boolean flag\n this.emit(`option:${option.name()}`);\n }\n activeVariadicOption = option.variadic ? option : null;\n continue;\n }\n }\n\n // Look for combo options following single dash, eat first one if known.\n if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {\n const option = this._findOption(`-${arg[1]}`);\n if (option) {\n if (\n option.required ||\n (option.optional && this._combineFlagAndOptionalValue)\n ) {\n // option with value following in same argument\n this.emit(`option:${option.name()}`, arg.slice(2));\n } else {\n // boolean option\n this.emit(`option:${option.name()}`);\n // remove the processed option and keep processing group\n activeGroup = `-${arg.slice(2)}`;\n }\n continue;\n }\n }\n\n // Look for known long flag with value, like --foo=bar\n if (/^--[^=]+=/.test(arg)) {\n const index = arg.indexOf('=');\n const option = this._findOption(arg.slice(0, index));\n if (option && (option.required || option.optional)) {\n this.emit(`option:${option.name()}`, arg.slice(index + 1));\n continue;\n }\n }\n\n // Not a recognised option by this command.\n // Might be a command-argument, or subcommand option, or unknown option, or help command or option.\n\n // An unknown option means further arguments also classified as unknown so can be reprocessed by subcommands.\n // A negative number in a leaf command is not an unknown option.\n if (\n dest === operands &&\n maybeOption(arg) &&\n !(this.commands.length === 0 && negativeNumberArg(arg))\n ) {\n dest = unknown;\n }\n\n // If using positionalOptions, stop processing our options at subcommand.\n if (\n (this._enablePositionalOptions || this._passThroughOptions) &&\n operands.length === 0 &&\n unknown.length === 0\n ) {\n if (this._findCommand(arg)) {\n operands.push(arg);\n unknown.push(...args.slice(i));\n break;\n } else if (\n this._getHelpCommand() &&\n arg === this._getHelpCommand().name()\n ) {\n operands.push(arg, ...args.slice(i));\n break;\n } else if (this._defaultCommandName) {\n unknown.push(arg, ...args.slice(i));\n break;\n }\n }\n\n // If using passThroughOptions, stop processing options at first command-argument.\n if (this._passThroughOptions) {\n dest.push(arg, ...args.slice(i));\n break;\n }\n\n // add arg\n dest.push(arg);\n }\n\n return { operands, unknown };\n }\n\n /**\n * Return an object containing local option values as key-value pairs.\n *\n * @return {object}\n */\n opts() {\n if (this._storeOptionsAsProperties) {\n // Preserve original behaviour so backwards compatible when still using properties\n const result = {};\n const len = this.options.length;\n\n for (let i = 0; i < len; i++) {\n const key = this.options[i].attributeName();\n result[key] =\n key === this._versionOptionName ? this._version : this[key];\n }\n return result;\n }\n\n return this._optionValues;\n }\n\n /**\n * Return an object containing merged local and global option values as key-value pairs.\n *\n * @return {object}\n */\n optsWithGlobals() {\n // globals overwrite locals\n return this._getCommandAndAncestors().reduce(\n (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),\n {},\n );\n }\n\n /**\n * Display error message and exit (or call exitOverride).\n *\n * @param {string} message\n * @param {object} [errorOptions]\n * @param {string} [errorOptions.code] - an id string representing the error\n * @param {number} [errorOptions.exitCode] - used with process.exit\n */\n error(message, errorOptions) {\n // output handling\n this._outputConfiguration.outputError(\n `${message}\\n`,\n this._outputConfiguration.writeErr,\n );\n if (typeof this._showHelpAfterError === 'string') {\n this._outputConfiguration.writeErr(`${this._showHelpAfterError}\\n`);\n } else if (this._showHelpAfterError) {\n this._outputConfiguration.writeErr('\\n');\n this.outputHelp({ error: true });\n }\n\n // exit handling\n const config = errorOptions || {};\n const exitCode = config.exitCode || 1;\n const code = config.code || 'commander.error';\n this._exit(exitCode, code, message);\n }\n\n /**\n * Apply any option related environment variables, if option does\n * not have a value from cli or client code.\n *\n * @private\n */\n _parseOptionsEnv() {\n this.options.forEach((option) => {\n if (option.envVar && option.envVar in process.env) {\n const optionKey = option.attributeName();\n // Priority check. Do not overwrite cli or options from unknown source (client-code).\n if (\n this.getOptionValue(optionKey) === undefined ||\n ['default', 'config', 'env'].includes(\n this.getOptionValueSource(optionKey),\n )\n ) {\n if (option.required || option.optional) {\n // option can take a value\n // keep very simple, optional always takes value\n this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);\n } else {\n // boolean\n // keep very simple, only care that envVar defined and not the value\n this.emit(`optionEnv:${option.name()}`);\n }\n }\n }\n });\n }\n\n /**\n * Apply any implied option values, if option is undefined or default value.\n *\n * @private\n */\n _parseOptionsImplied() {\n const dualHelper = new DualOptions(this.options);\n const hasCustomOptionValue = (optionKey) => {\n return (\n this.getOptionValue(optionKey) !== undefined &&\n !['default', 'implied'].includes(this.getOptionValueSource(optionKey))\n );\n };\n this.options\n .filter(\n (option) =>\n option.implied !== undefined &&\n hasCustomOptionValue(option.attributeName()) &&\n dualHelper.valueFromOption(\n this.getOptionValue(option.attributeName()),\n option,\n ),\n )\n .forEach((option) => {\n Object.keys(option.implied)\n .filter((impliedKey) => !hasCustomOptionValue(impliedKey))\n .forEach((impliedKey) => {\n this.setOptionValueWithSource(\n impliedKey,\n option.implied[impliedKey],\n 'implied',\n );\n });\n });\n }\n\n /**\n * Argument `name` is missing.\n *\n * @param {string} name\n * @private\n */\n\n missingArgument(name) {\n const message = `error: missing required argument '${name}'`;\n this.error(message, { code: 'commander.missingArgument' });\n }\n\n /**\n * `Option` is missing an argument.\n *\n * @param {Option} option\n * @private\n */\n\n optionMissingArgument(option) {\n const message = `error: option '${option.flags}' argument missing`;\n this.error(message, { code: 'commander.optionMissingArgument' });\n }\n\n /**\n * `Option` does not have a value, and is a mandatory option.\n *\n * @param {Option} option\n * @private\n */\n\n missingMandatoryOptionValue(option) {\n const message = `error: required option '${option.flags}' not specified`;\n this.error(message, { code: 'commander.missingMandatoryOptionValue' });\n }\n\n /**\n * `Option` conflicts with another option.\n *\n * @param {Option} option\n * @param {Option} conflictingOption\n * @private\n */\n _conflictingOption(option, conflictingOption) {\n // The calling code does not know whether a negated option is the source of the\n // value, so do some work to take an educated guess.\n const findBestOptionFromValue = (option) => {\n const optionKey = option.attributeName();\n const optionValue = this.getOptionValue(optionKey);\n const negativeOption = this.options.find(\n (target) => target.negate && optionKey === target.attributeName(),\n );\n const positiveOption = this.options.find(\n (target) => !target.negate && optionKey === target.attributeName(),\n );\n if (\n negativeOption &&\n ((negativeOption.presetArg === undefined && optionValue === false) ||\n (negativeOption.presetArg !== undefined &&\n optionValue === negativeOption.presetArg))\n ) {\n return negativeOption;\n }\n return positiveOption || option;\n };\n\n const getErrorMessage = (option) => {\n const bestOption = findBestOptionFromValue(option);\n const optionKey = bestOption.attributeName();\n const source = this.getOptionValueSource(optionKey);\n if (source === 'env') {\n return `environment variable '${bestOption.envVar}'`;\n }\n return `option '${bestOption.flags}'`;\n };\n\n const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;\n this.error(message, { code: 'commander.conflictingOption' });\n }\n\n /**\n * Unknown option `flag`.\n *\n * @param {string} flag\n * @private\n */\n\n unknownOption(flag) {\n if (this._allowUnknownOption) return;\n let suggestion = '';\n\n if (flag.startsWith('--') && this._showSuggestionAfterError) {\n // Looping to pick up the global options too\n let candidateFlags = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n do {\n const moreFlags = command\n .createHelp()\n .visibleOptions(command)\n .filter((option) => option.long)\n .map((option) => option.long);\n candidateFlags = candidateFlags.concat(moreFlags);\n command = command.parent;\n } while (command && !command._enablePositionalOptions);\n suggestion = suggestSimilar(flag, candidateFlags);\n }\n\n const message = `error: unknown option '${flag}'${suggestion}`;\n this.error(message, { code: 'commander.unknownOption' });\n }\n\n /**\n * Excess arguments, more than expected.\n *\n * @param {string[]} receivedArgs\n * @private\n */\n\n _excessArguments(receivedArgs) {\n if (this._allowExcessArguments) return;\n\n const expected = this.registeredArguments.length;\n const s = expected === 1 ? '' : 's';\n const forSubcommand = this.parent ? ` for '${this.name()}'` : '';\n const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;\n this.error(message, { code: 'commander.excessArguments' });\n }\n\n /**\n * Unknown command.\n *\n * @private\n */\n\n unknownCommand() {\n const unknownName = this.args[0];\n let suggestion = '';\n\n if (this._showSuggestionAfterError) {\n const candidateNames = [];\n this.createHelp()\n .visibleCommands(this)\n .forEach((command) => {\n candidateNames.push(command.name());\n // just visible alias\n if (command.alias()) candidateNames.push(command.alias());\n });\n suggestion = suggestSimilar(unknownName, candidateNames);\n }\n\n const message = `error: unknown command '${unknownName}'${suggestion}`;\n this.error(message, { code: 'commander.unknownCommand' });\n }\n\n /**\n * Get or set the program version.\n *\n * This method auto-registers the \"-V, --version\" option which will print the version number.\n *\n * You can optionally supply the flags and description to override the defaults.\n *\n * @param {string} [str]\n * @param {string} [flags]\n * @param {string} [description]\n * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments\n */\n\n version(str, flags, description) {\n if (str === undefined) return this._version;\n this._version = str;\n flags = flags || '-V, --version';\n description = description || 'output the version number';\n const versionOption = this.createOption(flags, description);\n this._versionOptionName = versionOption.attributeName();\n this._registerOption(versionOption);\n\n this.on('option:' + versionOption.name(), () => {\n this._outputConfiguration.writeOut(`${str}\\n`);\n this._exit(0, 'commander.version', str);\n });\n return this;\n }\n\n /**\n * Set the description.\n *\n * @param {string} [str]\n * @param {object} [argsDescription]\n * @return {(string|Command)}\n */\n description(str, argsDescription) {\n if (str === undefined && argsDescription === undefined)\n return this._description;\n this._description = str;\n if (argsDescription) {\n this._argsDescription = argsDescription;\n }\n return this;\n }\n\n /**\n * Set the summary. Used when listed as subcommand of parent.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n summary(str) {\n if (str === undefined) return this._summary;\n this._summary = str;\n return this;\n }\n\n /**\n * Set an alias for the command.\n *\n * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.\n *\n * @param {string} [alias]\n * @return {(string|Command)}\n */\n\n alias(alias) {\n if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility\n\n /** @type {Command} */\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n if (\n this.commands.length !== 0 &&\n this.commands[this.commands.length - 1]._executableHandler\n ) {\n // assume adding alias for last added executable subcommand, rather than this\n command = this.commands[this.commands.length - 1];\n }\n\n if (alias === command._name)\n throw new Error(\"Command alias can't be the same as its name\");\n const matchingCommand = this.parent?._findCommand(alias);\n if (matchingCommand) {\n // c.f. _registerCommand\n const existingCmd = [matchingCommand.name()]\n .concat(matchingCommand.aliases())\n .join('|');\n throw new Error(\n `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`,\n );\n }\n\n command._aliases.push(alias);\n return this;\n }\n\n /**\n * Set aliases for the command.\n *\n * Only the first alias is shown in the auto-generated help.\n *\n * @param {string[]} [aliases]\n * @return {(string[]|Command)}\n */\n\n aliases(aliases) {\n // Getter for the array of aliases is the main reason for having aliases() in addition to alias().\n if (aliases === undefined) return this._aliases;\n\n aliases.forEach((alias) => this.alias(alias));\n return this;\n }\n\n /**\n * Set / get the command usage `str`.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n usage(str) {\n if (str === undefined) {\n if (this._usage) return this._usage;\n\n const args = this.registeredArguments.map((arg) => {\n return humanReadableArgName(arg);\n });\n return []\n .concat(\n this.options.length || this._helpOption !== null ? '[options]' : [],\n this.commands.length ? '[command]' : [],\n this.registeredArguments.length ? args : [],\n )\n .join(' ');\n }\n\n this._usage = str;\n return this;\n }\n\n /**\n * Get or set the name of the command.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n name(str) {\n if (str === undefined) return this._name;\n this._name = str;\n return this;\n }\n\n /**\n * Set/get the help group heading for this subcommand in parent command's help.\n *\n * @param {string} [heading]\n * @return {Command | string}\n */\n\n helpGroup(heading) {\n if (heading === undefined) return this._helpGroupHeading ?? '';\n this._helpGroupHeading = heading;\n return this;\n }\n\n /**\n * Set/get the default help group heading for subcommands added to this command.\n * (This does not override a group set directly on the subcommand using .helpGroup().)\n *\n * @example\n * program.commandsGroup('Development Commands:);\n * program.command('watch')...\n * program.command('lint')...\n * ...\n *\n * @param {string} [heading]\n * @returns {Command | string}\n */\n commandsGroup(heading) {\n if (heading === undefined) return this._defaultCommandGroup ?? '';\n this._defaultCommandGroup = heading;\n return this;\n }\n\n /**\n * Set/get the default help group heading for options added to this command.\n * (This does not override a group set directly on the option using .helpGroup().)\n *\n * @example\n * program\n * .optionsGroup('Development Options:')\n * .option('-d, --debug', 'output extra debugging')\n * .option('-p, --profile', 'output profiling information')\n *\n * @param {string} [heading]\n * @returns {Command | string}\n */\n optionsGroup(heading) {\n if (heading === undefined) return this._defaultOptionGroup ?? '';\n this._defaultOptionGroup = heading;\n return this;\n }\n\n /**\n * @param {Option} option\n * @private\n */\n _initOptionGroup(option) {\n if (this._defaultOptionGroup && !option.helpGroupHeading)\n option.helpGroup(this._defaultOptionGroup);\n }\n\n /**\n * @param {Command} cmd\n * @private\n */\n _initCommandGroup(cmd) {\n if (this._defaultCommandGroup && !cmd.helpGroup())\n cmd.helpGroup(this._defaultCommandGroup);\n }\n\n /**\n * Set the name of the command from script filename, such as process.argv[1],\n * or require.main.filename, or __filename.\n *\n * (Used internally and public although not documented in README.)\n *\n * @example\n * program.nameFromFilename(require.main.filename);\n *\n * @param {string} filename\n * @return {Command}\n */\n\n nameFromFilename(filename) {\n this._name = path.basename(filename, path.extname(filename));\n\n return this;\n }\n\n /**\n * Get or set the directory for searching for executable subcommands of this command.\n *\n * @example\n * program.executableDir(__dirname);\n * // or\n * program.executableDir('subcommands');\n *\n * @param {string} [path]\n * @return {(string|null|Command)}\n */\n\n executableDir(path) {\n if (path === undefined) return this._executableDir;\n this._executableDir = path;\n return this;\n }\n\n /**\n * Return program help documentation.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout\n * @return {string}\n */\n\n helpInformation(contextOptions) {\n const helper = this.createHelp();\n const context = this._getOutputContext(contextOptions);\n helper.prepareContext({\n error: context.error,\n helpWidth: context.helpWidth,\n outputHasColors: context.hasColors,\n });\n const text = helper.formatHelp(this, helper);\n if (context.hasColors) return text;\n return this._outputConfiguration.stripColor(text);\n }\n\n /**\n * @typedef HelpContext\n * @type {object}\n * @property {boolean} error\n * @property {number} helpWidth\n * @property {boolean} hasColors\n * @property {function} write - includes stripColor if needed\n *\n * @returns {HelpContext}\n * @private\n */\n\n _getOutputContext(contextOptions) {\n contextOptions = contextOptions || {};\n const error = !!contextOptions.error;\n let baseWrite;\n let hasColors;\n let helpWidth;\n if (error) {\n baseWrite = (str) => this._outputConfiguration.writeErr(str);\n hasColors = this._outputConfiguration.getErrHasColors();\n helpWidth = this._outputConfiguration.getErrHelpWidth();\n } else {\n baseWrite = (str) => this._outputConfiguration.writeOut(str);\n hasColors = this._outputConfiguration.getOutHasColors();\n helpWidth = this._outputConfiguration.getOutHelpWidth();\n }\n const write = (str) => {\n if (!hasColors) str = this._outputConfiguration.stripColor(str);\n return baseWrite(str);\n };\n return { error, write, hasColors, helpWidth };\n }\n\n /**\n * Output help information for this command.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n outputHelp(contextOptions) {\n let deprecatedCallback;\n if (typeof contextOptions === 'function') {\n deprecatedCallback = contextOptions;\n contextOptions = undefined;\n }\n\n const outputContext = this._getOutputContext(contextOptions);\n /** @type {HelpTextEventContext} */\n const eventContext = {\n error: outputContext.error,\n write: outputContext.write,\n command: this,\n };\n\n this._getCommandAndAncestors()\n .reverse()\n .forEach((command) => command.emit('beforeAllHelp', eventContext));\n this.emit('beforeHelp', eventContext);\n\n let helpInformation = this.helpInformation({ error: outputContext.error });\n if (deprecatedCallback) {\n helpInformation = deprecatedCallback(helpInformation);\n if (\n typeof helpInformation !== 'string' &&\n !Buffer.isBuffer(helpInformation)\n ) {\n throw new Error('outputHelp callback must return a string or a Buffer');\n }\n }\n outputContext.write(helpInformation);\n\n if (this._getHelpOption()?.long) {\n this.emit(this._getHelpOption().long); // deprecated\n }\n this.emit('afterHelp', eventContext);\n this._getCommandAndAncestors().forEach((command) =>\n command.emit('afterAllHelp', eventContext),\n );\n }\n\n /**\n * You can pass in flags and a description to customise the built-in help option.\n * Pass in false to disable the built-in help option.\n *\n * @example\n * program.helpOption('-?, --help' 'show help'); // customise\n * program.helpOption(false); // disable\n *\n * @param {(string | boolean)} flags\n * @param {string} [description]\n * @return {Command} `this` command for chaining\n */\n\n helpOption(flags, description) {\n // Support enabling/disabling built-in help option.\n if (typeof flags === 'boolean') {\n if (flags) {\n if (this._helpOption === null) this._helpOption = undefined; // reenable\n if (this._defaultOptionGroup) {\n // make the option to store the group\n this._initOptionGroup(this._getHelpOption());\n }\n } else {\n this._helpOption = null; // disable\n }\n return this;\n }\n\n // Customise flags and description.\n this._helpOption = this.createOption(\n flags ?? '-h, --help',\n description ?? 'display help for command',\n );\n // init group unless lazy create\n if (flags || description) this._initOptionGroup(this._helpOption);\n\n return this;\n }\n\n /**\n * Lazy create help option.\n * Returns null if has been disabled with .helpOption(false).\n *\n * @returns {(Option | null)} the help option\n * @package\n */\n _getHelpOption() {\n // Lazy create help option on demand.\n if (this._helpOption === undefined) {\n this.helpOption(undefined, undefined);\n }\n return this._helpOption;\n }\n\n /**\n * Supply your own option to use for the built-in help option.\n * This is an alternative to using helpOption() to customise the flags and description etc.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addHelpOption(option) {\n this._helpOption = option;\n this._initOptionGroup(option);\n return this;\n }\n\n /**\n * Output help information and exit.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n help(contextOptions) {\n this.outputHelp(contextOptions);\n let exitCode = Number(process.exitCode ?? 0); // process.exitCode does allow a string or an integer, but we prefer just a number\n if (\n exitCode === 0 &&\n contextOptions &&\n typeof contextOptions !== 'function' &&\n contextOptions.error\n ) {\n exitCode = 1;\n }\n // message: do not have all displayed text available so only passing placeholder.\n this._exit(exitCode, 'commander.help', '(outputHelp)');\n }\n\n /**\n * // Do a little typing to coordinate emit and listener for the help text events.\n * @typedef HelpTextEventContext\n * @type {object}\n * @property {boolean} error\n * @property {Command} command\n * @property {function} write\n */\n\n /**\n * Add additional text to be displayed with the built-in help.\n *\n * Position is 'before' or 'after' to affect just this command,\n * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.\n *\n * @param {string} position - before or after built-in help\n * @param {(string | Function)} text - string to add, or a function returning a string\n * @return {Command} `this` command for chaining\n */\n\n addHelpText(position, text) {\n const allowedValues = ['beforeAll', 'before', 'after', 'afterAll'];\n if (!allowedValues.includes(position)) {\n throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n\n const helpEvent = `${position}Help`;\n this.on(helpEvent, (/** @type {HelpTextEventContext} */ context) => {\n let helpStr;\n if (typeof text === 'function') {\n helpStr = text({ error: context.error, command: context.command });\n } else {\n helpStr = text;\n }\n // Ignore falsy value when nothing to output.\n if (helpStr) {\n context.write(`${helpStr}\\n`);\n }\n });\n return this;\n }\n\n /**\n * Output help information if help flags specified\n *\n * @param {Array} args - array of options to search for help flags\n * @private\n */\n\n _outputHelpIfRequested(args) {\n const helpOption = this._getHelpOption();\n const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));\n if (helpRequested) {\n this.outputHelp();\n // (Do not have all displayed text available so only passing placeholder.)\n this._exit(0, 'commander.helpDisplayed', '(outputHelp)');\n }\n }\n}\n\n/**\n * Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command).\n *\n * @param {string[]} args - array of arguments from node.execArgv\n * @returns {string[]}\n * @private\n */\n\nfunction incrementNodeInspectorPort(args) {\n // Testing for these options:\n // --inspect[=[host:]port]\n // --inspect-brk[=[host:]port]\n // --inspect-port=[host:]port\n return args.map((arg) => {\n if (!arg.startsWith('--inspect')) {\n return arg;\n }\n let debugOption;\n let debugHost = '127.0.0.1';\n let debugPort = '9229';\n let match;\n if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {\n // e.g. --inspect\n debugOption = match[1];\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null\n ) {\n debugOption = match[1];\n if (/^\\d+$/.test(match[3])) {\n // e.g. --inspect=1234\n debugPort = match[3];\n } else {\n // e.g. --inspect=localhost\n debugHost = match[3];\n }\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\\d+)$/)) !== null\n ) {\n // e.g. --inspect=localhost:1234\n debugOption = match[1];\n debugHost = match[3];\n debugPort = match[4];\n }\n\n if (debugOption && debugPort !== '0') {\n return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;\n }\n return arg;\n });\n}\n\n/**\n * @returns {boolean | undefined}\n * @package\n */\nfunction useColor() {\n // Test for common conventions.\n // NB: the observed behaviour is in combination with how author adds color! For example:\n // - we do not test NODE_DISABLE_COLORS, but util:styletext does\n // - we do test NO_COLOR, but Chalk does not\n //\n // References:\n // https://no-color.org\n // https://bixense.com/clicolors/\n // https://github.com/nodejs/node/blob/0a00217a5f67ef4a22384cfc80eb6dd9a917fdc1/lib/internal/tty.js#L109\n // https://github.com/chalk/supports-color/blob/c214314a14bcb174b12b3014b2b0a8de375029ae/index.js#L33\n // (https://force-color.org recent web page from 2023, does not match major javascript implementations)\n\n if (\n process.env.NO_COLOR ||\n process.env.FORCE_COLOR === '0' ||\n process.env.FORCE_COLOR === 'false'\n )\n return false;\n if (process.env.FORCE_COLOR || process.env.CLICOLOR_FORCE !== undefined)\n return true;\n return undefined;\n}\n\nexports.Command = Command;\nexports.useColor = useColor; // exporting for tests\n",
11
- "const { Argument } = require('./lib/argument.js');\nconst { Command } = require('./lib/command.js');\nconst { CommanderError, InvalidArgumentError } = require('./lib/error.js');\nconst { Help } = require('./lib/help.js');\nconst { Option } = require('./lib/option.js');\n\nexports.program = new Command();\n\nexports.createCommand = (name) => new Command(name);\nexports.createOption = (flags, description) => new Option(flags, description);\nexports.createArgument = (name, description) => new Argument(name, description);\n\n/**\n * Expose classes\n */\n\nexports.Command = Command;\nexports.Option = Option;\nexports.Argument = Argument;\nexports.Help = Help;\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\nexports.InvalidOptionArgumentError = InvalidArgumentError; // Deprecated\n",
12
- "export var util;\n(function (util) {\n util.assertEqual = (_) => { };\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nexport var objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nexport const ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n",
13
- "import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0];\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n",
14
- "import { ZodIssueCode } from \"../ZodError.js\";\nimport { util, ZodParsedType } from \"../helpers/util.js\";\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"bigint\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\nexport default errorMap;\n",
15
- "import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n",
16
- "import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n",
17
- "export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n",
18
- "import { ZodError, ZodIssueCode, } from \"./ZodError.js\";\nimport { defaultErrorMap, getErrorMap } from \"./errors.js\";\nimport { errorUtil } from \"./helpers/errorUtil.js\";\nimport { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from \"./helpers/parseUtil.js\";\nimport { util, ZodParsedType, getParsedType } from \"./helpers/util.js\";\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nexport class ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if (err?.message?.toLowerCase()?.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? \"+\" : \"?\"; // require seconds if precision is nonzero\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n if (!header)\n return false;\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (\"typ\" in decoded && decoded?.typ !== \"JWT\")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nexport class ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nexport class ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" || (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" || ch.kind === \"int\" || ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nexport class ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nexport class ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nexport class ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nexport class ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nexport class ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nexport class ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nexport class ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nexport class ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nexport class ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nexport class ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\n// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];\nexport class ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nexport class ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexport class ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nexport class ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nexport class ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexport class ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nexport class ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nexport class ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\nZodEnum.create = createZodEnum;\nexport class ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nexport class ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nexport class ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return INVALID;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result,\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nexport { ZodEffects as ZodTransformer };\nexport class ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nexport class ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nexport class ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\" ? params.default : () => params.default,\n ...processCreateParams(params),\n });\n};\nexport class ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nexport class ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexport const BRAND = Symbol(\"zod_brand\");\nexport class ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexport class ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexport class ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\" ? params(data) : typeof params === \"string\" ? { message: params } : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nexport function custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nexport { ZodType as Schema, ZodType as ZodSchema };\nexport const late = {\n object: ZodObject.lazycreate,\n};\nexport var ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\n// requires TS 4.4+\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nexport const coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexport { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };\nexport const NEVER = INVALID;\n",
19
- "export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n",
20
- "import * as z from \"./v3/external.js\";\nexport * from \"./v3/external.js\";\nexport { z };\nexport default z;\n",
21
- "/**\n * Normalize a registry URL by removing trailing slashes.\n * Ensures consistent URL comparison and prevents double-slash issues.\n */\nexport function normalizeRegistryUrl(url: string): string {\n\treturn url.trim().replace(/\\/+$/, \"\")\n}\n",
22
- "/**\n * OCX URL Constants\n *\n * Centralized URL definitions to avoid hardcoding throughout the codebase.\n */\n\nimport pkg from \"../package.json\" with { type: \"json\" }\n\n// Base domains\nexport const OCX_DOMAIN = \"ocx.kdco.dev\"\nexport const GITHUB_REPO = \"kdcokenny/ocx\"\n\n// OCX URLs\nexport const OCX_SCHEMA_URL = `https://${OCX_DOMAIN}/schemas/ocx.json`\nexport const REGISTRY_SCHEMA_UNVERSIONED_URL = `https://${OCX_DOMAIN}/schemas/registry.json`\nexport const REGISTRY_SCHEMA_LATEST_MAJOR = 2\n\nexport function getRegistrySchemaUrl(major: number): string {\n\treturn `https://${OCX_DOMAIN}/schemas/v${major}/registry.json`\n}\n\nexport const REGISTRY_SCHEMA_LATEST_URL = getRegistrySchemaUrl(REGISTRY_SCHEMA_LATEST_MAJOR)\n\n// CLI Version (single source of truth from package.json)\nexport const CLI_VERSION: string = pkg.version\n",
23
- "/**\n * Custom error classes with error codes\n * Following fail-fast philosophy - clear, actionable errors\n */\n\nexport type ErrorCode =\n\t| \"NOT_FOUND\"\n\t| \"NETWORK_ERROR\"\n\t| \"CONFIG_ERROR\"\n\t| \"VALIDATION_ERROR\"\n\t| \"VALIDATION_FAILED\"\n\t| \"CONFLICT\"\n\t| \"PERMISSION_ERROR\"\n\t| \"INTEGRITY_ERROR\"\n\t| \"UPDATE_ERROR\"\n\t| \"REGISTRY_COMPAT_ERROR\"\n\n/**\n * Exit codes for OCX CLI errors\n * @property {0} SUCCESS - Command completed successfully\n * @property {1} GENERAL - Unspecified error\n * @property {6} CONFLICT - Resource already exists\n * @property {65} INTEGRITY - Component hash mismatch (data format error)\n * @property {66} NOT_FOUND - Resource not found\n * @property {69} NETWORK - Network/connectivity error\n * @property {78} CONFIG - Configuration error\n */\nexport const EXIT_CODES = {\n\tSUCCESS: 0,\n\tGENERAL: 1,\n\tNOT_FOUND: 66,\n\tNETWORK: 69,\n\tCONFIG: 78,\n\tINTEGRITY: 65,\n\tCONFLICT: 6,\n} as const\n\nexport class OCXError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly code: ErrorCode,\n\t\tpublic readonly exitCode: number = EXIT_CODES.GENERAL,\n\t) {\n\t\tsuper(message)\n\t\tthis.name = \"OCXError\"\n\t}\n}\n\nexport class NotFoundError extends OCXError {\n\tconstructor(message: string) {\n\t\tsuper(message, \"NOT_FOUND\", EXIT_CODES.NOT_FOUND)\n\t\tthis.name = \"NotFoundError\"\n\t}\n}\n\nexport type RegistryNetworkContext = \"source\" | \"dependency\"\n\nexport interface NetworkErrorOptions {\n\turl?: string\n\tstatus?: number\n\tstatusText?: string\n\tphase?: string\n\tqualifiedName?: string\n\tregistryContext?: RegistryNetworkContext\n\tregistryName?: string\n}\n\nexport class NetworkError extends OCXError {\n\tpublic readonly url?: string\n\tpublic readonly status?: number\n\tpublic readonly statusText?: string\n\tpublic readonly phase?: string\n\tpublic readonly qualifiedName?: string\n\tpublic readonly registryContext?: RegistryNetworkContext\n\tpublic readonly registryName?: string\n\n\tconstructor(message: string, options?: NetworkErrorOptions) {\n\t\tsuper(message, \"NETWORK_ERROR\", EXIT_CODES.NETWORK)\n\t\tthis.name = \"NetworkError\"\n\t\tthis.url = options?.url\n\t\tthis.status = options?.status\n\t\tthis.statusText = options?.statusText\n\t\tthis.phase = options?.phase\n\t\tthis.qualifiedName = options?.qualifiedName\n\t\tthis.registryContext = options?.registryContext\n\t\tthis.registryName = options?.registryName\n\t}\n}\n\nexport class ConfigError extends OCXError {\n\tconstructor(message: string) {\n\t\tsuper(message, \"CONFIG_ERROR\", EXIT_CODES.CONFIG)\n\t\tthis.name = \"ConfigError\"\n\t}\n}\n\nexport class ValidationError extends OCXError {\n\tconstructor(message: string) {\n\t\tsuper(message, \"VALIDATION_ERROR\", EXIT_CODES.GENERAL)\n\t\tthis.name = \"ValidationError\"\n\t}\n}\n\nexport interface ValidationFailureDetails {\n\tvalid: false\n\terrors: string[]\n\tsummary: {\n\t\tvalid: false\n\t\ttotalErrors: number\n\t\tschemaErrors: number\n\t\tsourceFileErrors: number\n\t\tcircularDependencyErrors: number\n\t\tduplicateTargetErrors: number\n\t\totherErrors: number\n\t}\n}\n\nexport class ValidationFailedError extends OCXError {\n\tconstructor(public readonly details: ValidationFailureDetails) {\n\t\tsuper(\"Registry validation failed\", \"VALIDATION_FAILED\", EXIT_CODES.CONFIG)\n\t\tthis.name = \"ValidationFailedError\"\n\t}\n}\n\nexport class ConflictError extends OCXError {\n\tconstructor(message: string) {\n\t\tsuper(message, \"CONFLICT\", EXIT_CODES.CONFLICT)\n\t\tthis.name = \"ConflictError\"\n\t}\n}\n\nexport class IntegrityError extends OCXError {\n\tconstructor(\n\t\tpublic readonly component: string,\n\t\tpublic readonly expected: string,\n\t\tpublic readonly found: string,\n\t) {\n\t\tconst message =\n\t\t\t`Integrity verification failed for \"${component}\"\\n` +\n\t\t\t` Expected: ${expected}\\n` +\n\t\t\t` Found: ${found}\\n\\n` +\n\t\t\t`The registry content has changed since this component was locked.\\n` +\n\t\t\t`Use 'ocx update ${component}' to intentionally update this component.`\n\t\tsuper(message, \"INTEGRITY_ERROR\", EXIT_CODES.INTEGRITY)\n\t\tthis.name = \"IntegrityError\"\n\t}\n}\n\nexport class SelfUpdateError extends OCXError {\n\tconstructor(message: string) {\n\t\tsuper(message, \"UPDATE_ERROR\", EXIT_CODES.GENERAL)\n\t\tthis.name = \"SelfUpdateError\"\n\t}\n}\n\n// =============================================================================\n// REGISTRY COMPATIBILITY ERRORS\n// =============================================================================\n\n/**\n * Issue types for registry format incompatibility.\n * - `legacy-schema-v1`: missing/unversioned schema URL (legacy v1)\n * - `invalid-schema-url`: malformed/non-canonical schema URL\n * - `unsupported-schema-version`: versioned schema URL with unsupported major\n * - `invalid-format`: payload shape is invalid for supported schema\n */\nexport type RegistryCompatIssue =\n\t| \"legacy-schema-v1\"\n\t| \"invalid-schema-url\"\n\t| \"unsupported-schema-version\"\n\t| \"invalid-format\"\n\n/**\n * Error for registry format/compatibility issues.\n * Thrown when a registry index cannot be parsed because it uses\n * an incompatible or legacy format.\n *\n * Includes structured details for JSON output: url, issue, and remediation.\n */\nexport class RegistryCompatibilityError extends OCXError {\n\tpublic readonly url: string\n\tpublic readonly issue: RegistryCompatIssue\n\tpublic readonly remediation: string\n\tpublic readonly schemaUrl?: string\n\tpublic readonly supportedMajor?: number\n\tpublic readonly detectedMajor?: number\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\turl: string\n\t\t\tissue: RegistryCompatIssue\n\t\t\tremediation: string\n\t\t\tschemaUrl?: string\n\t\t\tsupportedMajor?: number\n\t\t\tdetectedMajor?: number\n\t\t},\n\t) {\n\t\tsuper(message, \"REGISTRY_COMPAT_ERROR\", EXIT_CODES.CONFIG)\n\t\tthis.name = \"RegistryCompatibilityError\"\n\t\tthis.url = options.url\n\t\tthis.issue = options.issue\n\t\tthis.remediation = options.remediation\n\t\tthis.schemaUrl = options.schemaUrl\n\t\tthis.supportedMajor = options.supportedMajor\n\t\tthis.detectedMajor = options.detectedMajor\n\t}\n}\n\n// =============================================================================\n// PROFILE ERRORS\n// =============================================================================\n\nexport class ProfileNotFoundError extends OCXError {\n\tconstructor(\n\t\tpublic readonly profile: string,\n\t\thint?: string,\n\t) {\n\t\tconst message = hint ?? `Profile \"${profile}\" not found`\n\t\tsuper(message, \"NOT_FOUND\", EXIT_CODES.NOT_FOUND)\n\t\tthis.name = \"ProfileNotFoundError\"\n\t}\n}\n\nexport class ProfileExistsError extends OCXError {\n\tconstructor(\n\t\tpublic readonly profile: string,\n\t\thint?: string,\n\t) {\n\t\tconst message = hint\n\t\t\t? `Profile \"${profile}\" already exists. ${hint}`\n\t\t\t: `Profile \"${profile}\" already exists.`\n\t\tsuper(message, \"CONFLICT\", EXIT_CODES.CONFLICT)\n\t\tthis.name = \"ProfileExistsError\"\n\t}\n}\n\nexport class RegistryExistsError extends OCXError {\n\tpublic readonly conflictType: \"name\" | \"url\"\n\n\tconstructor(\n\t\tpublic readonly registryName: string,\n\t\tpublic readonly existingUrl: string,\n\t\tpublic readonly newUrl: string,\n\t\tpublic readonly targetLabel?: string,\n\t\t/**\n\t\t * When conflictType is \"url\", this holds the existing registry name\n\t\t * that already maps to the conflicting URL.\n\t\t */\n\t\tpublic readonly existingName?: string,\n\t) {\n\t\tconst target = targetLabel ? ` in ${targetLabel}` : \"\"\n\t\tconst isUrlConflict = existingName !== undefined && existingName !== registryName\n\n\t\tconst message = isUrlConflict\n\t\t\t? `Registry URL already registered under name \"${existingName}\"${target}.\\n` +\n\t\t\t\t` URL: ${existingUrl}\\n` +\n\t\t\t\t` Existing name: ${existingName}\\n` +\n\t\t\t\t` Requested name: ${registryName}\\n\\n` +\n\t\t\t\t`Run 'ocx registry remove ${existingName}' first, then re-add with the new name.`\n\t\t\t: `Registry \"${registryName}\" already exists${target}.\\n` +\n\t\t\t\t` Current: ${existingUrl}\\n` +\n\t\t\t\t` New: ${newUrl}\\n\\n` +\n\t\t\t\t`Run 'ocx registry remove ${registryName}' first, then re-add with the new URL.`\n\n\t\tsuper(message, \"CONFLICT\", EXIT_CODES.CONFLICT)\n\t\tthis.name = \"RegistryExistsError\"\n\t\tthis.conflictType = isUrlConflict ? \"url\" : \"name\"\n\t}\n}\n\nexport class InvalidProfileNameError extends OCXError {\n\tconstructor(\n\t\tpublic readonly profile: string,\n\t\tpublic readonly reason: string,\n\t) {\n\t\tsuper(`Invalid profile name \"${profile}\": ${reason}`, \"VALIDATION_ERROR\", EXIT_CODES.GENERAL)\n\t\tthis.name = \"InvalidProfileNameError\"\n\t}\n}\n\nexport class ProfilesNotInitializedError extends OCXError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Profiles not initialized. Run 'ocx init --global' first.\",\n\t\t\t\"NOT_FOUND\",\n\t\t\tEXIT_CODES.NOT_FOUND,\n\t\t)\n\t\tthis.name = \"ProfilesNotInitializedError\"\n\t}\n}\n\nexport class LocalProfileUnsupportedError extends OCXError {\n\tconstructor(\n\t\tpublic readonly profile: string,\n\t\tpublic readonly localDir: string,\n\t) {\n\t\tsuper(\n\t\t\t`Local profile directory unsupported: \"${localDir}\"\\n\\n` +\n\t\t\t\t`Local profiles are not supported. Profiles must be global only.\\n` +\n\t\t\t\t`Remove the local profile directory and use global profiles instead:\\n` +\n\t\t\t\t` rm -rf \"${localDir}\"\\n` +\n\t\t\t\t` ocx profile show ${profile} --global`,\n\t\t\t\"CONFIG_ERROR\",\n\t\t\tEXIT_CODES.CONFIG,\n\t\t)\n\t\tthis.name = \"LocalProfileUnsupportedError\"\n\t}\n}\n",
24
- "import * as path from \"node:path\"\n\nexport class PathValidationError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly attemptedPath: string,\n\t\tpublic readonly reason: string,\n\t) {\n\t\tsuper(message)\n\t\tthis.name = \"PathValidationError\"\n\t}\n}\n\n// Windows reserved device names\nconst WINDOWS_RESERVED = new Set([\n\t\"CON\",\n\t\"PRN\",\n\t\"AUX\",\n\t\"NUL\",\n\t\"COM1\",\n\t\"COM2\",\n\t\"COM3\",\n\t\"COM4\",\n\t\"COM5\",\n\t\"COM6\",\n\t\"COM7\",\n\t\"COM8\",\n\t\"COM9\",\n\t\"LPT1\",\n\t\"LPT2\",\n\t\"LPT3\",\n\t\"LPT4\",\n\t\"LPT5\",\n\t\"LPT6\",\n\t\"LPT7\",\n\t\"LPT8\",\n\t\"LPT9\",\n])\n\n/**\n * Validates a path is safe to use within a base directory.\n * Adapted from Vercel Turborepo + pillarjs/resolve-path + Docker safepath.\n *\n * Security properties:\n * 1. No null bytes (prevents C-style string termination bypass)\n * 2. Must be relative (no absolute paths on any platform)\n * 3. No Windows drive letters or UNC paths\n * 4. No Windows reserved device names\n * 5. Unicode normalized (prevents combining character attacks)\n * 6. Backslash normalized (prevents mixed separator bypasses)\n * 7. Must stay within base directory after resolution\n *\n * @param basePath - The trusted base directory\n * @param userPath - The untrusted path to validate (should be relative)\n * @returns The safe, resolved absolute path\n * @throws {PathValidationError} If the path is unsafe\n */\nexport function validatePath(basePath: string, userPath: string): string {\n\t// 1. Null byte check (from pillarjs/resolve-path)\n\tif (userPath.includes(\"\\0\")) {\n\t\tthrow new PathValidationError(\"Path contains null bytes\", userPath, \"null_byte\")\n\t}\n\n\t// 2. Absolute path check - both POSIX and Windows (from resolve-path)\n\tif (path.isAbsolute(userPath) || path.win32.isAbsolute(userPath)) {\n\t\tthrow new PathValidationError(\"Path must be relative\", userPath, \"absolute_path\")\n\t}\n\n\t// 3. Windows drive letters and UNC paths\n\tif (/^[a-zA-Z]:/.test(userPath) || userPath.startsWith(\"\\\\\\\\\")) {\n\t\tthrow new PathValidationError(\"Path contains Windows absolute\", userPath, \"windows_absolute\")\n\t}\n\n\t// 4. Windows reserved names\n\tconst baseName = path.basename(userPath).toUpperCase().split(\".\")[0] ?? \"\"\n\tif (WINDOWS_RESERVED.has(baseName)) {\n\t\tthrow new PathValidationError(\"Path uses Windows reserved name\", userPath, \"windows_reserved\")\n\t}\n\n\t// 5. Unicode normalization (from Turborepo)\n\tconst normalized = userPath.normalize(\"NFC\")\n\n\t// 6. Separator normalization - backslash to forward slash\n\tconst unified = normalized.replace(/\\\\/g, \"/\")\n\n\t// 7. Resolve and check containment (from Turborepo + Docker)\n\tconst resolvedBase = path.resolve(basePath)\n\tconst resolvedCombined = path.resolve(resolvedBase, unified)\n\tconst relativePath = path.relative(resolvedBase, resolvedCombined)\n\n\t// 8. Escape detection\n\tif (\n\t\trelativePath.startsWith(\"../\") ||\n\t\trelativePath.startsWith(\"..\\\\\") ||\n\t\trelativePath === \"..\" ||\n\t\tpath.isAbsolute(relativePath)\n\t) {\n\t\tthrow new PathValidationError(\"Path escapes base directory\", userPath, \"path_traversal\")\n\t}\n\n\treturn resolvedCombined\n}\n\n/**\n * Boolean check for path safety.\n *\n * @param basePath - The trusted base directory\n * @param userPath - The untrusted path to validate\n * @returns true if the path is safe, false otherwise\n */\nexport function isPathSafe(basePath: string, userPath: string): boolean {\n\ttry {\n\t\tvalidatePath(basePath, userPath)\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n",
25
- "/**\n * Registry & Component Schemas\n *\n * Zod schemas with fail-fast validation following the 5 Laws of Elegant Defense.\n * Uses Cargo-style union types: string for simple defaults, object for full control.\n */\n\nimport { isAbsolute, normalize } from \"node:path\"\nimport { z } from \"zod\"\nimport {\n\tOCX_DOMAIN,\n\tREGISTRY_SCHEMA_LATEST_MAJOR,\n\tREGISTRY_SCHEMA_LATEST_URL,\n\tREGISTRY_SCHEMA_UNVERSIONED_URL,\n} from \"../constants\"\nimport type { RegistryCompatIssue } from \"../utils/errors\"\nimport { ValidationError } from \"../utils/errors\"\nimport { PathValidationError, validatePath } from \"../utils/path-security\"\n\n// =============================================================================\n// NPM SPECIFIER SCHEMA\n// =============================================================================\n\n/**\n * npm specifier schema for \"npm:package@version\" syntax.\n * Validates the format at boundary (Law 2: Parse Don't Validate).\n *\n * Valid formats:\n * - npm:lodash\n * - npm:lodash@4.0.0\n * - npm:@scope/pkg\n * - npm:@scope/pkg@1.0.0\n */\nexport const npmSpecifierSchema = z\n\t.string()\n\t.refine((val) => val.startsWith(\"npm:\"), {\n\t\tmessage: 'npm specifier must start with \"npm:\" prefix',\n\t})\n\t.refine(\n\t\t(val) => {\n\t\t\tconst remainder = val.slice(4)\n\t\t\t// Must have something after npm:\n\t\t\tif (!remainder) return false\n\t\t\t// Cannot contain path traversal\n\t\t\tif (remainder.includes(\"..\") || remainder.includes(\"/./\")) return false\n\t\t\treturn true\n\t\t},\n\t\t{\n\t\t\tmessage: \"Invalid npm specifier format\",\n\t\t},\n\t)\n\nexport type NpmSpecifier = z.infer<typeof npmSpecifierSchema>\n\n// =============================================================================\n// OPENCODE NAMING CONSTRAINTS (from OpenCode docs)\n// =============================================================================\n\n/**\n * OpenCode name schema following official constraints:\n * - 1-64 characters\n * - Lowercase alphanumeric with single hyphen separators\n * - Cannot start or end with hyphen\n * - Cannot contain consecutive hyphens\n *\n * Regex: ^[a-z0-9]+(-[a-z0-9]+)*$\n */\nexport const openCodeNameSchema = z\n\t.string()\n\t.min(1, \"Name cannot be empty\")\n\t.max(64, \"Name cannot exceed 64 characters\")\n\t.regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, {\n\t\tmessage:\n\t\t\t\"Must be lowercase alphanumeric with single hyphen separators (e.g., 'my-component', 'my-plugin'). Cannot start/end with hyphen or have consecutive hyphens.\",\n\t})\n\n/**\n * Alias schema — validates a user-chosen registry alias token.\n * An alias is the left-hand side of an `alias/component` qualified reference\n * (e.g. \"kdco\" in \"kdco/researcher\"). Same naming rules as openCodeNameSchema.\n */\nexport const aliasSchema = openCodeNameSchema\n\n/** @deprecated Use `aliasSchema` instead. Kept for backward compatibility. */\nexport const namespaceSchema = aliasSchema\n\n/**\n * Qualified component reference: alias/component\n * Used in CLI commands and lockfile keys\n */\nexport const qualifiedComponentSchema = z\n\t.string()\n\t.regex(/^[a-z0-9]+(-[a-z0-9]+)*\\/[a-z0-9]+(-[a-z0-9]+)*$/, {\n\t\tmessage:\n\t\t\t'Must be in format \"alias/component\" (e.g., \"kdco/researcher\"). Both parts must be lowercase alphanumeric with hyphens.',\n\t})\n\n/**\n * Parse a qualified component reference into its alias and component tokens.\n *\n * The returned `namespace` field is the user-chosen registry **alias** token\n * from the `alias/component` syntax — it is NOT a registry index authority.\n * The alias is resolved to a concrete registry URL at install time via ocx.jsonc.\n *\n * @throws Error if format is invalid (Law 4: Fail Fast, Fail Loud).\n */\nexport function parseQualifiedComponent(ref: string): { namespace: string; component: string } {\n\tif (!ref.includes(\"/\")) {\n\t\tthrow new Error(`Invalid component reference: \"${ref}\". Use format: alias/component`)\n\t}\n\tconst parts = ref.split(\"/\")\n\tif (parts.length > 2) {\n\t\tthrow new Error(\n\t\t\t`Invalid component reference: \"${ref}\". Too many \"/\" separators. Use format: alias/component`,\n\t\t)\n\t}\n\tconst [namespace, component] = parts\n\tif (!namespace || !component) {\n\t\tthrow new Error(`Invalid component reference: \"${ref}\". Both alias and component are required.`)\n\t}\n\treturn { namespace, component }\n}\n\n/**\n * Create a qualified component reference from alias and component name.\n */\nexport function createQualifiedComponent(namespace: string, component: string): string {\n\treturn `${namespace}/${component}`\n}\n\n/**\n * Dependency reference schema (Cargo-style):\n * - Bare string: \"utils\" -> same registry alias (implicit)\n * - Qualified: \"acme/utils\" -> cross-registry (explicit)\n */\nexport const dependencyRefSchema = z.string().refine(\n\t(dep) => {\n\t\t// Either a bare component name or a qualified alias/component\n\t\tconst barePattern = /^[a-z0-9]+(-[a-z0-9]+)*$/\n\t\tconst qualifiedPattern = /^[a-z0-9]+(-[a-z0-9]+)*\\/[a-z0-9]+(-[a-z0-9]+)*$/\n\t\treturn barePattern.test(dep) || qualifiedPattern.test(dep)\n\t},\n\t{\n\t\tmessage:\n\t\t\t'Dependency must be either a bare name (e.g., \"utils\") or qualified (e.g., \"acme/utils\")',\n\t},\n)\n\n// =============================================================================\n// FILE TARGET SCHEMAS\n// =============================================================================\n\nexport const componentTypeSchema = z.enum([\n\t\"agent\",\n\t\"skill\",\n\t\"plugin\",\n\t\"command\",\n\t\"tool\",\n\t\"bundle\",\n\t\"profile\",\n])\n\nexport type ComponentType = z.infer<typeof componentTypeSchema>\n\n/** Reserved targets (installer-owned files) */\nconst RESERVED_TARGETS = new Set([\".ocx\", \"ocx.lock\"])\n\n/**\n * Paths that registry components cannot target.\n * These are either OCX-managed files or dangerous paths.\n */\nconst BLOCKED_PATHS = [\n\t// OCX-managed files\n\t\".ocx/\", // Receipt, state (covers receipt.jsonc)\n\t\"ocx.jsonc\", // OCX config\n\t\"package.json\", // We generate this in .opencode/\n\n\t// Dangerous paths\n\t\".git/\", // Git internals\n\t\".env\", // Secrets\n\t\"node_modules/\", // Dependencies\n] as const\n\n/**\n * V2: Target paths are root-relative (no .opencode/ prefix).\n * Blocks protected paths that could compromise security or OCX functionality.\n * Validates path safety using schema-level checks.\n */\nexport const targetPathSchema = z\n\t.string()\n\t.min(1, \"Target path cannot be empty\")\n\t.refine(\n\t\t(path) => {\n\t\t\t// No absolute paths\n\t\t\tif (path.startsWith(\"/\") || /^[a-zA-Z]:/.test(path)) return false\n\t\t\t// No null bytes\n\t\t\tif (path.includes(\"\\0\")) return false\n\t\t\treturn true\n\t\t},\n\t\t{\n\t\t\tmessage: \"Target path must be relative and safe (no absolute paths or null bytes)\",\n\t\t},\n\t)\n\t.refine(\n\t\t(path) => {\n\t\t\t// Check if path is blocked\n\t\t\treturn !BLOCKED_PATHS.some((blocked) => path === blocked || path.startsWith(blocked))\n\t\t},\n\t\t{\n\t\t\tmessage: \"Target path is protected and cannot be overwritten by registry components\",\n\t\t},\n\t)\n\n// =============================================================================\n// MCP SERVER SCHEMA (Cargo-style: string URL or full object)\n// =============================================================================\n\n/**\n * OAuth configuration for MCP servers.\n * Supports advanced OAuth flows with custom client configuration.\n */\nexport const oauthConfigSchema = z.object({\n\t/** OAuth client ID */\n\tclientId: z.string().optional(),\n\t/** OAuth scopes to request */\n\tscopes: z.array(z.string()).optional(),\n\t/** OAuth authorization URL */\n\tauthUrl: z.string().optional(),\n\t/** OAuth token URL */\n\ttokenUrl: z.string().optional(),\n})\n\nexport type OAuthConfig = z.infer<typeof oauthConfigSchema>\n\n/**\n * Full MCP server configuration object\n */\nexport const mcpServerObjectSchema = z\n\t.object({\n\t\ttype: z.enum([\"remote\", \"local\"]),\n\t\t/** Server URL (relaxed validation - allows non-URL strings) */\n\t\turl: z.string().optional(),\n\t\t/**\n\t\t * Command to run for local servers.\n\t\t * Can be a single string (e.g., \"npx foo\") or array (e.g., [\"npx\", \"foo\"])\n\t\t */\n\t\tcommand: z.union([z.string(), z.array(z.string())]).optional(),\n\t\tenvironment: z.record(z.string()).optional(),\n\t\theaders: z.record(z.string()).optional(),\n\t\t/**\n\t\t * OAuth configuration.\n\t\t * - true: Enable OAuth with defaults\n\t\t * - object: Enable OAuth with custom configuration\n\t\t */\n\t\toauth: z.union([z.boolean(), oauthConfigSchema]).optional(),\n\t\tenabled: z.boolean().default(true),\n\t})\n\t.refine(\n\t\t(data) => {\n\t\t\tif (data.type === \"remote\" && !data.url) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (data.type === \"local\" && !data.command) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\t{\n\t\t\tmessage: \"Remote MCP servers require 'url', local servers require 'command'\",\n\t\t},\n\t)\n\nexport type McpServer = z.infer<typeof mcpServerObjectSchema>\n\n/**\n * Cargo-style MCP server reference:\n * - String: URL shorthand for remote server (e.g., \"https://mcp.example.com\")\n * - Object: Full configuration\n */\nexport const mcpServerRefSchema = z.union([z.string(), mcpServerObjectSchema])\n\nexport type McpServerRef = z.infer<typeof mcpServerRefSchema>\n\n// =============================================================================\n// COMPONENT FILE SCHEMA (Cargo-style: string path or full object)\n// =============================================================================\n\n/**\n * Full file configuration object.\n * Target validation is deferred to normalizeFile() where component type is known.\n */\nexport const componentFileObjectSchema = z.object({\n\t/** Source path in registry */\n\tpath: z.string().min(1, \"File path cannot be empty\"),\n\t/** Target path - validation deferred to normalizeFile() for type-aware checking */\n\ttarget: z.string().min(1, \"Target path cannot be empty\"),\n})\n\nexport type ComponentFileObject = z.infer<typeof componentFileObjectSchema>\n\n/**\n * Cargo-style file schema:\n * - String: Path shorthand, target auto-inferred (e.g., \"plugins/foo.ts\" -> \"plugins/foo.ts\")\n * - Object: Full configuration with explicit target\n */\nexport const componentFileSchema = z.union([\n\tz.string().min(1, \"File path cannot be empty\"),\n\tcomponentFileObjectSchema,\n])\n\nexport type ComponentFile = z.infer<typeof componentFileSchema>\n\n// =============================================================================\n// OPENCODE CONFIG BLOCK SCHEMA\n// =============================================================================\n\n// -----------------------------------------------------------------------------\n// Provider Configuration\n// -----------------------------------------------------------------------------\n\n/**\n * Provider configuration for AI model providers.\n * Supports custom API endpoints, headers, and environment variables.\n */\nexport const providerConfigSchema = z\n\t.object({\n\t\t/** API base URL */\n\t\tapi: z.string().optional(),\n\t\t/** Custom headers */\n\t\theaders: z.record(z.string()).optional(),\n\t\t/** Environment variables for API keys */\n\t\tenv: z.record(z.string()).optional(),\n\t\t/** Whether provider is enabled */\n\t\tenabled: z.boolean().optional(),\n\t})\n\t.passthrough()\n\nexport type ProviderConfig = z.infer<typeof providerConfigSchema>\n\n// -----------------------------------------------------------------------------\n// LSP, Formatter, Command Configuration\n// -----------------------------------------------------------------------------\n\n/**\n * Language Server Protocol configuration.\n * Defines how to start and configure LSP servers.\n */\nexport const lspConfigSchema = z\n\t.object({\n\t\t/** Command to run (string or array of args) */\n\t\tcommand: z.union([z.string(), z.array(z.string())]).optional(),\n\t\t/** Whether LSP is enabled */\n\t\tenabled: z.boolean().optional(),\n\t})\n\t.passthrough()\n\nexport type LspConfig = z.infer<typeof lspConfigSchema>\n\n/**\n * Formatter configuration for code formatting.\n * Defines the command and file patterns to format.\n */\nexport const formatterConfigSchema = z\n\t.object({\n\t\t/** Command to run (string or array of args) */\n\t\tcommand: z.union([z.string(), z.array(z.string())]).optional(),\n\t\t/** Glob pattern for files to format */\n\t\tglob: z.string().optional(),\n\t})\n\t.passthrough()\n\nexport type FormatterConfig = z.infer<typeof formatterConfigSchema>\n\n/**\n * Custom command configuration.\n * Defines executable commands with descriptions.\n */\nexport const commandConfigSchema = z\n\t.object({\n\t\t/** Command description */\n\t\tdescription: z.string().optional(),\n\t\t/** The command to run */\n\t\trun: z.string().optional(),\n\t})\n\t.passthrough()\n\nexport type CommandConfig = z.infer<typeof commandConfigSchema>\n\n// -----------------------------------------------------------------------------\n// TUI, Server, Keybind, Watcher Configuration\n// -----------------------------------------------------------------------------\n\n/**\n * TUI (Terminal User Interface) configuration.\n */\nexport const tuiConfigSchema = z\n\t.object({\n\t\t/** Disable TUI features */\n\t\tdisabled: z.boolean().optional(),\n\t})\n\t.passthrough()\n\nexport type TuiConfig = z.infer<typeof tuiConfigSchema>\n\n/**\n * Server configuration for OpenCode server mode.\n */\nexport const serverConfigSchema = z\n\t.object({\n\t\t/** Server host */\n\t\thost: z.string().optional(),\n\t\t/** Server port */\n\t\tport: z.number().optional(),\n\t})\n\t.passthrough()\n\nexport type ServerConfig = z.infer<typeof serverConfigSchema>\n\n/**\n * Keybind configuration - maps action names to key combinations.\n */\nexport const keybindConfigSchema = z.record(z.string())\n\nexport type KeybindConfig = z.infer<typeof keybindConfigSchema>\n\n/**\n * File watcher configuration for automatic reloads.\n */\nexport const watcherConfigSchema = z\n\t.object({\n\t\t/** Patterns to include */\n\t\tinclude: z.array(z.string()).optional(),\n\t\t/** Patterns to exclude */\n\t\texclude: z.array(z.string()).optional(),\n\t})\n\t.passthrough()\n\nexport type WatcherConfig = z.infer<typeof watcherConfigSchema>\n\n// -----------------------------------------------------------------------------\n// Agent Configuration\n// -----------------------------------------------------------------------------\n\n/**\n * Agent configuration options (matches opencode.json agent schema)\n */\nexport const agentConfigSchema = z.object({\n\t/** Per-agent model override */\n\tmodel: z.string().optional(),\n\n\t/** Agent description for self-documentation */\n\tdescription: z.string().optional(),\n\n\t/** Maximum iterations/steps for the agent (must be positive integer) */\n\tsteps: z.number().int().positive().optional(),\n\n\t/** @deprecated Use `steps` instead (must be positive integer) */\n\tmaxSteps: z.number().int().positive().optional(),\n\n\t/** Agent mode */\n\tmode: z.enum([\"primary\", \"subagent\", \"all\"]).optional(),\n\n\t/** Tool enable/disable patterns */\n\ttools: z.record(z.boolean()).optional(),\n\n\t/** Sampling temperature (provider-specific limits) */\n\ttemperature: z.number().optional(),\n\n\t/** Nucleus sampling parameter */\n\ttop_p: z.number().optional(),\n\n\t/** Additional prompt text */\n\tprompt: z.string().optional(),\n\n\t/**\n\t * Permission matrix for agent operations.\n\t * Use `{ \"*\": \"deny\" }` for bash to enable read-only agent detection.\n\t */\n\tpermission: z\n\t\t.record(z.union([z.enum([\"ask\", \"allow\", \"deny\"]), z.record(z.enum([\"ask\", \"allow\", \"deny\"]))]))\n\t\t.optional(),\n\n\t/** UI color for the agent */\n\tcolor: z.string().optional(),\n\n\t/** Whether the agent is disabled */\n\tdisable: z.boolean().optional(),\n\n\t/** Custom options for the agent */\n\toptions: z.record(z.any()).optional(),\n})\n\nexport type AgentConfig = z.infer<typeof agentConfigSchema>\n\n/**\n * Permission configuration schema (matches opencode.json permission schema)\n * Supports both simple values and per-path patterns\n */\nexport const permissionConfigSchema = z\n\t.object({\n\t\t/**\n\t\t * Bash command permissions.\n\t\t * - Use `\"allow\"` for full bash access\n\t\t * - Use `{ \"*\": \"deny\" }` to deny all bash (required for read-only agent detection)\n\t\t * - Use patterns like `{ \"git *\": \"allow\", \"*\": \"deny\" }` for partial access\n\t\t */\n\t\tbash: z\n\t\t\t.union([z.enum([\"ask\", \"allow\", \"deny\"]), z.record(z.enum([\"ask\", \"allow\", \"deny\"]))])\n\t\t\t.optional(),\n\t\t/** File edit permissions */\n\t\tedit: z\n\t\t\t.union([z.enum([\"ask\", \"allow\", \"deny\"]), z.record(z.enum([\"ask\", \"allow\", \"deny\"]))])\n\t\t\t.optional(),\n\t\t/** MCP server permissions */\n\t\tmcp: z.record(z.enum([\"ask\", \"allow\", \"deny\"])).optional(),\n\t})\n\t.catchall(z.union([z.enum([\"ask\", \"allow\", \"deny\"]), z.record(z.enum([\"ask\", \"allow\", \"deny\"]))]))\n\nexport type PermissionConfig = z.infer<typeof permissionConfigSchema>\n\n/**\n * OpenCode configuration block\n * Mirrors opencode.json structure exactly for 1:1 mapping\n */\nexport const opencodeConfigSchema = z.object({\n\t/** JSON Schema URL for IDE support */\n\t$schema: z.string().optional(),\n\n\t/** UI theme name */\n\ttheme: z.string().optional(),\n\n\t/** Logging level */\n\tlogLevel: z.string().optional(),\n\n\t/** Username for display */\n\tusername: z.string().optional(),\n\n\t/** Default model to use */\n\tmodel: z.string().optional(),\n\n\t/** Small/fast model for simple tasks */\n\tsmall_model: z.string().optional(),\n\n\t/** Default agent to use */\n\tdefault_agent: z.string().optional(),\n\n\t/** MCP servers (matches opencode.json 'mcp' field) */\n\tmcp: z.record(mcpServerRefSchema).optional(),\n\n\t/** NPM plugin packages to add to opencode.json 'plugin' array */\n\tplugin: z.array(z.string()).optional(),\n\n\t/** Tool enable/disable patterns */\n\ttools: z.record(z.boolean()).optional(),\n\n\t/** Per-agent configuration */\n\tagent: z.record(agentConfigSchema).optional(),\n\n\t/** Global instructions to append */\n\tinstructions: z.array(z.string()).optional(),\n\n\t/** Permission configuration */\n\tpermission: permissionConfigSchema.optional(),\n\n\t/** Provider configurations */\n\tprovider: z.record(providerConfigSchema).optional(),\n\n\t/** LSP configurations */\n\tlsp: z.record(lspConfigSchema).optional(),\n\n\t/** Formatter configurations */\n\tformatter: z.record(formatterConfigSchema).optional(),\n\n\t/** Custom command configurations */\n\tcommand: z.record(commandConfigSchema).optional(),\n\n\t/** TUI configuration */\n\ttui: tuiConfigSchema.optional(),\n\n\t/** Server configuration */\n\tserver: serverConfigSchema.optional(),\n\n\t/** Keybind configuration */\n\tkeybind: keybindConfigSchema.optional(),\n\n\t/** File watcher configuration */\n\twatcher: watcherConfigSchema.optional(),\n\n\t/** Enable auto-updates */\n\tauto_update: z.boolean().optional(),\n\n\t/** Enable auto-compaction */\n\tauto_compact: z.boolean().optional(),\n\n\t/** Share configuration (boolean or URL string) */\n\tshare: z.union([z.boolean(), z.string()]).optional(),\n})\n\nexport type OpencodeConfig = z.infer<typeof opencodeConfigSchema>\n\n// =============================================================================\n// COMPONENT MANIFEST SCHEMA\n// =============================================================================\n\nexport const componentManifestSchema = z.object({\n\t/** Component name (clean, no alias prefix) */\n\tname: openCodeNameSchema,\n\n\t/** Component type */\n\ttype: componentTypeSchema,\n\n\t/** Human-readable description */\n\tdescription: z.string().min(1).max(1024),\n\n\t/**\n\t * Files to install (Cargo-style)\n\t * - String: \"plugins/foo.ts\" -> auto-infers target as \"plugins/foo.ts\"\n\t * - Object: { path: \"...\", target: \"...\" } for explicit control\n\t * - Optional: bundles (deps-only) may have no files\n\t */\n\tfiles: z.array(componentFileSchema).default([]),\n\n\t/**\n\t * Dependencies on other components (Cargo-style)\n\t * - Bare string: \"utils\" -> same registry alias (implicit)\n\t * - Qualified: \"acme/utils\" -> cross-registry (explicit)\n\t */\n\tdependencies: z.array(dependencyRefSchema).default([]),\n\n\t/** NPM dependencies to install (supports pkg@version syntax) */\n\tnpmDependencies: z.array(z.string()).optional(),\n\n\t/** NPM dev dependencies to install (supports pkg@version syntax) */\n\tnpmDevDependencies: z.array(z.string()).optional(),\n\n\t/**\n\t * OpenCode configuration to merge into opencode.json\n\t * Use this for: mcp servers, plugins, tools, agent config, instructions, permissions\n\t */\n\topencode: opencodeConfigSchema.optional(),\n})\n\nexport type ComponentManifest = z.infer<typeof componentManifestSchema>\n\n// =============================================================================\n// NORMALIZER FUNCTIONS (Parse, Don't Validate - Law 2)\n// =============================================================================\n\n/**\n * Validates path doesn't contain traversal attacks.\n * Fails fast with descriptive error (Law 4: Fail Fast, Fail Loud).\n * Uses path.normalize for proper traversal detection.\n * @param filePath - The path to validate\n * @throws ValidationError if path contains traversal patterns\n */\nexport function validateSafePath(filePath: string): void {\n\tif (isAbsolute(filePath)) {\n\t\tthrow new ValidationError(`Invalid path: \"${filePath}\" - absolute paths not allowed`)\n\t}\n\tif (filePath.startsWith(\"~\")) {\n\t\tthrow new ValidationError(`Invalid path: \"${filePath}\" - home directory paths not allowed`)\n\t}\n\tconst normalized = normalize(filePath)\n\tif (normalized.startsWith(\"..\")) {\n\t\tthrow new ValidationError(`Invalid path: \"${filePath}\" - path traversal not allowed`)\n\t}\n}\n\n/**\n * V2: Infer target path from source path (root-relative, no prefix).\n * The path is used as-is since targets are now root-relative.\n * e.g., \"plugins/foo.ts\" -> \"plugins/foo.ts\"\n */\nexport function inferTargetPath(sourcePath: string): string {\n\treturn sourcePath\n}\n\n/**\n * V2: Validate a file target path.\n * Checks for reserved paths, blocked paths, and uses runtime containment validation.\n * Component type is inferred from target path (behavior-based, not explicit).\n * @param target - The target path to validate\n * @param componentType - Optional type hint for additional validation context\n * @throws ValidationError if target is invalid\n */\nexport function validateFileTarget(target: string, componentType?: ComponentType): void {\n\t// Check reserved targets\n\tif (RESERVED_TARGETS.has(target)) {\n\t\tthrow new ValidationError(`Target \"${target}\" is reserved for installer use`)\n\t}\n\n\t// Validate path safety using battle-tested validation\n\ttry {\n\t\tvalidatePath(\"/dummy/base\", target) // Just validates the path structure\n\t} catch (error) {\n\t\tif (error instanceof PathValidationError) {\n\t\t\tthrow new ValidationError(`Invalid target \"${target}\": ${error.message}`)\n\t\t}\n\t\tthrow error\n\t}\n\n\t// Check blocked paths (except for profiles, which install to their own directory)\n\tconst isProfile = componentType === \"profile\"\n\tif (!isProfile) {\n\t\t// Normalize the target path to evaluate the cleaned/resolved segments\n\t\t// This prevents bypass via paths like \"foo/../.git/config\"\n\t\tconst normalized = normalize(target)\n\n\t\t// After normalization, check if path lands in blocked prefixes\n\t\tconst isBlocked = BLOCKED_PATHS.some(\n\t\t\t(blocked) => normalized === blocked || normalized.startsWith(blocked),\n\t\t)\n\t\tif (isBlocked) {\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Target path '${target}' is protected and cannot be overwritten by registry components`,\n\t\t\t)\n\t\t}\n\t}\n}\n\n/**\n * V2: Normalize a file entry from string shorthand to full object.\n * All targets are root-relative (no .opencode/ prefix logic).\n * @param file - The file entry to normalize\n * @param componentType - Optional component type for validation context\n */\nexport function normalizeFile(\n\tfile: ComponentFile,\n\tcomponentType?: ComponentType,\n): ComponentFileObject {\n\tif (typeof file === \"string\") {\n\t\tvalidateSafePath(file)\n\t\tconst target = inferTargetPath(file)\n\t\tvalidateFileTarget(target, componentType)\n\t\treturn {\n\t\t\tpath: file,\n\t\t\ttarget,\n\t\t}\n\t}\n\n\tvalidateSafePath(file.path)\n\tvalidateSafePath(file.target)\n\tvalidateFileTarget(file.target, componentType)\n\treturn file\n}\n\n/**\n * Normalize an MCP server entry from URL shorthand to full object\n */\nexport function normalizeMcpServer(server: McpServerRef): McpServer {\n\tif (typeof server === \"string\") {\n\t\treturn {\n\t\t\ttype: \"remote\",\n\t\t\turl: server,\n\t\t\tenabled: true,\n\t\t}\n\t}\n\treturn server\n}\n\n/**\n * Normalized opencode config with MCP servers expanded\n */\nexport interface NormalizedOpencodeConfig extends Omit<OpencodeConfig, \"mcp\"> {\n\tmcp?: Record<string, McpServer>\n}\n\n/**\n * Normalized component manifest with all shorthands expanded\n */\nexport interface NormalizedComponentManifest extends Omit<ComponentManifest, \"files\" | \"opencode\"> {\n\tfiles: ComponentFileObject[]\n\topencode?: NormalizedOpencodeConfig\n}\n\n/**\n * Normalize all Cargo-style shorthands in a component manifest\n * Call this at the parse boundary to get fully-typed objects\n */\nexport function normalizeComponentManifest(\n\tmanifest: ComponentManifest,\n): NormalizedComponentManifest {\n\t// Normalize MCP servers inside opencode block\n\tlet normalizedOpencode: NormalizedOpencodeConfig | undefined\n\tif (manifest.opencode) {\n\t\t// Destructure to exclude mcp from spread (Law 2: Parse, Don't Validate)\n\t\t// Only include mcp if present - avoid setting undefined (which would overwrite during mergeDeep)\n\t\tconst { mcp, ...rest } = manifest.opencode\n\t\tnormalizedOpencode = {\n\t\t\t...rest,\n\t\t\t...(mcp && {\n\t\t\t\tmcp: Object.fromEntries(\n\t\t\t\t\tObject.entries(mcp).map(([name, server]) => [name, normalizeMcpServer(server)]),\n\t\t\t\t),\n\t\t\t}),\n\t\t}\n\t}\n\n\treturn {\n\t\t...manifest,\n\t\tfiles: manifest.files.map((file) => normalizeFile(file, manifest.type)),\n\t\topencode: normalizedOpencode,\n\t}\n}\n\n// =============================================================================\n// REGISTRY SCHEMA\n// =============================================================================\n\nconst REGISTRY_SCHEMA_VERSIONED_URL_REGEX = new RegExp(\n\t`^https://${OCX_DOMAIN.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}/schemas/v([1-9]\\\\d*)/registry\\\\.json$`,\n)\n\nexport interface RegistrySchemaUrlIssue {\n\tissue: Exclude<RegistryCompatIssue, \"invalid-format\">\n\tremediation: string\n\tschemaUrl?: string\n\tsupportedMajor: number\n\tdetectedMajor?: number\n}\n\n/**\n * Classify registry schema URL compatibility.\n * Single source of truth for local manifests and remote index payloads.\n */\nexport function classifyRegistrySchemaIssue(document: unknown): RegistrySchemaUrlIssue | null {\n\tif (document === null || document === undefined || typeof document !== \"object\") {\n\t\treturn null\n\t}\n\n\tconst documentRecord = document as Record<string, unknown>\n\tconst hasSchemaField = Object.hasOwn(documentRecord, \"$schema\")\n\tif (!hasSchemaField) {\n\t\treturn {\n\t\t\tissue: \"legacy-schema-v1\",\n\t\t\tremediation:\n\t\t\t\t`This registry uses legacy schema v1 (missing $schema). ` +\n\t\t\t\t`Set \"$schema\" to \"${REGISTRY_SCHEMA_LATEST_URL}\".`,\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t}\n\t}\n\n\tconst schemaUrl = documentRecord.$schema\n\n\tif (typeof schemaUrl !== \"string\") {\n\t\treturn {\n\t\t\tissue: \"invalid-schema-url\",\n\t\t\tremediation: `Registry $schema must be a canonical URL like \"${REGISTRY_SCHEMA_LATEST_URL}\".`,\n\t\t\tschemaUrl: String(schemaUrl),\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t}\n\t}\n\n\tif (!schemaUrl) {\n\t\treturn {\n\t\t\tissue: \"invalid-schema-url\",\n\t\t\tremediation: `Registry $schema must be a canonical URL like \"${REGISTRY_SCHEMA_LATEST_URL}\".`,\n\t\t\tschemaUrl,\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t}\n\t}\n\n\tif (schemaUrl === REGISTRY_SCHEMA_UNVERSIONED_URL) {\n\t\treturn {\n\t\t\tissue: \"legacy-schema-v1\",\n\t\t\tremediation:\n\t\t\t\t`Schema URL \"${REGISTRY_SCHEMA_UNVERSIONED_URL}\" is legacy v1. ` +\n\t\t\t\t`Use \"${REGISTRY_SCHEMA_LATEST_URL}\" instead.`,\n\t\t\tschemaUrl,\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t}\n\t}\n\n\tconst versionMatch = schemaUrl.match(REGISTRY_SCHEMA_VERSIONED_URL_REGEX)\n\tif (!versionMatch) {\n\t\treturn {\n\t\t\tissue: \"invalid-schema-url\",\n\t\t\tremediation: `Registry $schema must be a canonical URL like \"${REGISTRY_SCHEMA_LATEST_URL}\".`,\n\t\t\tschemaUrl,\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t}\n\t}\n\n\tconst majorToken = versionMatch[1]\n\tif (!majorToken) {\n\t\treturn {\n\t\t\tissue: \"invalid-schema-url\",\n\t\t\tremediation: `Registry $schema must be a canonical URL like \"${REGISTRY_SCHEMA_LATEST_URL}\".`,\n\t\t\tschemaUrl,\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t}\n\t}\n\n\tconst major = Number.parseInt(majorToken, 10)\n\tif (major !== REGISTRY_SCHEMA_LATEST_MAJOR) {\n\t\treturn {\n\t\t\tissue: \"unsupported-schema-version\",\n\t\t\tremediation:\n\t\t\t\t`Schema major v${major} is unsupported. ` +\n\t\t\t\t`Use \"${REGISTRY_SCHEMA_LATEST_URL}\" (v${REGISTRY_SCHEMA_LATEST_MAJOR}).`,\n\t\t\tschemaUrl,\n\t\t\tsupportedMajor: REGISTRY_SCHEMA_LATEST_MAJOR,\n\t\t\tdetectedMajor: major,\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * Semver regex for version validation\n */\nconst semverRegex = /^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$/\n\n/**\n * Registry manifest schema.\n *\n * `name`, `version`, and `author` are **required** metadata.\n * This is intentional — every published registry must be identifiable and\n * versioned so that OCX can resolve, cache, and diff registries reliably.\n * Omitting `name` or `version` is a validation error at parse time\n * (Law 4: Fail Fast, Fail Loud).\n */\nexport const registrySchema = z\n\t.object({\n\t\t/** JSON Schema URL for IDE support */\n\t\t$schema: z.string().optional(),\n\n\t\t/** Registry display name (required — identifies the registry to users and tooling) */\n\t\tname: z.string().min(1, \"Registry name cannot be empty\"),\n\n\t\t/** Registry version, semver (required — enables deterministic resolution and caching) */\n\t\tversion: z.string().regex(semverRegex, { message: \"Version must be valid semver\" }),\n\n\t\t/** Registry author (required) */\n\t\tauthor: z.string().min(1, \"Author cannot be empty\"),\n\n\t\t/** Minimum OpenCode version required (semver, e.g., \"1.0.0\") */\n\t\topencode: z\n\t\t\t.string()\n\t\t\t.regex(semverRegex, {\n\t\t\t\tmessage: \"OpenCode version must be valid semver\",\n\t\t\t})\n\t\t\t.optional(),\n\n\t\t/** Minimum OCX CLI version required (semver, e.g., \"1.0.0\") */\n\t\tocx: z\n\t\t\t.string()\n\t\t\t.regex(semverRegex, {\n\t\t\t\tmessage: \"OCX version must be valid semver\",\n\t\t\t})\n\t\t\t.optional(),\n\n\t\t/** Components in this registry */\n\t\tcomponents: z.array(componentManifestSchema),\n\t})\n\t.refine(\n\t\t(data) => {\n\t\t\t// All dependencies must either:\n\t\t\t// 1. Be a bare name that exists in this registry\n\t\t\t// 2. Be a qualified cross-registry reference (validated at install time)\n\t\t\tconst componentNames = new Set(data.components.map((c) => c.name))\n\t\t\tfor (const component of data.components) {\n\t\t\t\tfor (const dep of component.dependencies) {\n\t\t\t\t\t// Only validate bare (same-registry) dependencies\n\t\t\t\t\tif (!dep.includes(\"/\") && !componentNames.has(dep)) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\t{\n\t\t\tmessage:\n\t\t\t\t\"Bare dependencies must reference components that exist in the registry. Use qualified references (e.g., 'other-registry/component') for cross-registry dependencies.\",\n\t\t},\n\t)\n\nexport type Registry = z.infer<typeof registrySchema>\n\n// =============================================================================\n// PACKUMENT SCHEMA (npm-style versioned component)\n// =============================================================================\n\nexport const packumentSchema = z.object({\n\t/** Component name */\n\tname: openCodeNameSchema,\n\n\t/** Latest version */\n\t\"dist-tags\": z.object({\n\t\tlatest: z.string(),\n\t}),\n\n\t/** All versions */\n\tversions: z.record(componentManifestSchema),\n})\n\nexport type Packument = z.infer<typeof packumentSchema>\n\n// =============================================================================\n// REGISTRY INDEX SCHEMA\n// =============================================================================\n\nexport const registryIndexSchema = z.object({\n\t/** JSON Schema URL for IDE support */\n\t$schema: z.string().optional(),\n\n\t/** Registry author */\n\tauthor: z.string(),\n\n\t/** Minimum OpenCode version required */\n\topencode: z\n\t\t.string()\n\t\t.regex(semverRegex, {\n\t\t\tmessage: \"OpenCode version must be valid semver\",\n\t\t})\n\t\t.optional(),\n\n\t/** Minimum OCX CLI version required */\n\tocx: z\n\t\t.string()\n\t\t.regex(semverRegex, {\n\t\t\tmessage: \"OCX version must be valid semver\",\n\t\t})\n\t\t.optional(),\n\n\t/** Component summaries for search */\n\tcomponents: z.array(\n\t\tz.object({\n\t\t\tname: openCodeNameSchema,\n\t\t\ttype: componentTypeSchema,\n\t\t\tdescription: z.string(),\n\t\t}),\n\t),\n})\n\nexport type RegistryIndex = z.infer<typeof registryIndexSchema>\n",
26
- "/**\n * Type guard to check if a value is a plain object.\n * Returns true only for plain objects (not arrays, not null, not primitives).\n *\n * @param value - Value to check\n * @returns true if value is a plain object\n *\n * @example\n * isPlainObject({}) // true\n * isPlainObject([]) // false\n * isPlainObject(null) // false\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t!Array.isArray(value) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n",
27
- "/**\n * Registry Fetcher with in-memory caching\n * Based on: https://github.com/shadcn-ui/ui/blob/main/packages/shadcn/src/registry/fetcher.ts\n */\n\nimport { posix as posixPath } from \"node:path\"\nimport { z } from \"zod\"\nimport type { ComponentManifest, McpServer, RegistryIndex } from \"../schemas/registry\"\nimport {\n\tclassifyRegistrySchemaIssue,\n\tcomponentManifestSchema,\n\tcomponentTypeSchema,\n\tpackumentSchema,\n\tregistryIndexSchema,\n} from \"../schemas/registry\"\nimport {\n\tNetworkError,\n\tNotFoundError,\n\ttype RegistryCompatIssue,\n\tRegistryCompatibilityError,\n\tValidationError,\n} from \"../utils/errors\"\nimport { isPlainObject } from \"../utils/type-guards\"\nimport { normalizeRegistryUrl } from \"../utils/url\"\n\n// In-memory cache for deduplication\nconst cache = new Map<string, Promise<unknown>>()\ntype RegistrySchemaMode = \"legacy-v1\" | \"v2\"\nconst registrySchemaModeCache = new Map<string, RegistrySchemaMode>()\n\nconst LEGACY_COMPONENT_TYPE_ALIAS_MAP = {\n\t\"ocx:agent\": \"agent\",\n\t\"ocx:skill\": \"skill\",\n\t\"ocx:plugin\": \"plugin\",\n\t\"ocx:command\": \"command\",\n\t\"ocx:tool\": \"tool\",\n\t\"ocx:bundle\": \"bundle\",\n\t\"ocx:profile\": \"profile\",\n} as const\n\nconst LEGACY_TARGET_KIND_MAP = {\n\tagent: \"agents\",\n\tskill: \"skills\",\n\tplugin: \"plugins\",\n\tcommand: \"commands\",\n\ttool: \"tools\",\n\tbundle: \"bundles\",\n\tprofile: \"profiles\",\n\tphilosophy: \"tools\",\n} as const\n\nconst packumentEnvelopeSchema = packumentSchema.extend({\n\tversions: z.record(z.unknown()),\n})\n\nfunction createCompatibilityError(\n\turl: string,\n\tclassification: {\n\t\tissue: RegistryCompatIssue\n\t\tremediation: string\n\t\tschemaUrl?: string\n\t\tsupportedMajor?: number\n\t\tdetectedMajor?: number\n\t},\n): RegistryCompatibilityError {\n\treturn new RegistryCompatibilityError(\n\t\t`Registry at ${url} uses an incompatible format (${classification.issue}). ${classification.remediation}`,\n\t\t{\n\t\t\turl,\n\t\t\tissue: classification.issue,\n\t\t\tremediation: classification.remediation,\n\t\t\t...(classification.schemaUrl !== undefined && {\n\t\t\t\tschemaUrl: classification.schemaUrl,\n\t\t\t}),\n\t\t\t...(classification.supportedMajor !== undefined && {\n\t\t\t\tsupportedMajor: classification.supportedMajor,\n\t\t\t}),\n\t\t\t...(classification.detectedMajor !== undefined && {\n\t\t\t\tdetectedMajor: classification.detectedMajor,\n\t\t\t}),\n\t\t},\n\t)\n}\n\nfunction mapLegacyComponentType(type: unknown, context: string): string {\n\tif (typeof type !== \"string\") {\n\t\tthrow new ValidationError(`Invalid ${context}: expected string, got ${typeof type}`)\n\t}\n\n\tconst mappedType =\n\t\tLEGACY_COMPONENT_TYPE_ALIAS_MAP[type as keyof typeof LEGACY_COMPONENT_TYPE_ALIAS_MAP] ?? type\n\tconst parsedType = componentTypeSchema.safeParse(mappedType)\n\tif (!parsedType.success) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsupported component type \"${type}\" in ${context}. ` +\n\t\t\t\t`Expected one of: ${componentTypeSchema.options.join(\", \")}`,\n\t\t)\n\t}\n\n\treturn parsedType.data\n}\n\nfunction isLegacyV2TypeAlias(type: unknown): type is keyof typeof LEGACY_COMPONENT_TYPE_ALIAS_MAP {\n\treturn typeof type === \"string\" && Object.hasOwn(LEGACY_COMPONENT_TYPE_ALIAS_MAP, type)\n}\n\nfunction hasLegacyManifestTargetPrefix(target: string): boolean {\n\treturn target.startsWith(\".opencode/\") || target.startsWith(\".opencode\\\\\")\n}\n\nfunction collectLegacyManifestTargetIssues(\n\tmanifest: unknown,\n): Array<{ path: string; target: string }> {\n\tif (!isPlainObject(manifest) || !Array.isArray(manifest.files)) {\n\t\treturn []\n\t}\n\n\tconst issues: Array<{ path: string; target: string }> = []\n\n\tfor (const [index, file] of manifest.files.entries()) {\n\t\tif (typeof file === \"string\") {\n\t\t\tif (!hasLegacyManifestTargetPrefix(file)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tissues.push({\n\t\t\t\tpath: `files[${index}]`,\n\t\t\t\ttarget: file,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isPlainObject(file) || typeof file.target !== \"string\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!hasLegacyManifestTargetPrefix(file.target)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tissues.push({\n\t\t\tpath: `files[${index}].target`,\n\t\t\ttarget: file.target,\n\t\t})\n\t}\n\n\treturn issues\n}\n\nfunction collectLegacyV2TypeIssues(data: unknown): Array<{\n\tpath: string\n\ttype: keyof typeof LEGACY_COMPONENT_TYPE_ALIAS_MAP\n}> {\n\tif (!isPlainObject(data)) {\n\t\treturn []\n\t}\n\n\tconst components = data.components\n\tif (!Array.isArray(components)) {\n\t\treturn []\n\t}\n\n\tconst issues: Array<{\n\t\tpath: string\n\t\ttype: keyof typeof LEGACY_COMPONENT_TYPE_ALIAS_MAP\n\t}> = []\n\n\tfor (const [index, component] of components.entries()) {\n\t\tif (!isPlainObject(component)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst type = component.type\n\t\tif (!isLegacyV2TypeAlias(type)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tissues.push({ path: `components[${index}].type`, type })\n\t}\n\n\treturn issues\n}\n\nfunction hasLegacySignalsInManifest(manifest: unknown): boolean {\n\tif (!isPlainObject(manifest)) {\n\t\treturn false\n\t}\n\n\tif (typeof manifest.type === \"string\" && manifest.type.startsWith(\"ocx:\")) {\n\t\treturn true\n\t}\n\n\treturn collectLegacyManifestTargetIssues(manifest).length > 0\n}\n\nasync function resolveRegistrySchemaMode(baseUrl: string): Promise<RegistrySchemaMode | null> {\n\tconst normalizedBaseUrl = normalizeRegistryUrl(baseUrl)\n\tconst cachedMode = registrySchemaModeCache.get(normalizedBaseUrl)\n\tif (cachedMode) {\n\t\treturn cachedMode\n\t}\n\n\ttry {\n\t\tawait fetchRegistryIndex(normalizedBaseUrl)\n\t} catch (error) {\n\t\tif (error instanceof NetworkError || error instanceof NotFoundError) {\n\t\t\treturn null\n\t\t}\n\n\t\tthrow error\n\t}\n\n\tif (!registrySchemaModeCache.has(normalizedBaseUrl)) {\n\t\treturn null\n\t}\n\n\tconst schemaMode = registrySchemaModeCache.get(normalizedBaseUrl)\n\tif (!schemaMode) {\n\t\tthrow new Error(`Missing registry schema mode cache entry for ${normalizedBaseUrl}`)\n\t}\n\n\treturn schemaMode\n}\n\nfunction canonicalizeLegacyTargetPath(rawTarget: string, context: string): string {\n\tif (rawTarget.includes(\"\\0\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: null bytes are not allowed`,\n\t\t)\n\t}\n\n\tif (rawTarget.includes(\"%\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: encoded paths are not allowed`,\n\t\t)\n\t}\n\n\tif (rawTarget.includes(\"\\\\\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: Windows separators are not allowed`,\n\t\t)\n\t}\n\n\tif (rawTarget.startsWith(\"/\") || rawTarget.startsWith(\"//\") || /^[a-zA-Z]:/.test(rawTarget)) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: absolute paths are not allowed`,\n\t\t)\n\t}\n\n\tconst withoutPrefix = rawTarget.startsWith(\".opencode/\")\n\t\t? rawTarget.slice(\".opencode/\".length)\n\t\t: rawTarget\n\n\tif (!withoutPrefix) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: missing path after .opencode/`,\n\t\t)\n\t}\n\n\tconst segments = withoutPrefix.split(\"/\")\n\tif (segments.some((segment) => segment.length === 0)) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: empty path segments are not allowed`,\n\t\t)\n\t}\n\n\tif (segments.some((segment) => segment === \".\" || segment === \"..\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: traversal segments are not allowed`,\n\t\t)\n\t}\n\n\tconst [firstSegment, ...restSegments] = segments\n\tif (!firstSegment) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: missing path root segment`,\n\t\t)\n\t}\n\n\tconst mappedRoot = LEGACY_TARGET_KIND_MAP[firstSegment as keyof typeof LEGACY_TARGET_KIND_MAP]\n\tconst rewrittenTarget = [mappedRoot ?? firstSegment, ...restSegments].join(\"/\")\n\n\tconst normalized = posixPath.normalize(rewrittenTarget)\n\tif (normalized !== rewrittenTarget) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: path normalization is ambiguous`,\n\t\t)\n\t}\n\n\tif (normalized === \".\" || normalized === \"..\" || normalized.startsWith(\"../\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Unsafe target \"${rawTarget}\" in ${context}: target escapes project root`,\n\t\t)\n\t}\n\n\treturn normalized\n}\n\nfunction adaptLegacyComponentManifest(manifest: unknown, context: string): unknown {\n\tif (!isPlainObject(manifest)) return manifest\n\n\tconst adaptedManifest: Record<string, unknown> = { ...manifest }\n\n\tif (Object.hasOwn(adaptedManifest, \"type\")) {\n\t\tadaptedManifest.type = mapLegacyComponentType(adaptedManifest.type, `${context}.type`)\n\t}\n\n\tif (Array.isArray(adaptedManifest.files)) {\n\t\tadaptedManifest.files = adaptedManifest.files.map((file, index) => {\n\t\t\tif (typeof file === \"string\") {\n\t\t\t\tif (!hasLegacyManifestTargetPrefix(file)) {\n\t\t\t\t\treturn file\n\t\t\t\t}\n\n\t\t\t\treturn canonicalizeLegacyTargetPath(file, `${context}.files[${index}]`)\n\t\t\t}\n\n\t\t\tif (!isPlainObject(file)) return file\n\n\t\t\tconst target = file.target\n\t\t\tif (typeof target !== \"string\") return file\n\n\t\t\tconst isLegacyTarget = hasLegacyManifestTargetPrefix(target)\n\t\t\tif (!isLegacyTarget) return file\n\n\t\t\treturn {\n\t\t\t\t...file,\n\t\t\t\ttarget: canonicalizeLegacyTargetPath(target, `${context}.files[${index}].target`),\n\t\t\t}\n\t\t})\n\t}\n\n\treturn adaptedManifest\n}\n\nfunction adaptLegacyRegistryIndex(data: unknown, url: string): unknown {\n\tif (!isPlainObject(data)) {\n\t\tthrow new RegistryCompatibilityError(\n\t\t\t`Registry at ${url} uses legacy schema v1 but does not expose an object index payload.`,\n\t\t\t{\n\t\t\t\turl,\n\t\t\t\tissue: \"legacy-schema-v1\",\n\t\t\t\tremediation:\n\t\t\t\t\t\"Publish an object index with author/components fields, or upgrade to schema v2.\",\n\t\t\t},\n\t\t)\n\t}\n\n\tconst components = data.components\n\tif (!Array.isArray(components)) {\n\t\tthrow new RegistryCompatibilityError(\n\t\t\t`Registry at ${url} uses legacy schema v1 but the components field is missing or invalid.`,\n\t\t\t{\n\t\t\t\turl,\n\t\t\t\tissue: \"legacy-schema-v1\",\n\t\t\t\tremediation: \"Ensure the legacy index has a components array, or upgrade to schema v2.\",\n\t\t\t},\n\t\t)\n\t}\n\n\tconst adaptedComponents = components.map((component, index) => {\n\t\tif (!isPlainObject(component)) {\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Invalid index component at components[${index}]: expected object, got ${typeof component}`,\n\t\t\t)\n\t\t}\n\n\t\tconst name = component.name\n\t\tconst description = component.description\n\t\tif (typeof name !== \"string\") {\n\t\t\tthrow new ValidationError(`Invalid index component name at components[${index}].name`)\n\t\t}\n\t\tif (typeof description !== \"string\") {\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Invalid index component description at components[${index}].description`,\n\t\t\t)\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\ttype: mapLegacyComponentType(component.type, `components[${index}].type`),\n\t\t\tdescription,\n\t\t}\n\t})\n\n\treturn {\n\t\t...data,\n\t\tcomponents: adaptedComponents,\n\t}\n}\n\n/**\n * Fetch with caching - deduplicates concurrent requests\n */\nasync function fetchWithCache<T>(\n\tcacheKey: string,\n\tparse: (data: unknown) => T | Promise<T>,\n\toptions: {\n\t\tphase?: string\n\t\trequestUrl?: string\n\t} = {},\n): Promise<T> {\n\tconst cached = cache.get(cacheKey)\n\tif (cached) {\n\t\treturn cached as Promise<T>\n\t}\n\n\tconst requestUrl = options.requestUrl ?? cacheKey\n\n\tconst promise = (async () => {\n\t\tconst networkErrorContext = {\n\t\t\turl: requestUrl,\n\t\t\tphase: options.phase,\n\t\t}\n\n\t\tlet response: Response\n\t\ttry {\n\t\t\tresponse = await fetch(requestUrl)\n\t\t} catch (error) {\n\t\t\tthrow new NetworkError(\n\t\t\t\t`Network request failed for ${requestUrl}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\tnetworkErrorContext,\n\t\t\t)\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tif (response.status === 404) {\n\t\t\t\tthrow new NotFoundError(`Not found: ${requestUrl}`)\n\t\t\t}\n\t\t\tthrow new NetworkError(\n\t\t\t\t`Failed to fetch ${requestUrl}: ${response.status} ${response.statusText}`,\n\t\t\t\t{\n\t\t\t\t\t...networkErrorContext,\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tlet data: unknown\n\t\ttry {\n\t\t\tdata = await response.json()\n\t\t} catch (error) {\n\t\t\tthrow new NetworkError(\n\t\t\t\t`Invalid JSON response from ${requestUrl}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\tnetworkErrorContext,\n\t\t\t)\n\t\t}\n\n\t\treturn await parse(data)\n\t})()\n\n\tcache.set(cacheKey, promise)\n\n\t// Clean up cache on error\n\tpromise.catch(() => cache.delete(cacheKey))\n\n\treturn promise\n}\n\n/**\n * Classify registry index schema compatibility from parsed JSON data.\n * Returns null when the schema URL is compatible.\n */\nexport function classifyRegistryIndexIssue(data: unknown): {\n\tissue: RegistryCompatIssue\n\tremediation: string\n\tschemaUrl?: string\n\tsupportedMajor?: number\n\tdetectedMajor?: number\n} | null {\n\tconst issue = classifyRegistrySchemaIssue(data)\n\tif (!issue) return null\n\n\treturn {\n\t\tissue: issue.issue,\n\t\tremediation: issue.remediation,\n\t\tschemaUrl: issue.schemaUrl,\n\t\tsupportedMajor: issue.supportedMajor,\n\t\tdetectedMajor: issue.detectedMajor,\n\t}\n}\n\n/**\n * Fetch registry index\n */\nexport async function fetchRegistryIndex(baseUrl: string): Promise<RegistryIndex> {\n\tconst normalizedBaseUrl = normalizeRegistryUrl(baseUrl)\n\tconst url = `${normalizedBaseUrl}/index.json`\n\n\treturn fetchWithCache(\n\t\turl,\n\t\t(data) => {\n\t\t\t// Pre-schema classification: detect known incompatible formats\n\t\t\tconst classification = classifyRegistryIndexIssue(data)\n\n\t\t\tif (classification && classification.issue !== \"legacy-schema-v1\") {\n\t\t\t\tthrow createCompatibilityError(url, classification)\n\t\t\t}\n\n\t\t\tlet candidateData = data\n\t\t\tlet schemaMode: RegistrySchemaMode = \"v2\"\n\t\t\tif (classification?.issue === \"legacy-schema-v1\") {\n\t\t\t\tschemaMode = \"legacy-v1\"\n\t\t\t\ttry {\n\t\t\t\t\tcandidateData = adaptLegacyRegistryIndex(data, url)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof RegistryCompatibilityError) {\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\n\t\t\t\t\tconst reason = error instanceof Error ? error.message : String(error)\n\t\t\t\t\tthrow new RegistryCompatibilityError(\n\t\t\t\t\t\t`Registry at ${url} uses legacy schema v1 but cannot be adapted safely. ${reason}`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\tissue: \"invalid-format\",\n\t\t\t\t\t\t\tremediation:\n\t\t\t\t\t\t\t\t\"Fix the legacy payload shape (types/descriptions/components) or upgrade the registry to v2.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst legacyTypeIssues = collectLegacyV2TypeIssues(candidateData)\n\t\t\t\tif (legacyTypeIssues.length > 0) {\n\t\t\t\t\tconst firstIssue = legacyTypeIssues[0]\n\t\t\t\t\tif (!firstIssue) {\n\t\t\t\t\t\tthrow new Error(\"Unexpected missing legacy type issue\")\n\t\t\t\t\t}\n\n\t\t\t\t\tconst canonicalType = LEGACY_COMPONENT_TYPE_ALIAS_MAP[firstIssue.type]\n\t\t\t\t\tthrow new RegistryCompatibilityError(\n\t\t\t\t\t\t`Registry at ${url} uses legacy component type \"${firstIssue.type}\" in ${firstIssue.path}. Use \"${canonicalType}\" for v2 registries.`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\tissue: \"invalid-format\",\n\t\t\t\t\t\t\tremediation: `Replace legacy type \"${firstIssue.type}\" with canonical \"${canonicalType}\" in v2 manifests.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst result = registryIndexSchema.safeParse(candidateData)\n\t\t\tif (!result.success) {\n\t\t\t\tthrow new RegistryCompatibilityError(\n\t\t\t\t\t`Registry at ${url} returned an unrecognized index format. Ensure it follows the OCX registry specification. Schema error: ${result.error.message}`,\n\t\t\t\t\t{\n\t\t\t\t\t\turl,\n\t\t\t\t\t\tissue: \"invalid-format\",\n\t\t\t\t\t\tremediation:\n\t\t\t\t\t\t\t\"Ensure the registry index follows the OCX registry specification. \" +\n\t\t\t\t\t\t\t`Schema error: ${result.error.message}`,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tregistrySchemaModeCache.set(normalizedBaseUrl, schemaMode)\n\t\t\treturn result.data\n\t\t},\n\t\t{ phase: \"registry-index-fetch\" },\n\t)\n}\n\n/**\n * Fetch a component from registry and return the latest manifest\n */\nexport async function fetchComponent(baseUrl: string, name: string): Promise<ComponentManifest> {\n\tconst result = await fetchComponentVersion(baseUrl, name)\n\treturn result.manifest\n}\n\n/**\n * Fetch a component from registry with specific or latest version.\n * Returns both the manifest and the resolved version.\n */\nexport async function fetchComponentVersion(\n\tbaseUrl: string,\n\tname: string,\n\tversion?: string,\n): Promise<{ manifest: ComponentManifest; version: string }> {\n\tconst url = `${normalizeRegistryUrl(baseUrl)}/components/${name}.json`\n\n\treturn fetchWithCache(\n\t\t`${url}#v=${version ?? \"latest\"}`,\n\t\tasync (data) => {\n\t\t\t// 1. Parse as packument\n\t\t\tconst packumentResult = packumentEnvelopeSchema.safeParse(data)\n\t\t\tif (!packumentResult.success) {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Invalid packument format for \"${name}\": ${packumentResult.error.message}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst packument = packumentResult.data\n\n\t\t\t// 2. Resolve version (specific or latest)\n\t\t\tconst resolvedVersion = version ?? packument[\"dist-tags\"].latest\n\t\t\tconst manifest = packument.versions[resolvedVersion]\n\n\t\t\tif (!manifest) {\n\t\t\t\tif (version) {\n\t\t\t\t\tconst availableVersions = Object.keys(packument.versions).join(\", \")\n\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t`Component \"${name}\" has no version \"${version}\". Available: ${availableVersions}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Component \"${name}\" has no manifest for latest version ${resolvedVersion}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// 3. Validate manifest (legacy adaptation is version-gated)\n\t\t\tconst context = `component \"${name}@${resolvedVersion}\"`\n\t\t\tlet candidateManifest: unknown = manifest\n\n\t\t\tif (hasLegacySignalsInManifest(manifest)) {\n\t\t\t\tconst schemaMode = await resolveRegistrySchemaMode(baseUrl)\n\n\t\t\t\tif (schemaMode !== \"v2\") {\n\t\t\t\t\tcandidateManifest = adaptLegacyComponentManifest(manifest, context)\n\t\t\t\t} else {\n\t\t\t\t\tconst legacyTargetIssues = collectLegacyManifestTargetIssues(manifest)\n\t\t\t\t\tconst firstLegacyTargetIssue = legacyTargetIssues[0]\n\t\t\t\t\tif (firstLegacyTargetIssue) {\n\t\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t\t`Invalid component manifest for \"${name}@${resolvedVersion}\": target \"${firstLegacyTargetIssue.target}\" at ${firstLegacyTargetIssue.path} uses a legacy .opencode/ prefix. ` +\n\t\t\t\t\t\t\t\t`For v2 registries, use canonical root-relative targets like \"plugins/...\", \"profiles/...\", \"agents/...\", \"skills/...\", or \"commands/...\" (without .opencode/).`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isPlainObject(manifest) && isLegacyV2TypeAlias(manifest.type)) {\n\t\t\t\t\t\tconst canonicalType = LEGACY_COMPONENT_TYPE_ALIAS_MAP[manifest.type]\n\t\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t\t`Invalid component manifest for \"${name}@${resolvedVersion}\": type \"${manifest.type}\" is a legacy v1 alias. Use \"${canonicalType}\" for v2 registries.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst manifestResult = componentManifestSchema.safeParse(candidateManifest)\n\t\t\tif (!manifestResult.success) {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Invalid component manifest for \"${name}@${resolvedVersion}\": ${manifestResult.error.message}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn { manifest: manifestResult.data, version: resolvedVersion }\n\t\t},\n\t\t{ phase: \"packument-fetch\", requestUrl: url },\n\t)\n}\n\n/**\n * Fetch actual file content from registry\n */\nexport async function fetchFileContent(\n\tbaseUrl: string,\n\tcomponentName: string,\n\tfilePath: string,\n): Promise<string> {\n\tconst url = `${normalizeRegistryUrl(baseUrl)}/components/${componentName}/${filePath}`\n\tconst networkErrorContext = {\n\t\turl,\n\t\tphase: \"file-content-fetch\",\n\t\tqualifiedName: componentName,\n\t} as const\n\n\tlet response: Response\n\ttry {\n\t\tresponse = await fetch(url)\n\t} catch (error) {\n\t\tthrow new NetworkError(\n\t\t\t`Network request failed for ${url}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\tnetworkErrorContext,\n\t\t)\n\t}\n\n\tif (!response.ok) {\n\t\tthrow new NetworkError(\n\t\t\t`Failed to fetch file ${filePath} for ${componentName} from ${url}: ${response.status} ${response.statusText}`,\n\t\t\t{\n\t\t\t\t...networkErrorContext,\n\t\t\t\tstatus: response.status,\n\t\t\t\tstatusText: response.statusText,\n\t\t\t},\n\t\t)\n\t}\n\n\treturn response.text()\n}\n\n// Re-export types for convenience\nexport type { ComponentManifest, RegistryIndex, McpServer }\n\n/** @internal Clear cache for testing purposes only */\nexport function _clearFetcherCacheForTests(): void {\n\tcache.clear()\n\tregistrySchemaModeCache.clear()\n}\n",
28
- "'use strict';\n\nconst spinners = Object.assign({}, require('./spinners.json')); // eslint-disable-line import/extensions\n\nconst spinnersList = Object.keys(spinners);\n\nObject.defineProperty(spinners, 'random', {\n\tget() {\n\t\tconst randomIndex = Math.floor(Math.random() * spinnersList.length);\n\t\tconst spinnerName = spinnersList[randomIndex];\n\t\treturn spinners[spinnerName];\n\t}\n});\n\nmodule.exports = spinners;\n",
29
- "// https://github.com/farzher/fuzzysort v3.0.2\r\n\r\n// UMD (Universal Module Definition) for fuzzysort\r\n;((root, UMD) => {\r\n if(typeof define === 'function' && define.amd) define([], UMD)\r\n else if(typeof module === 'object' && module.exports) module.exports = UMD()\r\n else root['fuzzysort'] = UMD()\r\n})(this, _ => {\r\n 'use strict'\r\n\r\n var single = (search, target) => {\r\n if(!search || !target) return NULL\r\n\r\n var preparedSearch = getPreparedSearch(search)\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n\r\n var searchBitflags = preparedSearch.bitflags\r\n if((searchBitflags & target._bitflags) !== searchBitflags) return NULL\r\n\r\n return algorithm(preparedSearch, target)\r\n }\r\n\r\n var go = (search, targets, options) => {\r\n if(!search) return options?.all ? all(targets, options) : noResults\r\n\r\n var preparedSearch = getPreparedSearch(search)\r\n var searchBitflags = preparedSearch.bitflags\r\n var containsSpace = preparedSearch.containsSpace\r\n\r\n var threshold = denormalizeScore( options?.threshold || 0 )\r\n var limit = options?.limit || INFINITY\r\n\r\n var resultsLen = 0; var limitedCount = 0\r\n var targetsLen = targets.length\r\n\r\n function push_result(result) {\r\n if(resultsLen < limit) { q.add(result); ++resultsLen }\r\n else {\r\n ++limitedCount\r\n if(result._score > q.peek()._score) q.replaceTop(result)\r\n }\r\n }\r\n\r\n // This code is copy/pasted 3 times for performance reasons [options.key, options.keys, no keys]\r\n\r\n // options.key\r\n if(options?.key) {\r\n var key = options.key\r\n for(var i = 0; i < targetsLen; ++i) { var obj = targets[i]\r\n var target = getValue(obj, key)\r\n if(!target) continue\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n\r\n if((searchBitflags & target._bitflags) !== searchBitflags) continue\r\n var result = algorithm(preparedSearch, target)\r\n if(result === NULL) continue\r\n if(result._score < threshold) continue\r\n\r\n result.obj = obj\r\n push_result(result)\r\n }\r\n\r\n // options.keys\r\n } else if(options?.keys) {\r\n var keys = options.keys\r\n var keysLen = keys.length\r\n\r\n outer: for(var i = 0; i < targetsLen; ++i) { var obj = targets[i]\r\n\r\n { // early out based on bitflags\r\n var keysBitflags = 0\r\n for (var keyI = 0; keyI < keysLen; ++keyI) {\r\n var key = keys[keyI]\r\n var target = getValue(obj, key)\r\n if(!target) { tmpTargets[keyI] = noTarget; continue }\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n tmpTargets[keyI] = target\r\n\r\n keysBitflags |= target._bitflags\r\n }\r\n\r\n if((searchBitflags & keysBitflags) !== searchBitflags) continue\r\n }\r\n\r\n if(containsSpace) for(let i=0; i<preparedSearch.spaceSearches.length; i++) keysSpacesBestScores[i] = NEGATIVE_INFINITY\r\n\r\n for (var keyI = 0; keyI < keysLen; ++keyI) {\r\n target = tmpTargets[keyI]\r\n if(target === noTarget) { tmpResults[keyI] = noTarget; continue }\r\n\r\n tmpResults[keyI] = algorithm(preparedSearch, target, /*allowSpaces=*/false, /*allowPartialMatch=*/containsSpace)\r\n if(tmpResults[keyI] === NULL) { tmpResults[keyI] = noTarget; continue }\r\n\r\n // todo: this seems weird and wrong. like what if our first match wasn't good. this should just replace it instead of averaging with it\r\n // if our second match isn't good we ignore it instead of averaging with it\r\n if(containsSpace) for(let i=0; i<preparedSearch.spaceSearches.length; i++) {\r\n if(allowPartialMatchScores[i] > -1000) {\r\n if(keysSpacesBestScores[i] > NEGATIVE_INFINITY) {\r\n var tmp = (keysSpacesBestScores[i] + allowPartialMatchScores[i]) / 4/*bonus score for having multiple matches*/\r\n if(tmp > keysSpacesBestScores[i]) keysSpacesBestScores[i] = tmp\r\n }\r\n }\r\n if(allowPartialMatchScores[i] > keysSpacesBestScores[i]) keysSpacesBestScores[i] = allowPartialMatchScores[i]\r\n }\r\n }\r\n\r\n if(containsSpace) {\r\n for(let i=0; i<preparedSearch.spaceSearches.length; i++) { if(keysSpacesBestScores[i] === NEGATIVE_INFINITY) continue outer }\r\n } else {\r\n var hasAtLeast1Match = false\r\n for(let i=0; i < keysLen; i++) { if(tmpResults[i]._score !== NEGATIVE_INFINITY) { hasAtLeast1Match = true; break } }\r\n if(!hasAtLeast1Match) continue\r\n }\r\n\r\n var objResults = new KeysResult(keysLen)\r\n for(let i=0; i < keysLen; i++) { objResults[i] = tmpResults[i] }\r\n\r\n if(containsSpace) {\r\n var score = 0\r\n for(let i=0; i<preparedSearch.spaceSearches.length; i++) score += keysSpacesBestScores[i]\r\n } else {\r\n // todo could rewrite this scoring to be more similar to when there's spaces\r\n // if we match multiple keys give us bonus points\r\n var score = NEGATIVE_INFINITY\r\n for(let i=0; i<keysLen; i++) {\r\n var result = objResults[i]\r\n if(result._score > -1000) {\r\n if(score > NEGATIVE_INFINITY) {\r\n var tmp = (score + result._score) / 4/*bonus score for having multiple matches*/\r\n if(tmp > score) score = tmp\r\n }\r\n }\r\n if(result._score > score) score = result._score\r\n }\r\n }\r\n\r\n objResults.obj = obj\r\n objResults._score = score\r\n if(options?.scoreFn) {\r\n score = options.scoreFn(objResults)\r\n if(!score) continue\r\n score = denormalizeScore(score)\r\n objResults._score = score\r\n }\r\n\r\n if(score < threshold) continue\r\n push_result(objResults)\r\n }\r\n\r\n // no keys\r\n } else {\r\n for(var i = 0; i < targetsLen; ++i) { var target = targets[i]\r\n if(!target) continue\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n\r\n if((searchBitflags & target._bitflags) !== searchBitflags) continue\r\n var result = algorithm(preparedSearch, target)\r\n if(result === NULL) continue\r\n if(result._score < threshold) continue\r\n\r\n push_result(result)\r\n }\r\n }\r\n\r\n if(resultsLen === 0) return noResults\r\n var results = new Array(resultsLen)\r\n for(var i = resultsLen - 1; i >= 0; --i) results[i] = q.poll()\r\n results.total = resultsLen + limitedCount\r\n return results\r\n }\r\n\r\n\r\n // this is written as 1 function instead of 2 for minification. perf seems fine ...\r\n // except when minified. the perf is very slow\r\n var highlight = (result, open='<b>', close='</b>') => {\r\n var callback = typeof open === 'function' ? open : undefined\r\n\r\n var target = result.target\r\n var targetLen = target.length\r\n var indexes = result.indexes\r\n var highlighted = ''\r\n var matchI = 0\r\n var indexesI = 0\r\n var opened = false\r\n var parts = []\r\n\r\n for(var i = 0; i < targetLen; ++i) { var char = target[i]\r\n if(indexes[indexesI] === i) {\r\n ++indexesI\r\n if(!opened) { opened = true\r\n if(callback) {\r\n parts.push(highlighted); highlighted = ''\r\n } else {\r\n highlighted += open\r\n }\r\n }\r\n\r\n if(indexesI === indexes.length) {\r\n if(callback) {\r\n highlighted += char\r\n parts.push(callback(highlighted, matchI++)); highlighted = ''\r\n parts.push(target.substr(i+1))\r\n } else {\r\n highlighted += char + close + target.substr(i+1)\r\n }\r\n break\r\n }\r\n } else {\r\n if(opened) { opened = false\r\n if(callback) {\r\n parts.push(callback(highlighted, matchI++)); highlighted = ''\r\n } else {\r\n highlighted += close\r\n }\r\n }\r\n }\r\n highlighted += char\r\n }\r\n\r\n return callback ? parts : highlighted\r\n }\r\n\r\n\r\n var prepare = (target) => {\r\n if(typeof target === 'number') target = ''+target\r\n else if(typeof target !== 'string') target = ''\r\n var info = prepareLowerInfo(target)\r\n return new_result(target, {_targetLower:info._lower, _targetLowerCodes:info.lowerCodes, _bitflags:info.bitflags})\r\n }\r\n\r\n var cleanup = () => { preparedCache.clear(); preparedSearchCache.clear() }\r\n\r\n\r\n // Below this point is only internal code\r\n // Below this point is only internal code\r\n // Below this point is only internal code\r\n // Below this point is only internal code\r\n\r\n\r\n class Result {\r\n get ['indexes']() { return this._indexes.slice(0, this._indexes.len).sort((a,b)=>a-b) }\r\n set ['indexes'](indexes) { return this._indexes = indexes }\r\n ['highlight'](open, close) { return highlight(this, open, close) }\r\n get ['score']() { return normalizeScore(this._score) }\r\n set ['score'](score) { this._score = denormalizeScore(score) }\r\n }\r\n\r\n class KeysResult extends Array {\r\n get ['score']() { return normalizeScore(this._score) }\r\n set ['score'](score) { this._score = denormalizeScore(score) }\r\n }\r\n\r\n var new_result = (target, options) => {\r\n const result = new Result()\r\n result['target'] = target\r\n result['obj'] = options.obj ?? NULL\r\n result._score = options._score ?? NEGATIVE_INFINITY\r\n result._indexes = options._indexes ?? []\r\n result._targetLower = options._targetLower ?? ''\r\n result._targetLowerCodes = options._targetLowerCodes ?? NULL\r\n result._nextBeginningIndexes = options._nextBeginningIndexes ?? NULL\r\n result._bitflags = options._bitflags ?? 0\r\n return result\r\n }\r\n\r\n\r\n var normalizeScore = score => {\r\n if(score === NEGATIVE_INFINITY) return 0\r\n if(score > 1) return score\r\n return Math.E ** ( ((-score + 1)**.04307 - 1) * -2)\r\n }\r\n var denormalizeScore = normalizedScore => {\r\n if(normalizedScore === 0) return NEGATIVE_INFINITY\r\n if(normalizedScore > 1) return normalizedScore\r\n return 1 - Math.pow((Math.log(normalizedScore) / -2 + 1), 1 / 0.04307)\r\n }\r\n\r\n\r\n var prepareSearch = (search) => {\r\n if(typeof search === 'number') search = ''+search\r\n else if(typeof search !== 'string') search = ''\r\n search = search.trim()\r\n var info = prepareLowerInfo(search)\r\n\r\n var spaceSearches = []\r\n if(info.containsSpace) {\r\n var searches = search.split(/\\s+/)\r\n searches = [...new Set(searches)] // distinct\r\n for(var i=0; i<searches.length; i++) {\r\n if(searches[i] === '') continue\r\n var _info = prepareLowerInfo(searches[i])\r\n spaceSearches.push({lowerCodes:_info.lowerCodes, _lower:searches[i].toLowerCase(), containsSpace:false})\r\n }\r\n }\r\n\r\n return {lowerCodes: info.lowerCodes, _lower: info._lower, containsSpace: info.containsSpace, bitflags: info.bitflags, spaceSearches: spaceSearches}\r\n }\r\n\r\n\r\n\r\n var getPrepared = (target) => {\r\n if(target.length > 999) return prepare(target) // don't cache huge targets\r\n var targetPrepared = preparedCache.get(target)\r\n if(targetPrepared !== undefined) return targetPrepared\r\n targetPrepared = prepare(target)\r\n preparedCache.set(target, targetPrepared)\r\n return targetPrepared\r\n }\r\n var getPreparedSearch = (search) => {\r\n if(search.length > 999) return prepareSearch(search) // don't cache huge searches\r\n var searchPrepared = preparedSearchCache.get(search)\r\n if(searchPrepared !== undefined) return searchPrepared\r\n searchPrepared = prepareSearch(search)\r\n preparedSearchCache.set(search, searchPrepared)\r\n return searchPrepared\r\n }\r\n\r\n\r\n var all = (targets, options) => {\r\n var results = []; results.total = targets.length // this total can be wrong if some targets are skipped\r\n\r\n var limit = options?.limit || INFINITY\r\n\r\n if(options?.key) {\r\n for(var i=0;i<targets.length;i++) { var obj = targets[i]\r\n var target = getValue(obj, options.key)\r\n if(target == NULL) continue\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n var result = new_result(target.target, {_score: target._score, obj: obj})\r\n results.push(result); if(results.length >= limit) return results\r\n }\r\n } else if(options?.keys) {\r\n for(var i=0;i<targets.length;i++) { var obj = targets[i]\r\n var objResults = new KeysResult(options.keys.length)\r\n for (var keyI = options.keys.length - 1; keyI >= 0; --keyI) {\r\n var target = getValue(obj, options.keys[keyI])\r\n if(!target) { objResults[keyI] = noTarget; continue }\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n target._score = NEGATIVE_INFINITY\r\n target._indexes.len = 0\r\n objResults[keyI] = target\r\n }\r\n objResults.obj = obj\r\n objResults._score = NEGATIVE_INFINITY\r\n results.push(objResults); if(results.length >= limit) return results\r\n }\r\n } else {\r\n for(var i=0;i<targets.length;i++) { var target = targets[i]\r\n if(target == NULL) continue\r\n if(!isPrepared(target)) target = getPrepared(target)\r\n target._score = NEGATIVE_INFINITY\r\n target._indexes.len = 0\r\n results.push(target); if(results.length >= limit) return results\r\n }\r\n }\r\n\r\n return results\r\n }\r\n\r\n\r\n var algorithm = (preparedSearch, prepared, allowSpaces=false, allowPartialMatch=false) => {\r\n if(allowSpaces===false && preparedSearch.containsSpace) return algorithmSpaces(preparedSearch, prepared, allowPartialMatch)\r\n\r\n var searchLower = preparedSearch._lower\r\n var searchLowerCodes = preparedSearch.lowerCodes\r\n var searchLowerCode = searchLowerCodes[0]\r\n var targetLowerCodes = prepared._targetLowerCodes\r\n var searchLen = searchLowerCodes.length\r\n var targetLen = targetLowerCodes.length\r\n var searchI = 0 // where we at\r\n var targetI = 0 // where you at\r\n var matchesSimpleLen = 0\r\n\r\n // very basic fuzzy match; to remove non-matching targets ASAP!\r\n // walk through target. find sequential matches.\r\n // if all chars aren't found then exit\r\n for(;;) {\r\n var isMatch = searchLowerCode === targetLowerCodes[targetI]\r\n if(isMatch) {\r\n matchesSimple[matchesSimpleLen++] = targetI\r\n ++searchI; if(searchI === searchLen) break\r\n searchLowerCode = searchLowerCodes[searchI]\r\n }\r\n ++targetI; if(targetI >= targetLen) return NULL // Failed to find searchI\r\n }\r\n\r\n var searchI = 0\r\n var successStrict = false\r\n var matchesStrictLen = 0\r\n\r\n var nextBeginningIndexes = prepared._nextBeginningIndexes\r\n if(nextBeginningIndexes === NULL) nextBeginningIndexes = prepared._nextBeginningIndexes = prepareNextBeginningIndexes(prepared.target)\r\n targetI = matchesSimple[0]===0 ? 0 : nextBeginningIndexes[matchesSimple[0]-1]\r\n\r\n // Our target string successfully matched all characters in sequence!\r\n // Let's try a more advanced and strict test to improve the score\r\n // only count it as a match if it's consecutive or a beginning character!\r\n var backtrackCount = 0\r\n if(targetI !== targetLen) for(;;) {\r\n if(targetI >= targetLen) {\r\n // We failed to find a good spot for this search char, go back to the previous search char and force it forward\r\n if(searchI <= 0) break // We failed to push chars forward for a better match\r\n\r\n ++backtrackCount; if(backtrackCount > 200) break // exponential backtracking is taking too long, just give up and return a bad match\r\n\r\n --searchI\r\n var lastMatch = matchesStrict[--matchesStrictLen]\r\n targetI = nextBeginningIndexes[lastMatch]\r\n\r\n } else {\r\n var isMatch = searchLowerCodes[searchI] === targetLowerCodes[targetI]\r\n if(isMatch) {\r\n matchesStrict[matchesStrictLen++] = targetI\r\n ++searchI; if(searchI === searchLen) { successStrict = true; break }\r\n ++targetI\r\n } else {\r\n targetI = nextBeginningIndexes[targetI]\r\n }\r\n }\r\n }\r\n\r\n // check if it's a substring match\r\n var substringIndex = searchLen <= 1 ? -1 : prepared._targetLower.indexOf(searchLower, matchesSimple[0]) // perf: this is slow\r\n var isSubstring = !!~substringIndex\r\n var isSubstringBeginning = !isSubstring ? false : substringIndex===0 || prepared._nextBeginningIndexes[substringIndex-1] === substringIndex\r\n\r\n // if it's a substring match but not at a beginning index, let's try to find a substring starting at a beginning index for a better score\r\n if(isSubstring && !isSubstringBeginning) {\r\n for(var i=0; i<nextBeginningIndexes.length; i=nextBeginningIndexes[i]) {\r\n if(i <= substringIndex) continue\r\n\r\n for(var s=0; s<searchLen; s++) if(searchLowerCodes[s] !== prepared._targetLowerCodes[i+s]) break\r\n if(s === searchLen) { substringIndex = i; isSubstringBeginning = true; break }\r\n }\r\n }\r\n\r\n // tally up the score & keep track of matches for highlighting later\r\n // if it's a simple match, we'll switch to a substring match if a substring exists\r\n // if it's a strict match, we'll switch to a substring match only if that's a better score\r\n\r\n var calculateScore = matches => {\r\n var score = 0\r\n\r\n var extraMatchGroupCount = 0\r\n for(var i = 1; i < searchLen; ++i) {\r\n if(matches[i] - matches[i-1] !== 1) {score -= matches[i]; ++extraMatchGroupCount}\r\n }\r\n var unmatchedDistance = matches[searchLen-1] - matches[0] - (searchLen-1)\r\n\r\n score -= (12+unmatchedDistance) * extraMatchGroupCount // penality for more groups\r\n\r\n if(matches[0] !== 0) score -= matches[0]*matches[0]*.2 // penality for not starting near the beginning\r\n\r\n if(!successStrict) {\r\n score *= 1000\r\n } else {\r\n // successStrict on a target with too many beginning indexes loses points for being a bad target\r\n var uniqueBeginningIndexes = 1\r\n for(var i = nextBeginningIndexes[0]; i < targetLen; i=nextBeginningIndexes[i]) ++uniqueBeginningIndexes\r\n\r\n if(uniqueBeginningIndexes > 24) score *= (uniqueBeginningIndexes-24)*10 // quite arbitrary numbers here ...\r\n }\r\n\r\n score -= (targetLen - searchLen)/2 // penality for longer targets\r\n\r\n if(isSubstring) score /= 1+searchLen*searchLen*1 // bonus for being a full substring\r\n if(isSubstringBeginning) score /= 1+searchLen*searchLen*1 // bonus for substring starting on a beginningIndex\r\n\r\n score -= (targetLen - searchLen)/2 // penality for longer targets\r\n\r\n return score\r\n }\r\n\r\n if(!successStrict) {\r\n if(isSubstring) for(var i=0; i<searchLen; ++i) matchesSimple[i] = substringIndex+i // at this point it's safe to overwrite matchehsSimple with substr matches\r\n var matchesBest = matchesSimple\r\n var score = calculateScore(matchesBest)\r\n } else {\r\n if(isSubstringBeginning) {\r\n for(var i=0; i<searchLen; ++i) matchesSimple[i] = substringIndex+i // at this point it's safe to overwrite matchehsSimple with substr matches\r\n var matchesBest = matchesSimple\r\n var score = calculateScore(matchesSimple)\r\n } else {\r\n var matchesBest = matchesStrict\r\n var score = calculateScore(matchesStrict)\r\n }\r\n }\r\n\r\n prepared._score = score\r\n\r\n for(var i = 0; i < searchLen; ++i) prepared._indexes[i] = matchesBest[i]\r\n prepared._indexes.len = searchLen\r\n\r\n const result = new Result()\r\n result.target = prepared.target\r\n result._score = prepared._score\r\n result._indexes = prepared._indexes\r\n return result\r\n }\r\n var algorithmSpaces = (preparedSearch, target, allowPartialMatch) => {\r\n var seen_indexes = new Set()\r\n var score = 0\r\n var result = NULL\r\n\r\n var first_seen_index_last_search = 0\r\n var searches = preparedSearch.spaceSearches\r\n var searchesLen = searches.length\r\n var changeslen = 0\r\n\r\n // Return _nextBeginningIndexes back to its normal state\r\n var resetNextBeginningIndexes = () => {\r\n for(let i=changeslen-1; i>=0; i--) target._nextBeginningIndexes[nextBeginningIndexesChanges[i*2 + 0]] = nextBeginningIndexesChanges[i*2 + 1]\r\n }\r\n\r\n var hasAtLeast1Match = false\r\n for(var i=0; i<searchesLen; ++i) {\r\n allowPartialMatchScores[i] = NEGATIVE_INFINITY\r\n var search = searches[i]\r\n\r\n result = algorithm(search, target)\r\n if(allowPartialMatch) {\r\n if(result === NULL) continue\r\n hasAtLeast1Match = true\r\n } else {\r\n if(result === NULL) {resetNextBeginningIndexes(); return NULL}\r\n }\r\n\r\n // if not the last search, we need to mutate _nextBeginningIndexes for the next search\r\n var isTheLastSearch = i === searchesLen - 1\r\n if(!isTheLastSearch) {\r\n var indexes = result._indexes\r\n\r\n var indexesIsConsecutiveSubstring = true\r\n for(let i=0; i<indexes.len-1; i++) {\r\n if(indexes[i+1] - indexes[i] !== 1) {\r\n indexesIsConsecutiveSubstring = false; break;\r\n }\r\n }\r\n\r\n if(indexesIsConsecutiveSubstring) {\r\n var newBeginningIndex = indexes[indexes.len-1] + 1\r\n var toReplace = target._nextBeginningIndexes[newBeginningIndex-1]\r\n for(let i=newBeginningIndex-1; i>=0; i--) {\r\n if(toReplace !== target._nextBeginningIndexes[i]) break\r\n target._nextBeginningIndexes[i] = newBeginningIndex\r\n nextBeginningIndexesChanges[changeslen*2 + 0] = i\r\n nextBeginningIndexesChanges[changeslen*2 + 1] = toReplace\r\n changeslen++\r\n }\r\n }\r\n }\r\n\r\n score += result._score / searchesLen\r\n allowPartialMatchScores[i] = result._score / searchesLen\r\n\r\n // dock points based on order otherwise \"c man\" returns Manifest.cpp instead of CheatManager.h\r\n if(result._indexes[0] < first_seen_index_last_search) {\r\n score -= (first_seen_index_last_search - result._indexes[0]) * 2\r\n }\r\n first_seen_index_last_search = result._indexes[0]\r\n\r\n for(var j=0; j<result._indexes.len; ++j) seen_indexes.add(result._indexes[j])\r\n }\r\n\r\n if(allowPartialMatch && !hasAtLeast1Match) return NULL\r\n\r\n resetNextBeginningIndexes()\r\n\r\n // allows a search with spaces that's an exact substring to score well\r\n var allowSpacesResult = algorithm(preparedSearch, target, /*allowSpaces=*/true)\r\n if(allowSpacesResult !== NULL && allowSpacesResult._score > score) {\r\n if(allowPartialMatch) {\r\n for(var i=0; i<searchesLen; ++i) {\r\n allowPartialMatchScores[i] = allowSpacesResult._score / searchesLen\r\n }\r\n }\r\n return allowSpacesResult\r\n }\r\n\r\n if(allowPartialMatch) result = target\r\n result._score = score\r\n\r\n var i = 0\r\n for (let index of seen_indexes) result._indexes[i++] = index\r\n result._indexes.len = i\r\n\r\n return result\r\n }\r\n\r\n // we use this instead of just .normalize('NFD').replace(/[\\u0300-\\u036f]/g, '') because that screws with japanese characters\r\n var remove_accents = (str) => str.replace(/\\p{Script=Latin}+/gu, match => match.normalize('NFD')).replace(/[\\u0300-\\u036f]/g, '')\r\n\r\n var prepareLowerInfo = (str) => {\r\n str = remove_accents(str)\r\n var strLen = str.length\r\n var lower = str.toLowerCase()\r\n var lowerCodes = [] // new Array(strLen) sparse array is too slow\r\n var bitflags = 0\r\n var containsSpace = false // space isn't stored in bitflags because of how searching with a space works\r\n\r\n for(var i = 0; i < strLen; ++i) {\r\n var lowerCode = lowerCodes[i] = lower.charCodeAt(i)\r\n\r\n if(lowerCode === 32) {\r\n containsSpace = true\r\n continue // it's important that we don't set any bitflags for space\r\n }\r\n\r\n var bit = lowerCode>=97&&lowerCode<=122 ? lowerCode-97 // alphabet\r\n : lowerCode>=48&&lowerCode<=57 ? 26 // numbers\r\n // 3 bits available\r\n : lowerCode<=127 ? 30 // other ascii\r\n : 31 // other utf8\r\n bitflags |= 1<<bit\r\n }\r\n\r\n return {lowerCodes:lowerCodes, bitflags:bitflags, containsSpace:containsSpace, _lower:lower}\r\n }\r\n var prepareBeginningIndexes = (target) => {\r\n var targetLen = target.length\r\n var beginningIndexes = []; var beginningIndexesLen = 0\r\n var wasUpper = false\r\n var wasAlphanum = false\r\n for(var i = 0; i < targetLen; ++i) {\r\n var targetCode = target.charCodeAt(i)\r\n var isUpper = targetCode>=65&&targetCode<=90\r\n var isAlphanum = isUpper || targetCode>=97&&targetCode<=122 || targetCode>=48&&targetCode<=57\r\n var isBeginning = isUpper && !wasUpper || !wasAlphanum || !isAlphanum\r\n wasUpper = isUpper\r\n wasAlphanum = isAlphanum\r\n if(isBeginning) beginningIndexes[beginningIndexesLen++] = i\r\n }\r\n return beginningIndexes\r\n }\r\n var prepareNextBeginningIndexes = (target) => {\r\n target = remove_accents(target)\r\n var targetLen = target.length\r\n var beginningIndexes = prepareBeginningIndexes(target)\r\n var nextBeginningIndexes = [] // new Array(targetLen) sparse array is too slow\r\n var lastIsBeginning = beginningIndexes[0]\r\n var lastIsBeginningI = 0\r\n for(var i = 0; i < targetLen; ++i) {\r\n if(lastIsBeginning > i) {\r\n nextBeginningIndexes[i] = lastIsBeginning\r\n } else {\r\n lastIsBeginning = beginningIndexes[++lastIsBeginningI]\r\n nextBeginningIndexes[i] = lastIsBeginning===undefined ? targetLen : lastIsBeginning\r\n }\r\n }\r\n return nextBeginningIndexes\r\n }\r\n\r\n var preparedCache = new Map()\r\n var preparedSearchCache = new Map()\r\n\r\n // the theory behind these being globals is to reduce garbage collection by not making new arrays\r\n var matchesSimple = []; var matchesStrict = []\r\n var nextBeginningIndexesChanges = [] // allows straw berry to match strawberry well, by modifying the end of a substring to be considered a beginning index for the rest of the search\r\n var keysSpacesBestScores = []; var allowPartialMatchScores = []\r\n var tmpTargets = []; var tmpResults = []\r\n\r\n // prop = 'key' 2.5ms optimized for this case, seems to be about as fast as direct obj[prop]\r\n // prop = 'key1.key2' 10ms\r\n // prop = ['key1', 'key2'] 27ms\r\n // prop = obj => obj.tags.join() ??ms\r\n var getValue = (obj, prop) => {\r\n var tmp = obj[prop]; if(tmp !== undefined) return tmp\r\n if(typeof prop === 'function') return prop(obj) // this should run first. but that makes string props slower\r\n var segs = prop\r\n if(!Array.isArray(prop)) segs = prop.split('.')\r\n var len = segs.length\r\n var i = -1\r\n while (obj && (++i < len)) obj = obj[segs[i]]\r\n return obj\r\n }\r\n\r\n var isPrepared = (x) => { return typeof x === 'object' && typeof x._bitflags === 'number' }\r\n var INFINITY = Infinity; var NEGATIVE_INFINITY = -INFINITY\r\n var noResults = []; noResults.total = 0\r\n var NULL = null\r\n\r\n var noTarget = prepare('')\r\n\r\n // Hacked version of https://github.com/lemire/FastPriorityQueue.js\r\n var fastpriorityqueue=r=>{var e=[],o=0,a={},v=r=>{for(var a=0,v=e[a],c=1;c<o;){var s=c+1;a=c,s<o&&e[s]._score<e[c]._score&&(a=s),e[a-1>>1]=e[a],c=1+(a<<1)}for(var f=a-1>>1;a>0&&v._score<e[f]._score;f=(a=f)-1>>1)e[a]=e[f];e[a]=v};return a.add=(r=>{var a=o;e[o++]=r;for(var v=a-1>>1;a>0&&r._score<e[v]._score;v=(a=v)-1>>1)e[a]=e[v];e[a]=r}),a.poll=(r=>{if(0!==o){var a=e[0];return e[0]=e[--o],v(),a}}),a.peek=(r=>{if(0!==o)return e[0]}),a.replaceTop=(r=>{e[0]=r,v()}),a}\r\n var q = fastpriorityqueue() // reuse this\r\n\r\n // fuzzysort is written this way for minification. all names are mangeled unless quoted\r\n return {'single':single, 'go':go, 'prepare':prepare, 'cleanup':cleanup}\r\n}) // UMD\r\n",
30
- "import commander from './index.js';\n\n// wrapper to provide named exports for ESM.\nexport const {\n program,\n createCommand,\n createArgument,\n createOption,\n CommanderError,\n InvalidArgumentError,\n InvalidOptionArgumentError, // deprecated old name\n Command,\n Argument,\n Option,\n Help,\n} = commander;\n",
31
- "/**\n * OCX CLI - add command\n * Install components from registries\n */\n\nimport { randomUUID } from \"node:crypto\"\nimport { existsSync } from \"node:fs\"\nimport { lstat, mkdir, rename, rm, stat, writeFile } from \"node:fs/promises\"\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\"\n\nimport type { Command } from \"commander\"\nimport type { ConfigProvider } from \"../config/provider\"\nimport { GlobalConfigProvider, LocalConfigProvider } from \"../config/provider\"\nimport { ConfigResolver } from \"../config/resolver\"\nimport { CLI_VERSION, GITHUB_REPO } from \"../constants\"\nimport { getProfileDir } from \"../profile/paths\"\nimport { fetchFileContent, fetchRegistryIndex } from \"../registry/fetcher\"\nimport type { ResolvedComponent } from \"../registry/resolver\"\nimport { resolveDependencies } from \"../registry/resolver\"\nimport {\n\tcreateCanonicalId,\n\tfindReceipt,\n\ttype Receipt,\n\treadReceipt,\n\twriteReceipt,\n} from \"../schemas/config\"\nimport type { ComponentFileObject, RegistryIndex } from \"../schemas/registry\"\nimport { parseQualifiedComponent } from \"../schemas/registry\"\nimport {\n\tfindOpencodeConfig,\n\treadOpencodeJsonConfig,\n\tupdateOpencodeJsonConfig,\n} from \"../updaters/update-opencode-config\"\nimport { isContentIdentical } from \"../utils/content\"\nimport {\n\tbuildInvalidationDryRunAction,\n\tcomputeDependencyDelta,\n\ttype DepUpdateResult,\n\tinvalidateNodeModules,\n} from \"../utils/dep-invalidation\"\nimport { type DryRunAction, type DryRunResult, outputDryRun } from \"../utils/dry-run\"\nimport { ConfigError, ConflictError, IntegrityError, ValidationError } from \"../utils/errors\"\nimport {\n\tcollectCompatIssues,\n\tcreateSpinner,\n\thandleError,\n\tlogger,\n\tnormalizeRegistryUrl,\n\twarnCompatIssues,\n} from \"../utils/index\"\nimport { outputJson } from \"../utils/json-output\"\nimport {\n\textractPackageName,\n\tfetchPackageVersion,\n\tformatPluginEntry,\n\tisNpmSpecifier,\n\tparseNpmSpecifier,\n\tvalidateNpmPackage,\n\tvalidateOpenCodePlugin,\n} from \"../utils/npm-registry\"\nimport { PathValidationError, validatePath } from \"../utils/path-security\"\nimport { resolveTargetPath } from \"../utils/paths\"\nimport { registerPlannedWriteOrThrow } from \"../utils/planned-writes\"\nimport { hashBundle, hashContent } from \"../utils/receipt\"\nimport { addCommonOptions, addGlobalOption, addVerboseOption } from \"../utils/shared-options\"\n\n// =============================================================================\n// HELPER FUNCTIONS\n// =============================================================================\n\n/**\n * Find the component that owns a given file path in the receipt.\n * Returns the component's canonical ID or null if not found.\n *\n * @param receipt - The receipt to search\n * @param filePath - The file path to look up (resolved target path)\n * @returns Canonical ID if found, null otherwise\n */\nfunction findOwningComponent(receipt: Receipt | null, filePath: string): string | null {\n\t// Guard: no receipt or empty installed map\n\tif (!receipt?.installed) return null\n\n\t// Search all installed components for the file\n\tfor (const [canonicalId, entry] of Object.entries(receipt.installed)) {\n\t\tif (entry.files?.some((f) => f.path === filePath)) {\n\t\t\treturn canonicalId\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * Extract a human-readable component name from a canonical ID.\n * Canonical ID format: \"registryUrl::alias/component@revision\"\n *\n * @param canonicalId - The canonical ID to parse\n * @returns Component name in \"alias/component\" format\n */\nfunction extractComponentName(canonicalId: string): string {\n\t// Parse canonical ID: registryUrl::alias/component@revision\n\tconst afterDelimiter = canonicalId.split(\"::\")[1]\n\tif (!afterDelimiter) return canonicalId // Fallback to full ID\n\n\t// Extract alias/component (before @)\n\tconst beforeVersion = afterDelimiter.split(\"@\")[0]\n\treturn beforeVersion || canonicalId // Fallback to full ID\n}\n\n// =============================================================================\n// ADD INPUT TYPES (Discriminated Union)\n// =============================================================================\n\n/**\n * Parsed add input - discriminated union for type-safe routing.\n * Parsed at the boundary (Law 2: Parse Don't Validate).\n */\nexport type AddInput =\n\t| { type: \"npm\"; name: string; version?: string }\n\t| { type: \"registry\"; namespace: string; component: string; version?: string }\n\n/**\n * Parse a component input string into a typed AddInput.\n * Routes between npm: protocol and registry component references.\n *\n * @throws ValidationError for invalid input format\n */\nexport function parseAddInput(input: string): AddInput {\n\t// Guard: empty input\n\tif (!input?.trim()) {\n\t\tthrow new ValidationError(\"Component name cannot be empty\")\n\t}\n\n\tconst trimmed = input.trim()\n\n\t// Route npm: specifiers\n\tif (isNpmSpecifier(trimmed)) {\n\t\tconst parsed = parseNpmSpecifier(trimmed)\n\t\treturn { type: \"npm\", name: parsed.name, version: parsed.version }\n\t}\n\n\t// Route registry components\n\t// Check if it's a qualified reference (alias/component)\n\tif (trimmed.includes(\"/\")) {\n\t\tconst { namespace, component } = parseQualifiedComponent(trimmed)\n\t\treturn { type: \"registry\", namespace, component }\n\t}\n\n\t// Bare component name - needs registry resolution\n\t// For now, treat as registry component without alias\n\t// The resolver will handle alias inference from config\n\treturn { type: \"registry\", namespace: \"\", component: trimmed }\n}\n\nexport interface AddOptions {\n\tdryRun?: boolean\n\tcwd?: string\n\tquiet?: boolean\n\tverbose?: boolean\n\tjson?: boolean\n\tskipCompatCheck?: boolean\n\ttrust?: boolean\n\tglobal?: boolean\n\tprofile?: string\n\tfrom?: string\n}\n\ninterface NpmAddResult {\n\tplugins: string[]\n\tdryRun: boolean\n}\n\ninterface RegistryAddResult {\n\tinstalled: string[]\n\topencode: boolean\n\tdryRun: boolean\n}\n\ninterface AppliedAddWrite {\n\ttargetPath: string\n\tbackupPath: string | null\n}\n\ninterface AddWriteTransaction {\n\twriteFileAtomically: (params: {\n\t\ttargetPath: string\n\t\tresolvedTarget: string\n\t\tcontent: Buffer\n\t}) => Promise<void>\n\trollback: () => Promise<void>\n\tcommit: () => Promise<void>\n}\n\ninterface AddManifestSideEffectTransaction {\n\trollback: () => Promise<void>\n\tcommit: () => void\n}\n\ninterface FileSnapshot {\n\tpath: string\n\texisted: boolean\n\tcontent: string\n}\n\nexport function registerAddCommand(program: Command): void {\n\tconst cmd = program\n\t\t.command(\"add\")\n\t\t.description(\n\t\t\t\"Add components or npm plugins to your project.\\n\\n\" +\n\t\t\t\t\" Registry components: ocx add alias/component\\n\" +\n\t\t\t\t\" npm plugins: ocx add npm:package-name[@version]\",\n\t\t)\n\t\t.argument(\"<components...>\", \"Components to install (alias/component or npm:package[@version])\")\n\t\t.option(\"--dry-run\", \"Show what would be installed without making changes\")\n\t\t.option(\"--skip-compat-check\", \"Skip version compatibility checks\")\n\t\t.option(\"--trust\", \"Skip npm plugin validation (for packages that don't follow conventions)\")\n\t\t.option(\"-p, --profile <name>\", \"Use specific profile\")\n\t\t.option(\"--from <url>\", \"Use ephemeral registry (does not persist)\")\n\n\taddCommonOptions(cmd)\n\taddVerboseOption(cmd)\n\taddGlobalOption(cmd)\n\n\tcmd.action(async (components: string[], options: AddOptions) => {\n\t\ttry {\n\t\t\tconst runtimeOptions = options.json ? { ...options, quiet: true, verbose: false } : options\n\n\t\t\t// Create appropriate provider based on flags\n\t\t\tlet provider: ConfigProvider\n\n\t\t\tif (runtimeOptions.profile) {\n\t\t\t\t// Use ConfigResolver with profile - cwd is the profile directory\n\t\t\t\tconst resolver = await ConfigResolver.create(runtimeOptions.cwd ?? process.cwd(), {\n\t\t\t\t\tprofile: runtimeOptions.profile,\n\t\t\t\t})\n\t\t\t\t// Profile mode: install to profile directory, not working directory\n\t\t\t\tconst profileDir = getProfileDir(runtimeOptions.profile)\n\t\t\t\tprovider = {\n\t\t\t\t\tcwd: profileDir,\n\t\t\t\t\tgetRegistries: () => resolver.getRegistries(),\n\t\t\t\t\tgetComponentPath: () => resolver.getComponentPath(),\n\t\t\t\t}\n\t\t\t} else if (runtimeOptions.global) {\n\t\t\t\tprovider = await GlobalConfigProvider.requireInitialized()\n\t\t\t} else {\n\t\t\t\tprovider = await LocalConfigProvider.requireInitialized(runtimeOptions.cwd ?? process.cwd())\n\t\t\t}\n\n\t\t\tawait runAddCore(components, runtimeOptions, provider)\n\t\t} catch (error) {\n\t\t\thandleError(error, { json: options.json })\n\t\t}\n\t})\n}\n\n/**\n * Core add logic that accepts a ConfigProvider.\n * This enables reuse across both standard and profile modes.\n *\n * Routes inputs to appropriate handlers:\n * - npm: specifiers -> handleNpmPlugins\n * - registry components -> existing registry flow\n */\nexport async function runAddCore(\n\tcomponentNames: string[],\n\toptions: AddOptions,\n\tprovider: ConfigProvider,\n): Promise<void> {\n\tconst cwd = provider.cwd\n\n\t// Parse all inputs at boundary (Law 2: Parse Don't Validate)\n\tconst parsedInputs = componentNames.map(parseAddInput)\n\n\t// Separate npm and registry inputs\n\tconst npmInputs = parsedInputs.filter((i): i is AddInput & { type: \"npm\" } => i.type === \"npm\")\n\tconst registryInputs = parsedInputs.filter(\n\t\t(i): i is AddInput & { type: \"registry\" } => i.type === \"registry\",\n\t)\n\n\tconst shouldAggregateJson = Boolean(\n\t\toptions.json && npmInputs.length > 0 && registryInputs.length > 0,\n\t)\n\tconst executionOptions = shouldAggregateJson\n\t\t? { ...options, json: false, quiet: true, verbose: false }\n\t\t: options\n\n\tlet npmResult: NpmAddResult | undefined\n\tlet registryResult: RegistryAddResult | undefined\n\n\t// Handle npm plugins first\n\tif (npmInputs.length > 0) {\n\t\tnpmResult = await handleNpmPlugins(npmInputs, executionOptions, cwd, !shouldAggregateJson)\n\t}\n\n\t// Handle registry components (existing flow)\n\tif (registryInputs.length > 0) {\n\t\t// Reconstruct component names for registry resolver\n\t\tconst registryComponentNames = registryInputs.map((i) =>\n\t\t\ti.namespace ? `${i.namespace}/${i.component}` : i.component,\n\t\t)\n\t\tregistryResult = await runRegistryAddCore(\n\t\t\tregistryComponentNames,\n\t\t\texecutionOptions,\n\t\t\tprovider,\n\t\t\t!shouldAggregateJson,\n\t\t)\n\t}\n\n\tif (shouldAggregateJson) {\n\t\toutputJson({\n\t\t\tsuccess: true,\n\t\t\tplugins: npmResult?.plugins ?? [],\n\t\t\tinstalled: registryResult?.installed ?? [],\n\t\t\topencode: registryResult?.opencode ?? false,\n\t\t\tdryRun: Boolean(npmResult?.dryRun || registryResult?.dryRun),\n\t\t})\n\t}\n}\n\n/**\n * Handle npm plugin additions.\n * Validates packages exist on npm and updates opencode.json plugin array.\n */\nasync function handleNpmPlugins(\n\tinputs: Array<{ type: \"npm\"; name: string; version?: string }>,\n\toptions: AddOptions,\n\tcwd: string,\n\temitJson = true,\n): Promise<NpmAddResult> {\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Validating npm packages...\" })\n\tspin?.start()\n\n\ttry {\n\t\tconst allWarnings: string[] = []\n\n\t\t// Validate all packages exist on npm registry and are valid OpenCode plugins\n\t\tfor (const input of inputs) {\n\t\t\t// Always validate package exists\n\t\t\tawait validateNpmPackage(input.name)\n\n\t\t\t// Skip plugin validation if --trust flag is set\n\t\t\tif (!options.trust) {\n\t\t\t\ttry {\n\t\t\t\t\tconst versionData = await fetchPackageVersion(input.name, input.version)\n\t\t\t\t\tconst result = validateOpenCodePlugin(versionData)\n\t\t\t\t\tallWarnings.push(...result.warnings)\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Enhance error with hints for ValidationError\n\t\t\t\t\tif (error instanceof ValidationError) {\n\t\t\t\t\t\tspin?.fail(\"Plugin validation failed\")\n\t\t\t\t\t\t// Wrap with hints - handleError will log this message\n\t\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t\t`${error.message}\\n` +\n\t\t\t\t\t\t\t\t`hint OpenCode plugins must be ESM modules with an entry point\\n` +\n\t\t\t\t\t\t\t\t`hint Use \\`--trust\\` to add anyway`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tspin?.succeed(`Validated ${inputs.length} npm package(s)`)\n\n\t\t// Show warnings for soft checks\n\t\tif (allWarnings.length > 0 && !options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tfor (const warning of allWarnings) {\n\t\t\t\tlogger.warn(warning)\n\t\t\t}\n\t\t}\n\n\t\t// Read existing opencode config\n\t\tconst existingConfig = await readOpencodeJsonConfig(cwd)\n\t\tconst existingPlugins: string[] = existingConfig?.config.plugin ?? []\n\n\t\t// Build a map of existing plugin names (without version) for conflict detection\n\t\tconst existingPluginMap = new Map<string, string>()\n\t\tfor (const plugin of existingPlugins) {\n\t\t\tconst name = extractPackageName(plugin)\n\t\t\texistingPluginMap.set(name, plugin)\n\t\t}\n\n\t\t// Check for conflicts and build new plugin list\n\t\tconst pluginsToAdd: string[] = []\n\t\tconst conflicts: string[] = []\n\n\t\tfor (const input of inputs) {\n\t\t\tconst existingEntry = existingPluginMap.get(input.name)\n\n\t\t\tif (existingEntry) {\n\t\t\t\t// Conflict: package already exists\n\t\t\t\tconflicts.push(input.name)\n\t\t\t} else {\n\t\t\t\t// New package\n\t\t\t\tpluginsToAdd.push(formatPluginEntry(input.name, input.version))\n\t\t\t}\n\t\t}\n\n\t\t// Fail fast on conflicts (Law 4)\n\t\tif (conflicts.length > 0) {\n\t\t\tthrow new ConflictError(\n\t\t\t\t`Plugin(s) already exist in opencode.json: ${conflicts.join(\", \")}.\\n` +\n\t\t\t\t\t\"Remove the existing entry manually or use 'ocx update' if it's an installed component.\",\n\t\t\t)\n\t\t}\n\n\t\t// Build final plugin array\n\t\tconst finalPlugins = [...existingPluginMap.values(), ...pluginsToAdd]\n\n\t\t// Dry run: just log what would happen\n\t\tif (options.dryRun) {\n\t\t\tconst actions: DryRunAction[] = inputs.map((input) => ({\n\t\t\t\taction: \"add\",\n\t\t\t\ttarget: formatPluginEntry(input.name, input.version),\n\t\t\t\tdetails: { type: \"npm plugin\" },\n\t\t\t}))\n\n\t\t\tconst dryRunResult: DryRunResult = {\n\t\t\t\tdryRun: true,\n\t\t\t\tcommand: \"add\",\n\t\t\t\twouldPerform: actions,\n\t\t\t\tvalidation: { passed: true },\n\t\t\t\tsummary: `Would add ${inputs.length} npm plugin(s)`,\n\t\t\t}\n\n\t\t\tif (emitJson || !options.json) {\n\t\t\t\toutputDryRun(dryRunResult, { json: options.json, quiet: options.quiet })\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tplugins: inputs.map((input) => formatPluginEntry(input.name, input.version)),\n\t\t\t\tdryRun: true,\n\t\t\t}\n\t\t}\n\n\t\t// Update opencode.json with new plugins\n\t\tawait updateOpencodeJsonConfig(cwd, { plugin: finalPlugins })\n\n\t\tif (!options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.success(`Added ${inputs.length} npm plugin(s) to opencode.json`)\n\t\t\tfor (const input of inputs) {\n\t\t\t\tlogger.info(` ✓ ${formatPluginEntry(input.name, input.version)}`)\n\t\t\t}\n\t\t}\n\n\t\tconst addedPlugins = inputs.map((input) => formatPluginEntry(input.name, input.version))\n\n\t\tif (options.json && emitJson) {\n\t\t\toutputJson({\n\t\t\t\tsuccess: true,\n\t\t\t\tplugins: addedPlugins,\n\t\t\t})\n\t\t}\n\n\t\treturn { plugins: addedPlugins, dryRun: false }\n\t} catch (error) {\n\t\tspin?.fail(\"Failed to add npm plugins\")\n\t\tthrow error\n\t}\n}\n\n/**\n * Registry component add logic (original runAddCore implementation).\n * Handles component installation from configured registries.\n */\nasync function runRegistryAddCore(\n\tcomponentNames: string[],\n\toptions: AddOptions,\n\tprovider: ConfigProvider,\n\temitJson = true,\n): Promise<RegistryAddResult> {\n\tconst suppressHumanOutput = Boolean(options.quiet || options.json)\n\tconst cwd = provider.cwd\n\t// V2: Determine if we're in flattened mode (profile/global vs local)\n\tconst isFlattened = !!(options.global || options.profile)\n\tconst registries = provider.getRegistries()\n\n\t// V2: Handle --from flag for ephemeral registry\n\tlet effectiveRegistries = registries\n\tif (options.from) {\n\t\t// Validate --from URL\n\t\tconst fromUrl = options.from.trim()\n\t\tif (!fromUrl) {\n\t\t\tthrow new ValidationError(\"--from URL cannot be empty\")\n\t\t}\n\n\t\t// Parse URL to validate format\n\t\ttry {\n\t\t\tnew URL(fromUrl)\n\t\t} catch {\n\t\t\tthrow new ValidationError(`Invalid --from URL: ${fromUrl}`)\n\t\t}\n\n\t\t// Parse component references to extract prefixes\n\t\tconst requestedPrefixes = new Set<string>()\n\t\tfor (const name of componentNames) {\n\t\t\tconst { namespace } = parseQualifiedComponent(name)\n\t\t\trequestedPrefixes.add(namespace)\n\t\t}\n\n\t\t// Validate all requested components use the same prefix\n\t\tif (requestedPrefixes.size > 1) {\n\t\t\tconst prefixes = Array.from(requestedPrefixes).join(\", \")\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Mixed registry prefixes in --from call: ${prefixes}.\\n` +\n\t\t\t\t\t`When using --from, all components must use the same prefix.`,\n\t\t\t)\n\t\t}\n\n\t\t// Use the single prefix as the ephemeral registry name\n\t\tconst ephemeralName = Array.from(requestedPrefixes)[0]\n\t\tif (!ephemeralName) {\n\t\t\tthrow new ValidationError(\"No valid component references provided\")\n\t\t}\n\n\t\t// Fetch registry index to validate the URL serves a valid registry (alias-first: ignore its namespace)\n\t\tawait fetchRegistryIndex(fromUrl)\n\n\t\t// Create ephemeral registry config (does not persist)\n\t\teffectiveRegistries = {\n\t\t\t...registries,\n\t\t\t[ephemeralName]: {\n\t\t\t\turl: fromUrl,\n\t\t\t},\n\t\t}\n\t}\n\n\t// V1: Load or create receipt\n\tlet receipt: Receipt = { version: 1, root: cwd, installed: {} }\n\tconst existingReceipt = await readReceipt(cwd)\n\tif (existingReceipt) {\n\t\treceipt = existingReceipt\n\t}\n\n\tconst spin = suppressHumanOutput ? null : createSpinner({ text: \"Resolving dependencies...\" })\n\tspin?.start()\n\tlet writeTransaction: AddWriteTransaction | null = null\n\tlet manifestSideEffectTransaction: AddManifestSideEffectTransaction | null = null\n\n\ttry {\n\t\t// Pre-validate registry indexes before resolution (fail fast on incompatible formats)\n\t\t// This catches legacy/incompatible registries before individual component fetches,\n\t\t// providing actionable errors instead of confusing packument parse failures.\n\t\tconst requestedRegistries = new Set<string>()\n\t\tfor (const name of componentNames) {\n\t\t\tconst { namespace } = parseQualifiedComponent(name)\n\t\t\trequestedRegistries.add(namespace)\n\t\t}\n\n\t\tfor (const registryAlias of requestedRegistries) {\n\t\t\tconst registryConfig = effectiveRegistries[registryAlias]\n\t\t\tif (registryConfig) {\n\t\t\t\tawait fetchRegistryIndex(registryConfig.url)\n\t\t\t}\n\t\t}\n\n\t\t// Resolve all dependencies across all configured registries\n\t\tconst resolved = await resolveDependencies(effectiveRegistries, componentNames)\n\n\t\tif (options.verbose) {\n\t\t\tlogger.info(\"Install order:\")\n\t\t\tfor (const name of resolved.installOrder) {\n\t\t\t\tlogger.info(` - ${name}`)\n\t\t\t}\n\t\t}\n\n\t\t// Fetch registry indexes once (Law 2: Parse at boundary)\n\t\tconst registryIndexes = new Map<string, RegistryIndex>()\n\t\tconst uniqueBaseUrls = new Map<string, string>() // alias -> baseUrl\n\n\t\tfor (const component of resolved.components) {\n\t\t\tif (!uniqueBaseUrls.has(component.registryName)) {\n\t\t\t\tuniqueBaseUrls.set(component.registryName, component.baseUrl)\n\t\t\t}\n\t\t}\n\n\t\tfor (const [namespace, baseUrl] of uniqueBaseUrls) {\n\t\t\tconst index = await fetchRegistryIndex(baseUrl)\n\t\t\tregistryIndexes.set(namespace, index)\n\t\t}\n\n\t\tspin?.succeed(\n\t\t\t`Resolved ${resolved.components.length} components from ${registryIndexes.size} registries`,\n\t\t)\n\n\t\t// Version compatibility check (skip if disabled via flag)\n\t\tconst skipCompat = options.skipCompatCheck\n\t\tif (!skipCompat && !suppressHumanOutput) {\n\t\t\tfor (const [namespace, index] of registryIndexes) {\n\t\t\t\tconst issues = collectCompatIssues({\n\t\t\t\t\tregistry: { opencode: index.opencode, ocx: index.ocx },\n\t\t\t\t\tocxVersion: CLI_VERSION,\n\t\t\t\t})\n\t\t\t\twarnCompatIssues(namespace, issues)\n\t\t\t}\n\t\t}\n\n\t\tif (options.dryRun) {\n\t\t\tconst actions: DryRunAction[] = resolved.components.map((component) => ({\n\t\t\t\taction: \"add\",\n\t\t\t\ttarget: `${component.registryName}/${component.name}`,\n\t\t\t\tdetails: { type: component.type },\n\t\t\t}))\n\n\t\t\t// Add planned invalidation action if npm deps would change.\n\t\t\t// NOTE: This may over-report in the edge case where the declared deps\n\t\t\t// already match the existing package.json (no actual delta). This is\n\t\t\t// acceptable for dry-run — it signals intent rather than guaranteeing\n\t\t\t// change, and the real path uses computeDependencyDelta for precision.\n\t\t\tif (resolved.npmDependencies.length > 0 || resolved.npmDevDependencies.length > 0) {\n\t\t\t\tconst packageDir = options.global || options.profile ? cwd : join(cwd, \".opencode\")\n\t\t\t\tconst depNames = [...resolved.npmDependencies, ...resolved.npmDevDependencies]\n\t\t\t\tconst dryDeltaEntries = depNames.map((spec) => {\n\t\t\t\t\tconst lastAt = spec.lastIndexOf(\"@\")\n\t\t\t\t\tconst name = lastAt > 0 ? spec.slice(0, lastAt) : spec\n\t\t\t\t\tconst version = lastAt > 0 ? spec.slice(lastAt + 1) : \"*\"\n\t\t\t\t\treturn { name, from: null as string | null, to: version }\n\t\t\t\t})\n\t\t\t\tactions.push(buildInvalidationDryRunAction(packageDir, dryDeltaEntries))\n\t\t\t}\n\n\t\t\tconst dryRunResult: DryRunResult = {\n\t\t\t\tdryRun: true,\n\t\t\t\tcommand: \"add\",\n\t\t\t\twouldPerform: actions,\n\t\t\t\tvalidation: { passed: true },\n\t\t\t\tsummary: `Would add ${resolved.components.length} component(s)`,\n\t\t\t}\n\n\t\t\tif (emitJson || !options.json) {\n\t\t\t\toutputDryRun(dryRunResult, { json: options.json, quiet: options.quiet })\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tinstalled: resolved.installOrder,\n\t\t\t\topencode: Boolean(resolved.opencode),\n\t\t\t\tdryRun: true,\n\t\t\t}\n\t\t}\n\n\t\t// Phase 1: Fetch all files and perform pre-flight checks (Law 4: Fail Fast)\n\t\t// We check ALL conflicts BEFORE writing ANY files to ensure atomic behavior\n\t\tconst fetchSpin = suppressHumanOutput ? null : createSpinner({ text: \"Fetching components...\" })\n\t\tfetchSpin?.start()\n\n\t\tconst componentBundles: {\n\t\t\tcomponent: ResolvedComponent\n\t\t\tfiles: { path: string; content: Buffer }[]\n\t\t\tcomputedHash: string\n\t\t\tcanonicalId: string\n\t\t}[] = []\n\n\t\tfor (const component of resolved.components) {\n\t\t\t// Fetch component files and compute bundle hash\n\t\t\tconst files: { path: string; content: Buffer }[] = []\n\t\t\tfor (const file of component.files) {\n\t\t\t\tconst content = await fetchFileContent(component.baseUrl, component.name, file.path)\n\t\t\t\tfiles.push({ path: file.path, content: Buffer.from(content) })\n\t\t\t}\n\n\t\t\tconst computedHash = await hashBundle(files)\n\n\t\t\t// Layer 2 path safety: Verify all target paths are inside cwd (runtime containment)\n\t\t\tfor (const file of component.files) {\n\t\t\t\t// V2: Resolve target path based on mode (flattened vs local)\n\t\t\t\tconst resolvedTarget = resolveTargetPath(file.target, isFlattened, cwd)\n\t\t\t\tconst targetPath = join(cwd, resolvedTarget)\n\t\t\t\ttry {\n\t\t\t\t\tvalidatePath(cwd, resolvedTarget)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof PathValidationError) {\n\t\t\t\t\t\tthrow new ValidationError(`Invalid path \"${targetPath}\": ${error.message}`)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// V2: Check if already installed with canonical ID (use hash as revision)\n\t\t\t// Integrity check: Look for ANY existing entry for this component (any revision)\n\t\t\t// If found with different hash, fail - registry content changed unexpectedly\n\t\t\tconst existingEntries = Object.entries(receipt.installed).filter(\n\t\t\t\t([_id, entry]) =>\n\t\t\t\t\tnormalizeRegistryUrl(entry.registryUrl) === normalizeRegistryUrl(component.baseUrl) &&\n\t\t\t\t\tentry.registryName === component.registryName &&\n\t\t\t\t\tentry.name === component.name,\n\t\t\t)\n\n\t\t\tif (existingEntries.length > 0) {\n\t\t\t\tconst existingPair = existingEntries[0]\n\t\t\t\tif (existingPair) {\n\t\t\t\t\tconst [existingId, existingEntry] = existingPair\n\t\t\t\t\tif (existingEntry.hash !== computedHash) {\n\t\t\t\t\t\tfetchSpin?.fail(\"Integrity check failed\")\n\t\t\t\t\t\tthrow new IntegrityError(existingId, existingEntry.hash, computedHash)\n\t\t\t\t\t}\n\t\t\t\t\t// Hash matches - component already installed, will be skipped later\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// V2: Create canonical ID with hash-based revision\n\t\t\tconst canonicalId = createCanonicalId(\n\t\t\t\tcomponent.baseUrl,\n\t\t\t\tcomponent.registryName,\n\t\t\t\tcomponent.name,\n\t\t\t\t`sha256:${computedHash}`,\n\t\t\t)\n\n\t\t\tcomponentBundles.push({ component, files, computedHash, canonicalId })\n\t\t}\n\n\t\tfetchSpin?.succeed(`Fetched ${resolved.components.length} components`)\n\n\t\t// Phase 2: Pre-flight conflict detection (check ALL files before writing ANY)\n\t\t// This ensures atomic behavior: either all files install or none do\n\t\tconst plannedWrites = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tabsolutePath: string\n\t\t\t\trelativePath: string\n\t\t\t\tcontent: Buffer\n\t\t\t\tsource: string\n\t\t\t}\n\t\t>()\n\n\t\tfor (const { component, files } of componentBundles) {\n\t\t\tfor (const file of files) {\n\t\t\t\tconst componentFile = component.files.find((f: ComponentFileObject) => f.path === file.path)\n\t\t\t\tif (!componentFile) continue\n\n\t\t\t\tconst resolvedTarget = resolveTargetPath(componentFile.target, isFlattened, cwd)\n\t\t\t\tconst targetPath = join(cwd, resolvedTarget)\n\n\t\t\t\tregisterPlannedWriteOrThrow(plannedWrites, {\n\t\t\t\t\tabsolutePath: targetPath,\n\t\t\t\t\trelativePath: resolvedTarget,\n\t\t\t\t\tcontent: file.content,\n\t\t\t\t\tsource: `${component.registryName}/${component.name}:${componentFile.path}`,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst allConflicts: Array<{ path: string; owningComponent: string | null }> = []\n\n\t\tfor (const plannedWrite of plannedWrites.values()) {\n\t\t\tif (!existsSync(plannedWrite.absolutePath)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst existingContent = await Bun.file(plannedWrite.absolutePath).text()\n\t\t\tconst incomingContent = plannedWrite.content.toString(\"utf-8\")\n\n\t\t\tif (!isContentIdentical(existingContent, incomingContent)) {\n\t\t\t\t// Find which component owns this file (if any)\n\t\t\t\tconst owningComponent = findOwningComponent(receipt, plannedWrite.relativePath)\n\t\t\t\tallConflicts.push({ path: plannedWrite.relativePath, owningComponent })\n\t\t\t}\n\t\t}\n\n\t\t// Fail fast on conflicts BEFORE any writes (Law 4)\n\t\tif (allConflicts.length > 0) {\n\t\t\t// Group conflicts by ownership\n\t\t\tconst ownedConflicts = allConflicts.filter((c) => c.owningComponent !== null)\n\t\t\tconst unownedConflicts = allConflicts.filter((c) => c.owningComponent === null)\n\n\t\t\tif (!suppressHumanOutput) {\n\t\t\t\tlogger.error(\"\")\n\t\t\t\tlogger.error(\"File conflicts detected:\")\n\n\t\t\t\t// Show owned conflicts with update suggestions\n\t\t\t\tif (ownedConflicts.length > 0) {\n\t\t\t\t\tlogger.error(\"\")\n\t\t\t\t\tlogger.error(\"Files from installed components (use 'ocx update' or 'ocx remove'):\")\n\t\t\t\t\tfor (const conflict of ownedConflicts) {\n\t\t\t\t\t\t// owningComponent is guaranteed non-null in ownedConflicts\n\t\t\t\t\t\tif (conflict.owningComponent) {\n\t\t\t\t\t\t\tconst componentName = extractComponentName(conflict.owningComponent)\n\t\t\t\t\t\t\tlogger.error(` ✗ ${conflict.path} (from ${componentName})`)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Show unowned conflicts with manual resolution hint\n\t\t\t\tif (unownedConflicts.length > 0) {\n\t\t\t\t\tlogger.error(\"\")\n\t\t\t\t\tlogger.error(\"Files not managed by OCX (resolve manually):\")\n\t\t\t\t\tfor (const conflict of unownedConflicts) {\n\t\t\t\t\t\tlogger.error(` ✗ ${conflict.path}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlogger.error(\"\")\n\t\t\t}\n\n\t\t\t// Build context-aware error message\n\t\t\tlet errorMessage = `${allConflicts.length} file(s) have conflicts.\\n`\n\n\t\t\tif (ownedConflicts.length > 0) {\n\t\t\t\t// Extract unique component names\n\t\t\t\tconst uniqueComponents = new Set(\n\t\t\t\t\townedConflicts\n\t\t\t\t\t\t.filter((c) => c.owningComponent !== null)\n\t\t\t\t\t\t.map((c) => extractComponentName(c.owningComponent as string)),\n\t\t\t\t)\n\t\t\t\terrorMessage += `For OCX-managed files, use 'ocx update ${Array.from(uniqueComponents).join(\" \")}' or 'ocx remove ${Array.from(uniqueComponents).join(\" \")}'.\\n`\n\t\t\t}\n\n\t\t\tif (unownedConflicts.length > 0) {\n\t\t\t\terrorMessage +=\n\t\t\t\t\t\"For unmanaged files, resolve conflicts manually by renaming or removing them.\"\n\t\t\t}\n\n\t\t\tthrow new ConflictError(errorMessage.trim())\n\t\t}\n\n\t\t// Phase 3: Install all components (no conflicts possible at this point)\n\t\tconst installSpin = suppressHumanOutput\n\t\t\t? null\n\t\t\t: createSpinner({ text: \"Installing components...\" })\n\t\tinstallSpin?.start()\n\t\tmanifestSideEffectTransaction = await createAddManifestSideEffectTransaction({\n\t\t\tcwd,\n\t\t\tisFlattened,\n\t\t\ttrackOpencodeConfig: Boolean(resolved.opencode && Object.keys(resolved.opencode).length > 0),\n\t\t\ttrackNpmManifests:\n\t\t\t\tresolved.npmDependencies.length > 0 || resolved.npmDevDependencies.length > 0,\n\t\t\tquiet: options.quiet,\n\t\t})\n\t\tconst installWriteTransaction = createAddWriteTransaction({ quiet: options.quiet })\n\t\twriteTransaction = installWriteTransaction\n\n\t\tfor (const { component, files, computedHash, canonicalId } of componentBundles) {\n\t\t\t// Install component\n\t\t\tconst installResult = await installComponent(\n\t\t\t\tcomponent,\n\t\t\t\tfiles,\n\t\t\t\tcwd,\n\t\t\t\tisFlattened,\n\t\t\t\tinstallWriteTransaction,\n\t\t\t\t{\n\t\t\t\t\tverbose: options.verbose,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\t// Log results in verbose mode\n\t\t\tif (options.verbose) {\n\t\t\t\tfor (const f of installResult.skipped) {\n\t\t\t\t\tlogger.info(` ○ Skipped ${f} (unchanged)`)\n\t\t\t\t}\n\t\t\t\tfor (const f of installResult.overwritten) {\n\t\t\t\t\tlogger.info(` ✓ Overwrote ${f}`)\n\t\t\t\t}\n\t\t\t\tfor (const f of installResult.written) {\n\t\t\t\t\tlogger.info(` ✓ Wrote ${f}`)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Use cached registry index\n\t\t\tconst index = registryIndexes.get(component.registryName)\n\t\t\tif (!index) {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Registry index not found for \"${component.registryName}\". ` +\n\t\t\t\t\t\t`This is an internal error - please report it at https://github.com/${GITHUB_REPO}/issues`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Compute individual file hashes (store resolved paths in receipt)\n\t\t\tconst fileHashes: Array<{ path: string; hash: string }> = []\n\t\t\tfor (const file of files) {\n\t\t\t\tconst componentFile = component.files.find((f: ComponentFileObject) => f.path === file.path)\n\t\t\t\tif (!componentFile) throw new Error(`File ${file.path} not found in component manifest`)\n\t\t\t\tconst resolvedTarget = resolveTargetPath(componentFile.target, isFlattened, cwd)\n\t\t\t\tfileHashes.push({\n\t\t\t\t\tpath: resolvedTarget, // Resolved path (with .opencode/ prefix if local mode)\n\t\t\t\t\thash: hashContent(file.content),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treceipt.installed[canonicalId] = {\n\t\t\t\tregistryUrl: component.baseUrl,\n\t\t\t\tregistryName: component.registryName,\n\t\t\t\tname: component.name,\n\t\t\t\trevision: `sha256:${computedHash}`,\n\t\t\t\thash: computedHash,\n\t\t\t\tfiles: fileHashes,\n\t\t\t\tinstalledAt: new Date().toISOString(),\n\t\t\t\t// Store component's opencode config for runtime instruction path resolution\n\t\t\t\t...(component.opencode && { opencode: component.opencode as Record<string, unknown> }),\n\t\t\t}\n\t\t}\n\n\t\tinstallSpin?.succeed(`Installed ${resolved.components.length} components`)\n\n\t\t// Apply opencode.json changes (ShadCN-style: component wins, user uses git)\n\t\tif (resolved.opencode && Object.keys(resolved.opencode).length > 0) {\n\t\t\tconst result = await updateOpencodeJsonConfig(cwd, resolved.opencode)\n\n\t\t\tif (!options.quiet && result.changed) {\n\t\t\t\tif (result.created) {\n\t\t\t\t\tlogger.info(`Created ${result.path}`)\n\t\t\t\t} else {\n\t\t\t\t\tlogger.info(`Updated ${result.path}`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update package.json with npm dependencies\n\t\t// Global or profile mode: writes to cwd/package.json\n\t\t// Local mode: writes to .opencode/package.json\n\t\tconst hasNpmDeps = resolved.npmDependencies.length > 0\n\t\tconst hasNpmDevDeps = resolved.npmDevDependencies.length > 0\n\t\tconst packageJsonPath =\n\t\t\toptions.global || options.profile\n\t\t\t\t? join(cwd, \"package.json\")\n\t\t\t\t: join(cwd, \".opencode/package.json\")\n\n\t\tif (hasNpmDeps || hasNpmDevDeps) {\n\t\t\tconst npmSpin = suppressHumanOutput\n\t\t\t\t? null\n\t\t\t\t: createSpinner({ text: `Updating ${packageJsonPath}...` })\n\t\t\tnpmSpin?.start()\n\n\t\t\ttry {\n\t\t\t\t// V2: Pass isFlattened based on mode (profile/global vs local)\n\t\t\t\tconst isFlattened = !!(options.global || options.profile)\n\t\t\t\tconst depResult = await updateOpencodePackageDeps(\n\t\t\t\t\tcwd,\n\t\t\t\t\tresolved.npmDependencies,\n\t\t\t\t\tresolved.npmDevDependencies,\n\t\t\t\t\t{ isFlattened },\n\t\t\t\t)\n\t\t\t\tconst totalDeps = resolved.npmDependencies.length + resolved.npmDevDependencies.length\n\t\t\t\tnpmSpin?.succeed(`Added ${totalDeps} dependencies to ${packageJsonPath}`)\n\n\t\t\t\t// Invalidate node_modules if dependencies changed to force reinstall\n\t\t\t\tif (depResult.changed) {\n\t\t\t\t\tconst invResult = await invalidateNodeModules(depResult.packageDir)\n\t\t\t\t\tif (invResult.success && invResult.action !== \"none\") {\n\t\t\t\t\t\tif (!suppressHumanOutput) {\n\t\t\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t\t\t`Invalidated ${join(depResult.packageDir, \"node_modules\")} to force reinstall`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!invResult.success) {\n\t\t\t\t\t\t// Warn but do not fail the command (Law 5: intentional naming for remediation)\n\t\t\t\t\t\tconst nodeModulesPath = join(depResult.packageDir, \"node_modules\")\n\t\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t\t`Could not invalidate ${nodeModulesPath}: ${invResult.error?.message ?? \"unknown error\"}. ` +\n\t\t\t\t\t\t\t\t`Run \\`rm -rf \"${nodeModulesPath}\"\\` manually to force reinstall.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tnpmSpin?.fail(`Failed to update ${packageJsonPath}`)\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\n\t\t// V1: Save receipt file\n\t\tawait writeReceipt(cwd, receipt)\n\t\tif (!writeTransaction) {\n\t\t\tthrow new Error(\"Internal error: missing add write transaction after install phase.\")\n\t\t}\n\t\tawait writeTransaction.commit()\n\t\twriteTransaction = null\n\t\tmanifestSideEffectTransaction?.commit()\n\t\tmanifestSideEffectTransaction = null\n\n\t\tif (options.json && emitJson) {\n\t\t\toutputJson({\n\t\t\t\tsuccess: true,\n\t\t\t\tinstalled: resolved.installOrder,\n\t\t\t\topencode: !!resolved.opencode,\n\t\t\t})\n\t\t} else if (!options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.success(`Done! Installed ${resolved.components.length} components.`)\n\t\t}\n\n\t\treturn {\n\t\t\tinstalled: resolved.installOrder,\n\t\t\topencode: !!resolved.opencode,\n\t\t\tdryRun: false,\n\t\t}\n\t} catch (error) {\n\t\tif (writeTransaction) {\n\t\t\tawait writeTransaction.rollback()\n\t\t\twriteTransaction = null\n\t\t}\n\t\tif (manifestSideEffectTransaction) {\n\t\t\tawait manifestSideEffectTransaction.rollback()\n\t\t\tmanifestSideEffectTransaction = null\n\t\t}\n\n\t\t// Only fail the resolve spinner if it's still running (error during resolution)\n\t\t// Other spinners handle their own failures\n\t\tif (spin && !spin.isSpinning) {\n\t\t\t// Spinner already stopped - error happened after resolution\n\t\t} else {\n\t\t\tspin?.fail(\"Failed to add components\")\n\t\t}\n\t\tthrow error\n\t}\n}\n\n/**\n * Build a consistent warning message for rollback cleanup failures.\n */\nfunction formatRollbackCleanupWarning(action: string, targetPath: string, error: unknown): string {\n\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\treturn `${action} \"${targetPath}\" (${errorMessage})`\n}\n\n/**\n * Returns true when candidate path is inside boundary directory.\n */\nfunction isWithinBoundary(candidatePath: string, boundaryPath: string): boolean {\n\tconst rel = relative(boundaryPath, candidatePath)\n\treturn rel !== \"\" && !rel.startsWith(\"..\") && !isAbsolute(rel)\n}\n\n/**\n * Remove empty parent directories up to (but not including) boundary.\n */\nasync function removeEmptyParentDirectories(startDir: string, boundaryDir: string): Promise<void> {\n\tlet currentDir = resolve(startDir)\n\tconst boundary = resolve(boundaryDir)\n\n\twhile (isWithinBoundary(currentDir, boundary)) {\n\t\tlet currentEntryExists = true\n\t\ttry {\n\t\t\tconst currentEntryStats = await lstat(currentDir)\n\t\t\tif (!currentEntryStats.isDirectory()) {\n\t\t\t\t// Never remove non-directory paths during cleanup.\n\t\t\t\tbreak\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst code = (error as NodeJS.ErrnoException).code\n\t\t\tif (code === \"ENOENT\") {\n\t\t\t\tcurrentEntryExists = false\n\t\t\t} else {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tif (currentEntryExists) {\n\t\t\t\tawait rm(currentDir, { recursive: false })\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst code = (error as NodeJS.ErrnoException).code\n\t\t\tif (code === \"ENOENT\") {\n\t\t\t\t// Already gone; continue walking upward.\n\t\t\t} else if (code === \"ENOTEMPTY\" || code === \"EEXIST\" || code === \"EBUSY\") {\n\t\t\t\t// Stop at first non-empty/in-use directory.\n\t\t\t\tbreak\n\t\t\t} else if (code === \"ENOTDIR\") {\n\t\t\t\t// Path changed to non-directory between lstat and rm.\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir)\n\t\tif (parentDir === currentDir) {\n\t\t\tbreak\n\t\t}\n\t\tcurrentDir = parentDir\n\t}\n}\n\n/**\n * Capture the current state of a file path for rollback.\n */\nasync function captureFileSnapshot(filePath: string): Promise<FileSnapshot> {\n\tif (!existsSync(filePath)) {\n\t\treturn {\n\t\t\tpath: filePath,\n\t\t\texisted: false,\n\t\t\tcontent: \"\",\n\t\t}\n\t}\n\n\treturn {\n\t\tpath: filePath,\n\t\texisted: true,\n\t\tcontent: await Bun.file(filePath).text(),\n\t}\n}\n\n/**\n * Restore a file path to its captured state.\n */\nasync function restoreFileSnapshot(snapshot: FileSnapshot, cwd: string): Promise<void> {\n\tif (snapshot.existed) {\n\t\tawait mkdir(dirname(snapshot.path), { recursive: true })\n\t\tawait Bun.write(snapshot.path, snapshot.content)\n\t\treturn\n\t}\n\n\tif (existsSync(snapshot.path)) {\n\t\tawait rm(snapshot.path, { force: true, recursive: true })\n\t}\n\n\tawait removeEmptyParentDirectories(dirname(snapshot.path), cwd)\n}\n\n/**\n * Snapshot manifest-side effect files so add can roll back atomically on failure.\n */\nasync function createAddManifestSideEffectTransaction(options: {\n\tcwd: string\n\tisFlattened: boolean\n\ttrackOpencodeConfig: boolean\n\ttrackNpmManifests: boolean\n\tquiet?: boolean\n}): Promise<AddManifestSideEffectTransaction> {\n\tconst snapshots: FileSnapshot[] = []\n\tconst trackedPaths = new Set<string>()\n\tlet finalized = false\n\n\tconst trackPath = async (filePath: string): Promise<void> => {\n\t\tif (trackedPaths.has(filePath)) {\n\t\t\treturn\n\t\t}\n\t\ttrackedPaths.add(filePath)\n\t\tsnapshots.push(await captureFileSnapshot(filePath))\n\t}\n\n\tif (options.trackOpencodeConfig) {\n\t\tconst opencodeConfigPath = findOpencodeConfig(options.cwd).path\n\t\tawait trackPath(opencodeConfigPath)\n\t}\n\n\tif (options.trackNpmManifests) {\n\t\tconst packageDir = options.isFlattened ? options.cwd : join(options.cwd, \".opencode\")\n\t\tawait trackPath(join(packageDir, \"package.json\"))\n\t\tif (!options.isFlattened) {\n\t\t\tawait trackPath(join(packageDir, \".gitignore\"))\n\t\t}\n\t}\n\n\tawait trackPath(findReceipt(options.cwd).path)\n\n\tconst rollback = async (): Promise<void> => {\n\t\tif (finalized) {\n\t\t\treturn\n\t\t}\n\n\t\tfinalized = true\n\t\tconst rollbackWarnings: string[] = []\n\n\t\tfor (const snapshot of [...snapshots].reverse()) {\n\t\t\ttry {\n\t\t\t\tawait restoreFileSnapshot(snapshot, options.cwd)\n\t\t\t} catch (error) {\n\t\t\t\trollbackWarnings.push(\n\t\t\t\t\tformatRollbackCleanupWarning(\n\t\t\t\t\t\t\"Add rollback cleanup warning: failed to restore\",\n\t\t\t\t\t\tsnapshot.path,\n\t\t\t\t\t\terror,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tif (!options.quiet) {\n\t\t\tfor (const warning of rollbackWarnings) {\n\t\t\t\tlogger.warn(warning)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst commit = (): void => {\n\t\tfinalized = true\n\t}\n\n\treturn { rollback, commit }\n}\n\n/**\n * Creates an atomic write transaction for add installs.\n * Files are swapped via temp+rename and can be rolled back on failure.\n */\nfunction createAddWriteTransaction(options: { quiet?: boolean }): AddWriteTransaction {\n\tconst appliedWrites: AppliedAddWrite[] = []\n\tconst tempPaths = new Set<string>()\n\tlet finalized = false\n\n\tconst rollback = async (): Promise<void> => {\n\t\tif (finalized) {\n\t\t\treturn\n\t\t}\n\n\t\tfinalized = true\n\t\tconst rollbackWarnings: string[] = []\n\n\t\tfor (const tempPath of tempPaths) {\n\t\t\ttry {\n\t\t\t\tawait rm(tempPath, { force: true })\n\t\t\t} catch (error) {\n\t\t\t\trollbackWarnings.push(\n\t\t\t\t\tformatRollbackCleanupWarning(\n\t\t\t\t\t\t\"Add rollback cleanup warning: failed to remove temp file\",\n\t\t\t\t\t\ttempPath,\n\t\t\t\t\t\terror,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tfor (const appliedWrite of [...appliedWrites].reverse()) {\n\t\t\ttry {\n\t\t\t\tif (appliedWrite.backupPath) {\n\t\t\t\t\tif (existsSync(appliedWrite.targetPath)) {\n\t\t\t\t\t\tawait rm(appliedWrite.targetPath, { force: true, recursive: true })\n\t\t\t\t\t}\n\t\t\t\t\tif (existsSync(appliedWrite.backupPath)) {\n\t\t\t\t\t\tawait rename(appliedWrite.backupPath, appliedWrite.targetPath)\n\t\t\t\t\t}\n\t\t\t\t} else if (existsSync(appliedWrite.targetPath)) {\n\t\t\t\t\tawait rm(appliedWrite.targetPath, { force: true, recursive: true })\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\trollbackWarnings.push(\n\t\t\t\t\tformatRollbackCleanupWarning(\n\t\t\t\t\t\t\"Add rollback cleanup warning: failed to restore target\",\n\t\t\t\t\t\tappliedWrite.targetPath,\n\t\t\t\t\t\terror,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tif (!options.quiet) {\n\t\t\tfor (const warning of rollbackWarnings) {\n\t\t\t\tlogger.warn(warning)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst commit = async (): Promise<void> => {\n\t\tif (finalized) {\n\t\t\treturn\n\t\t}\n\n\t\tfinalized = true\n\n\t\tfor (const appliedWrite of appliedWrites) {\n\t\t\tif (!appliedWrite.backupPath || !existsSync(appliedWrite.backupPath)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait rm(appliedWrite.backupPath, { force: true })\n\t\t\t} catch (error) {\n\t\t\t\tif (!options.quiet) {\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`Post-add cleanup warning: failed to remove backup \"${appliedWrite.backupPath}\" (${errorMessage})`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst writeFileAtomically: AddWriteTransaction[\"writeFileAtomically\"] = async ({\n\t\ttargetPath,\n\t\tresolvedTarget,\n\t\tcontent,\n\t}) => {\n\t\tconst targetDir = dirname(targetPath)\n\t\tif (!existsSync(targetDir)) {\n\t\t\tawait mkdir(targetDir, { recursive: true })\n\t\t}\n\n\t\tif (existsSync(targetPath)) {\n\t\t\tconst targetStats = await stat(targetPath)\n\t\t\tif (targetStats.isDirectory()) {\n\t\t\t\tthrow new ValidationError(`Cannot install \"${resolvedTarget}\": target path is a directory.`)\n\t\t\t}\n\t\t}\n\n\t\tconst tempPath = `${targetPath}.ocx-add-tmp-${randomUUID()}`\n\t\tawait writeFile(tempPath, content)\n\t\ttempPaths.add(tempPath)\n\n\t\tlet backupPath: string | null = null\n\t\tif (existsSync(targetPath)) {\n\t\t\tbackupPath = `${targetPath}.ocx-add-backup-${randomUUID()}`\n\t\t\tawait rename(targetPath, backupPath)\n\t\t\tappliedWrites.push({ targetPath, backupPath })\n\t\t}\n\n\t\tawait rename(tempPath, targetPath)\n\t\ttempPaths.delete(tempPath)\n\n\t\tif (!backupPath) {\n\t\t\tappliedWrites.push({ targetPath, backupPath: null })\n\t\t}\n\t}\n\n\treturn {\n\t\twriteFileAtomically,\n\t\trollback,\n\t\tcommit,\n\t}\n}\n\n/**\n * Writes component files to disk.\n * Pre-flight conflict detection happens before this function is called,\n * so we can safely write all files without additional conflict checks.\n */\nasync function installComponent(\n\tcomponent: ResolvedComponent,\n\tfiles: { path: string; content: Buffer }[],\n\tcwd: string,\n\tisFlattened: boolean,\n\twriteTransaction: AddWriteTransaction,\n\t_options: { verbose?: boolean },\n): Promise<{ written: string[]; skipped: string[]; overwritten: string[] }> {\n\tconst result = {\n\t\twritten: [] as string[],\n\t\tskipped: [] as string[],\n\t\toverwritten: [] as string[],\n\t}\n\n\tfor (const file of files) {\n\t\tconst componentFile = component.files.find((f: ComponentFileObject) => f.path === file.path)\n\t\tif (!componentFile) continue\n\n\t\t// V2: Resolve target path based on mode (flattened vs local)\n\t\tconst resolvedTarget = resolveTargetPath(componentFile.target, isFlattened, cwd)\n\t\tconst targetPath = join(cwd, resolvedTarget)\n\t\t// Check if file exists\n\t\tif (existsSync(targetPath)) {\n\t\t\t// Read existing content and compare\n\t\t\tconst existingContent = await Bun.file(targetPath).text()\n\t\t\tconst incomingContent = file.content.toString(\"utf-8\")\n\n\t\t\tif (isContentIdentical(existingContent, incomingContent)) {\n\t\t\t\t// Content is identical - skip silently\n\t\t\t\tresult.skipped.push(resolvedTarget)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Content differs - overwrite (conflicts already checked in pre-flight)\n\t\t\tresult.overwritten.push(resolvedTarget)\n\t\t} else {\n\t\t\tresult.written.push(resolvedTarget)\n\t\t}\n\n\t\tawait writeTransaction.writeFileAtomically({\n\t\t\ttargetPath,\n\t\t\tresolvedTarget,\n\t\t\tcontent: file.content,\n\t\t})\n\t}\n\n\treturn result\n}\n\n// ============================================================================\n// NPM Dependency Management\n// ============================================================================\n\ninterface NpmDependency {\n\tname: string\n\tversion: string\n}\n\ninterface OpencodePackageJson {\n\tname?: string\n\tprivate?: boolean\n\ttype?: string\n\tdependencies?: Record<string, string>\n\tdevDependencies?: Record<string, string>\n}\n\nconst DEFAULT_PACKAGE_JSON: OpencodePackageJson = {\n\tname: \"opencode-plugins\",\n\tprivate: true,\n\ttype: \"module\",\n}\n\n/**\n * Parses an npm dependency spec into name and version.\n * Handles: \"lodash\", \"lodash@4.0.0\", \"@types/node\", \"@types/node@1.0.0\"\n */\nfunction parseNpmDependency(spec: string): NpmDependency {\n\t// Guard: invalid input\n\tif (!spec?.trim()) {\n\t\tthrow new ValidationError(`Invalid npm dependency: expected non-empty string, got \"${spec}\"`)\n\t}\n\n\tconst trimmed = spec.trim()\n\tconst lastAt = trimmed.lastIndexOf(\"@\")\n\n\t// Has version: \"lodash@4.0.0\" or \"@types/node@1.0.0\"\n\tif (lastAt > 0) {\n\t\tconst name = trimmed.slice(0, lastAt)\n\t\tconst version = trimmed.slice(lastAt + 1)\n\t\tif (!version) {\n\t\t\tthrow new ValidationError(`Invalid npm dependency: missing version after @ in \"${spec}\"`)\n\t\t}\n\t\treturn { name, version }\n\t}\n\n\t// No version: \"lodash\" or \"@types/node\" → use \"*\"\n\treturn { name: trimmed, version: \"*\" }\n}\n\n/**\n * Merges new dependencies into the dependencies field.\n * Pure function: same inputs always produce same output.\n */\nfunction mergeProdDependencies(\n\texisting: OpencodePackageJson,\n\tnewDeps: NpmDependency[],\n): OpencodePackageJson {\n\tconst merged: Record<string, string> = { ...existing.dependencies }\n\tfor (const dep of newDeps) {\n\t\tmerged[dep.name] = dep.version\n\t}\n\treturn { ...existing, dependencies: merged }\n}\n\n/**\n * Merges new devDependencies into the devDependencies field.\n * Pure function: same inputs always produce same output.\n */\nfunction mergeDevDependencies(\n\texisting: OpencodePackageJson,\n\tnewDeps: NpmDependency[],\n): OpencodePackageJson {\n\tconst merged: Record<string, string> = { ...existing.devDependencies }\n\tfor (const dep of newDeps) {\n\t\tmerged[dep.name] = dep.version\n\t}\n\treturn { ...existing, devDependencies: merged }\n}\n\n/**\n * Reads package.json from the given directory, or returns default structure if missing.\n */\nasync function readOpencodePackageJson(opencodeDir: string): Promise<OpencodePackageJson> {\n\tconst pkgPath = join(opencodeDir, \"package.json\")\n\n\t// Guard: file doesn't exist - return default\n\tif (!existsSync(pkgPath)) {\n\t\treturn { ...DEFAULT_PACKAGE_JSON }\n\t}\n\n\t// Try to parse, fail fast on invalid JSON\n\ttry {\n\t\tconst content = await Bun.file(pkgPath).text()\n\t\treturn JSON.parse(content) as OpencodePackageJson\n\t} catch (e) {\n\t\tconst message = e instanceof Error ? e.message : String(e)\n\t\tthrow new ConfigError(`Invalid ${pkgPath}: ${message}`)\n\t}\n}\n\n/**\n * Modifies .opencode/.gitignore to ensure package.json and bun.lock are tracked.\n * Creates the file with sensible defaults if missing.\n */\nasync function ensureManifestFilesAreTracked(opencodeDir: string): Promise<void> {\n\tconst gitignorePath = join(opencodeDir, \".gitignore\")\n\tconst filesToTrack = new Set([\"package.json\", \"bun.lock\"])\n\tconst requiredIgnores = [\"node_modules\"]\n\n\t// Read existing lines or start fresh\n\tlet lines: string[] = []\n\tif (existsSync(gitignorePath)) {\n\t\tconst content = await Bun.file(gitignorePath).text()\n\t\tlines = content\n\t\t\t.split(\"\\n\")\n\t\t\t.map((l) => l.trim())\n\t\t\t.filter(Boolean)\n\t}\n\n\t// Remove entries that should be tracked (not ignored)\n\tlines = lines.filter((line) => !filesToTrack.has(line))\n\n\t// Ensure required ignores are present\n\tfor (const ignore of requiredIgnores) {\n\t\tif (!lines.includes(ignore)) {\n\t\t\tlines.push(ignore)\n\t\t}\n\t}\n\n\tawait Bun.write(gitignorePath, `${lines.join(\"\\n\")}\\n`)\n}\n\n/**\n * Updates package.json with new dependencies.\n * For local mode: writes to .opencode/package.json and ensures git tracking.\n * For flattened mode (global or profile): writes directly to cwd/package.json.\n *\n * Returns metadata about what changed for downstream invalidation logic.\n *\n * @throws ConflictError if same package appears in both prod and dev deps\n */\nasync function updateOpencodePackageDeps(\n\tcwd: string,\n\tnpmDeps: string[],\n\tnpmDevDeps: string[],\n\toptions: { isFlattened?: boolean } = {},\n): Promise<DepUpdateResult> {\n\t// Flattened mode: write directly to cwd, no .opencode prefix\n\t// Local mode: write to .opencode subdirectory\n\tconst packageDir = options.isFlattened ? cwd : join(cwd, \".opencode\")\n\n\t// Guard: no deps to process\n\tif (npmDeps.length === 0 && npmDevDeps.length === 0) {\n\t\treturn { changed: false, packageDir, delta: [] }\n\t}\n\n\t// Ensure directory exists\n\tawait mkdir(packageDir, { recursive: true })\n\n\t// Parse all deps - fails fast on invalid (Law 4)\n\tconst prodDeps = npmDeps.map(parseNpmDependency)\n\tconst devDeps = npmDevDeps.map(parseNpmDependency)\n\n\t// Law 4 (Fail Loud): Check for conflicts - same package in both lists\n\tconst prodNames = new Set(prodDeps.map((d) => d.name))\n\tconst conflicts = devDeps.filter((d) => prodNames.has(d.name))\n\tif (conflicts.length > 0) {\n\t\tthrow new ConflictError(\n\t\t\t`Package(s) appear in both dependencies and devDependencies: ${conflicts.map((c) => c.name).join(\", \")}.\\n` +\n\t\t\t\t\"A package cannot be in both fields. Remove from one list manually before adding.\",\n\t\t)\n\t}\n\n\t// Read → merge → write\n\tconst existing = await readOpencodePackageJson(packageDir)\n\tconst beforeDeps = { ...existing.dependencies, ...existing.devDependencies }\n\n\tlet updated = existing\n\tupdated = mergeProdDependencies(updated, prodDeps)\n\tupdated = mergeDevDependencies(updated, devDeps)\n\tawait Bun.write(join(packageDir, \"package.json\"), `${JSON.stringify(updated, null, 2)}\\n`)\n\n\tconst afterDeps = { ...updated.dependencies, ...updated.devDependencies }\n\tconst delta = computeDependencyDelta(beforeDeps, afterDeps)\n\n\t// Ensure manifest files are tracked by git (only for local mode)\n\tif (!options.isFlattened) {\n\t\tawait ensureManifestFilesAreTracked(packageDir)\n\t}\n\n\treturn {\n\t\tchanged: delta.changed,\n\t\tpackageDir,\n\t\tdelta: delta.entries,\n\t}\n}\n",
32
- "/**\n * Config & Lockfile Schemas\n *\n * Schemas for ocx.jsonc (user config) and ocx.lock (auto-generated lockfile).\n * Includes Bun-specific I/O helpers.\n */\n\nimport { existsSync } from \"node:fs\"\nimport { mkdir } from \"node:fs/promises\"\nimport path from \"node:path\"\nimport { parse as parseJsonc } from \"jsonc-parser\"\nimport { z } from \"zod\"\nimport { normalizeRegistryUrl } from \"../utils/url\"\nimport { qualifiedComponentSchema } from \"./registry\"\n\n// =============================================================================\n// OCX CONFIG SCHEMA (ocx.jsonc)\n// =============================================================================\n\n/**\n * Registry configuration in ocx.jsonc\n */\nexport const registryConfigSchema = z.object({\n\t/** Registry URL */\n\turl: z.string().url(\"Registry URL must be a valid URL\"),\n\n\t/** Optional auth headers (supports ${ENV_VAR} expansion) */\n\theaders: z.record(z.string()).optional(),\n})\n\nexport type RegistryConfig = z.infer<typeof registryConfigSchema>\n\n/**\n * Main OCX config schema (ocx.jsonc)\n * V2: Adds profile field for local profile selection\n */\nexport const ocxConfigSchema = z.object({\n\t/** Schema URL for IDE support */\n\t$schema: z.string().optional(),\n\n\t/** Profile selection - specifies which global profile to layer with local config */\n\tprofile: z.string().optional(),\n\n\t/** Configured registries */\n\tregistries: z.record(registryConfigSchema).default({}),\n\n\t/** Lock registries - prevent adding/removing (enterprise feature) */\n\tlockRegistries: z.boolean().default(false),\n\n\t/** Skip version compatibility checks */\n\tskipCompatCheck: z.boolean().default(false),\n})\n\nexport type OcxConfig = z.infer<typeof ocxConfigSchema>\n\nexport interface ReadOcxConfigOptions {\n\t/**\n\t * Emit parse diagnostics directly to stderr.\n\t * Defaults to true to preserve existing human-mode behavior.\n\t */\n\temitParseDiagnostics?: boolean\n}\n\n// =============================================================================\n// RECEIPT SCHEMA (V1: replaces ocx.lock)\n// =============================================================================\n\nexport const RECEIPT_DIR = \".ocx\"\nexport const RECEIPT_FILE = \"receipt.jsonc\"\n\n/**\n * V1: Installed component entry in receipt\n * Canonical ID format: \"registryUrl::registryName/component@resolvedRevision\"\n * Includes ownership tracking and sha256 baseline for integrity\n */\nexport const installedComponentSchema = z.object({\n\t/** Registry URL where this was installed from */\n\tregistryUrl: z.string(),\n\n\t/** Registry name (configured alias from ocx.jsonc) */\n\tregistryName: z.string(),\n\n\t/** Component name */\n\tname: z.string(),\n\n\t/** Resolved version/revision (not tags) */\n\trevision: z.string(),\n\n\t/** SHA-256 hash of installed files for integrity (baseline) */\n\thash: z.string(),\n\n\t/** Target files where installed (root-relative paths) with individual hashes */\n\tfiles: z.array(\n\t\tz.object({\n\t\t\t/** File path relative to install root */\n\t\t\tpath: z.string(),\n\t\t\t/** SHA-256 hash of this specific file */\n\t\t\thash: z.string(),\n\t\t}),\n\t),\n\n\t/** ISO timestamp of installation */\n\tinstalledAt: z.string(),\n\n\t/** ISO timestamp of last update (optional, only set after update) */\n\tupdatedAt: z.string().optional(),\n\n\t/** Ownership metadata - who/what installed this component */\n\towner: z\n\t\t.object({\n\t\t\t/** Owner type: user, profile, or system */\n\t\t\ttype: z.enum([\"user\", \"profile\", \"system\"]),\n\t\t\t/** Owner identifier (username, profile name, etc.) */\n\t\t\tid: z.string().optional(),\n\t\t})\n\t\t.optional(),\n\n\t/**\n\t * OpenCode config provided by this component.\n\t * Stored for runtime instruction path resolution.\n\t * Install-root-relative paths in instructions array are resolved at runtime.\n\t */\n\topencode: z.record(z.unknown()).optional(),\n})\n\nexport type InstalledComponent = z.infer<typeof installedComponentSchema>\n\n/**\n * V1: Receipt file schema (.ocx/receipt.jsonc)\n * Tracks installed components with ownership and baselines per install root.\n * Replaces the old ocx.lock format.\n *\n * Keys use canonical ID format: \"registryUrl::registryName/component@resolvedRevision\"\n */\nexport const receiptSchema = z.object({\n\t/** Receipt format version */\n\tversion: z.literal(1),\n\n\t/** Install root (for validation) */\n\troot: z.string().optional(),\n\n\t/** Installed components, keyed by canonical ID */\n\tinstalled: z.record(z.string(), installedComponentSchema).default({}),\n})\n\nexport type Receipt = z.infer<typeof receiptSchema>\n\n// =============================================================================\n// OCX LOCKFILE SCHEMA (LEGACY - V1 compat)\n// =============================================================================\n\n/**\n * LEGACY V1: Installed component entry in lockfile\n * Key format: \"alias/component\" (e.g., \"kdco/researcher\")\n */\nexport const legacyInstalledComponentSchema = z.object({\n\t/** Registry alias this was installed from */\n\tregistry: z.string(),\n\n\t/** Version at time of install */\n\tversion: z.string(),\n\n\t/** SHA-256 hash of installed files for integrity */\n\thash: z.string(),\n\n\t/** Target files where installed (clean paths, no alias prefix) */\n\tfiles: z.array(z.string()),\n\n\t/** ISO timestamp of installation */\n\tinstalledAt: z.string(),\n\n\t/** ISO timestamp of last update (optional, only set after update) */\n\tupdatedAt: z.string().optional(),\n})\n\nexport type LegacyInstalledComponent = z.infer<typeof legacyInstalledComponentSchema>\n\n/**\n * Profile source tracking for profiles installed from registries.\n * Optional field in OcxLock - only present for profile installs.\n */\nexport const installedFromSchema = z.object({\n\t/** Registry alias this profile was installed from */\n\tregistry: z.string(),\n\n\t/** Component name in the registry */\n\tcomponent: z.string(),\n\n\t/** Registry version at time of install */\n\tversion: z.string().optional(),\n\n\t/** SHA-256 hash of profile files for integrity */\n\thash: z.string(),\n\n\t/** ISO timestamp of installation */\n\tinstalledAt: z.string(),\n})\n\nexport type InstalledFrom = z.infer<typeof installedFromSchema>\n\n/**\n * OCX lockfile schema (ocx.lock)\n * Keys are qualified component refs: \"alias/component\"\n */\nexport const ocxLockSchema = z.object({\n\t/** Lockfile format version */\n\tlockVersion: z.literal(1),\n\n\t/** Profile source info (only present for profiles installed from registry) */\n\tinstalledFrom: installedFromSchema.optional(),\n\n\t/** Installed components, keyed by \"alias/component\" */\n\tinstalled: z.record(qualifiedComponentSchema, legacyInstalledComponentSchema).default({}),\n})\n\nexport type OcxLock = z.infer<typeof ocxLockSchema>\n\n// =============================================================================\n// RECEIPT FILE HELPERS (V1)\n// =============================================================================\n\n/**\n * V1: Create canonical component ID.\n * Format: \"registryUrl::registryName/component@resolvedRevision\"\n *\n * Registry versions are ignored - registry is treated as latest-only.\n *\n * @param registryUrl - Registry base URL (normalized)\n * @param registryName - Configured registry alias\n * @param name - Component name\n * @param revision - Resolved version/revision (not tags)\n * @returns Canonical ID string\n */\nexport function createCanonicalId(\n\tregistryUrl: string,\n\tregistryName: string,\n\tname: string,\n\trevision: string,\n): string {\n\t// Normalize registry URL (remove trailing slash)\n\tconst normalizedUrl = normalizeRegistryUrl(registryUrl)\n\treturn `${normalizedUrl}::${registryName}/${name}@${revision}`\n}\n\n/**\n * V1: Parse a canonical component ID.\n * Format: \"registryUrl::registryName/component@resolvedRevision\"\n *\n * @param canonicalId - The canonical ID to parse\n * @returns Parsed components\n * @throws Error if format is invalid\n */\nexport function parseCanonicalId(canonicalId: string): {\n\tregistryUrl: string\n\tregistryName: string\n\tname: string\n\trevision: string\n} {\n\t// Guard: must contain ::\n\tif (!canonicalId.includes(\"::\")) {\n\t\tthrow new Error(\n\t\t\t`Invalid canonical ID: \"${canonicalId}\". Expected format: registryUrl::registryName/component@revision`,\n\t\t)\n\t}\n\n\tconst [registryUrl, rest] = canonicalId.split(\"::\")\n\n\t// Guard: must have content after ::\n\tif (!rest || !registryUrl) {\n\t\tthrow new Error(\n\t\t\t`Invalid canonical ID: \"${canonicalId}\". Expected format: registryUrl::registryName/component@revision`,\n\t\t)\n\t}\n\n\t// Guard: must contain @\n\tif (!rest.includes(\"@\")) {\n\t\tthrow new Error(\n\t\t\t`Invalid canonical ID: \"${canonicalId}\". Expected format: registryUrl::registryName/component@revision`,\n\t\t)\n\t}\n\n\t// Parse using indexOf to preserve @ in revision (e.g., user@branch)\n\tconst atIndex = rest.indexOf(\"@\")\n\tif (atIndex === -1) {\n\t\tthrow new Error(`Invalid canonical ID: missing revision in ${canonicalId}`)\n\t}\n\tconst qualifiedName = rest.slice(0, atIndex)\n\tconst revision = rest.slice(atIndex + 1)\n\n\t// Guard: must have qualified name and revision\n\tif (!qualifiedName || !revision) {\n\t\tthrow new Error(\n\t\t\t`Invalid canonical ID: \"${canonicalId}\". Expected format: registryUrl::registryName/component@revision`,\n\t\t)\n\t}\n\n\t// Parse qualified name\n\tif (!qualifiedName.includes(\"/\")) {\n\t\tthrow new Error(\n\t\t\t`Invalid canonical ID: \"${canonicalId}\". Component must be qualified (registryName/component)`,\n\t\t)\n\t}\n\n\tconst [registryName, name] = qualifiedName.split(\"/\")\n\n\t// Guard: registryName and name must exist\n\tif (!registryName || !name) {\n\t\tthrow new Error(\n\t\t\t`Invalid canonical ID: \"${canonicalId}\". Both registry name and component name are required`,\n\t\t)\n\t}\n\n\treturn {\n\t\tregistryUrl: normalizeRegistryUrl(registryUrl), // Normalize\n\t\tregistryName,\n\t\tname,\n\t\trevision,\n\t}\n}\n\n/**\n * V1: Find receipt file path for an install root.\n * Receipt is always at <root>/.ocx/receipt.jsonc\n * @param installRoot - The install root directory\n * @returns Object with path and whether it exists\n */\nexport function findReceipt(installRoot: string): { path: string; exists: boolean } {\n\tconst receiptPath = path.join(installRoot, RECEIPT_DIR, RECEIPT_FILE)\n\treturn {\n\t\tpath: receiptPath,\n\t\texists: existsSync(receiptPath),\n\t}\n}\n\n/**\n * V1: Read receipt file\n * @param installRoot - The install root directory\n * @returns Receipt object or null if not found\n */\nexport async function readReceipt(installRoot: string): Promise<Receipt | null> {\n\tconst { path: receiptPath, exists } = findReceipt(installRoot)\n\n\tif (!exists) {\n\t\treturn null\n\t}\n\n\tconst file = Bun.file(receiptPath)\n\tconst content = await file.text()\n\tconst json = parseJsonc(content, [], { allowTrailingComma: true })\n\treturn receiptSchema.parse(json)\n}\n\n/**\n * V1: Write receipt file\n * @param installRoot - The install root directory\n * @param receipt - Receipt data to write\n */\nexport async function writeReceipt(installRoot: string, receipt: Receipt): Promise<void> {\n\tconst receiptPath = path.join(installRoot, RECEIPT_DIR, RECEIPT_FILE)\n\n\t// Ensure directory exists\n\tawait mkdir(path.dirname(receiptPath), { recursive: true })\n\n\tconst content = JSON.stringify(receipt, null, 2)\n\tawait Bun.write(receiptPath, content)\n}\n\n// =============================================================================\n// CONFIG FILE HELPERS (Bun-specific I/O)\n// =============================================================================\n\nconst CONFIG_FILE = \"ocx.jsonc\"\nconst LOCK_FILE = \"ocx.lock\"\nconst LOCAL_CONFIG_DIR = \".opencode\"\n\n/**\n * Find ocx.jsonc config file path.\n * Checks .opencode/ first, then root. Fails if both exist.\n * @returns Object with path and whether it exists, or throws if conflict\n */\nexport function findOcxConfig(cwd: string): { path: string; exists: boolean } {\n\tconst dotOpencodePath = path.join(cwd, LOCAL_CONFIG_DIR, CONFIG_FILE)\n\tconst rootPath = path.join(cwd, CONFIG_FILE)\n\n\tconst dotOpencodeExists = existsSync(dotOpencodePath)\n\tconst rootExists = existsSync(rootPath)\n\n\t// Fail if both exist - user needs to consolidate\n\tif (dotOpencodeExists && rootExists) {\n\t\tthrow new Error(\n\t\t\t`Found ${CONFIG_FILE} in both .opencode/ and project root. ` +\n\t\t\t\t`Please consolidate to one location (recommended: .opencode/${CONFIG_FILE})`,\n\t\t)\n\t}\n\n\tif (dotOpencodeExists) {\n\t\treturn { path: dotOpencodePath, exists: true }\n\t}\n\n\tif (rootExists) {\n\t\treturn { path: rootPath, exists: true }\n\t}\n\n\t// Neither exists - default to .opencode/ for new files\n\treturn { path: dotOpencodePath, exists: false }\n}\n\n/**\n * Find ocx.lock lockfile path.\n * Checks .opencode/ first, then root.\n * @param cwd - Working directory\n * @param options - Optional settings for path resolution\n * @returns Object with path and whether it exists\n */\nexport function findOcxLock(\n\tcwd: string,\n\toptions?: { isFlattened?: boolean },\n): { path: string; exists: boolean } {\n\tconst dotOpencodePath = path.join(cwd, LOCAL_CONFIG_DIR, LOCK_FILE)\n\tconst rootPath = path.join(cwd, LOCK_FILE)\n\n\tif (options?.isFlattened) {\n\t\t// Flattened mode (global/profile): prefer root, ignore .opencode/\n\t\tif (existsSync(rootPath)) {\n\t\t\treturn { path: rootPath, exists: true }\n\t\t}\n\t\treturn { path: rootPath, exists: false }\n\t}\n\n\t// Local mode: prefer .opencode/, fallback to root\n\tif (existsSync(dotOpencodePath)) {\n\t\treturn { path: dotOpencodePath, exists: true }\n\t}\n\n\tif (existsSync(rootPath)) {\n\t\treturn { path: rootPath, exists: true }\n\t}\n\n\treturn { path: dotOpencodePath, exists: false }\n}\n\n/**\n * Read ocx.jsonc config file\n */\nexport async function readOcxConfig(\n\tcwd: string,\n\toptions: ReadOcxConfigOptions = {},\n): Promise<OcxConfig | null> {\n\tconst { path: configPath, exists } = findOcxConfig(cwd)\n\n\tif (!exists) {\n\t\treturn null\n\t}\n\n\tconst file = Bun.file(configPath)\n\tconst content = await file.text()\n\ttry {\n\t\tconst json = parseJsonc(content, [], { allowTrailingComma: true })\n\t\treturn ocxConfigSchema.parse(json)\n\t} catch (error) {\n\t\tif (options.emitParseDiagnostics ?? true) {\n\t\t\tconsole.error(`Error parsing ${configPath}:`, error)\n\t\t}\n\t\tthrow error\n\t}\n}\n\n/**\n * Write ocx.jsonc config file.\n * @param cwd - Working directory\n * @param config - Config to write\n * @param existingPath - If provided, write to this path (for updates). Otherwise use .opencode/\n */\nexport async function writeOcxConfig(\n\tcwd: string,\n\tconfig: OcxConfig,\n\texistingPath?: string,\n): Promise<void> {\n\tconst configPath = existingPath ?? path.join(cwd, LOCAL_CONFIG_DIR, CONFIG_FILE)\n\n\t// Ensure directory exists\n\tawait mkdir(path.dirname(configPath), { recursive: true })\n\n\tconst content = JSON.stringify(config, null, 2)\n\tawait Bun.write(configPath, content)\n}\n\n/**\n * Read ocx.lock lockfile\n */\nexport async function readOcxLock(\n\tcwd: string,\n\toptions?: { isFlattened?: boolean },\n): Promise<OcxLock | null> {\n\tconst { path: lockPath, exists } = findOcxLock(cwd, options)\n\n\tif (!exists) {\n\t\treturn null\n\t}\n\n\tconst file = Bun.file(lockPath)\n\tconst content = await file.text()\n\tconst json = parseJsonc(content, [], { allowTrailingComma: true })\n\treturn ocxLockSchema.parse(json)\n}\n\n/**\n * Write ocx.lock lockfile.\n * @param cwd - Working directory\n * @param lock - Lock data to write\n * @param existingPath - If provided, write to this path (for updates). Otherwise use .opencode/\n */\nexport async function writeOcxLock(\n\tcwd: string,\n\tlock: OcxLock,\n\texistingPath?: string,\n): Promise<void> {\n\tconst lockPath = existingPath ?? path.join(cwd, LOCAL_CONFIG_DIR, LOCK_FILE)\n\n\t// Ensure directory exists\n\tawait mkdir(path.dirname(lockPath), { recursive: true })\n\n\tconst content = JSON.stringify(lock, null, 2)\n\tawait Bun.write(lockPath, content)\n}\n",
33
- "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n/**\n * Creates a JSON scanner on the given text.\n * If ignoreTrivia is set, whitespaces or comments are ignored.\n */\nexport function createScanner(text, ignoreTrivia = false) {\n const len = text.length;\n let pos = 0, value = '', tokenOffset = 0, token = 16 /* SyntaxKind.Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* ScanError.None */;\n function scanHexDigits(count, exact) {\n let digits = 0;\n let value = 0;\n while (digits < count || !exact) {\n let ch = text.charCodeAt(pos);\n if (ch >= 48 /* CharacterCodes._0 */ && ch <= 57 /* CharacterCodes._9 */) {\n value = value * 16 + ch - 48 /* CharacterCodes._0 */;\n }\n else if (ch >= 65 /* CharacterCodes.A */ && ch <= 70 /* CharacterCodes.F */) {\n value = value * 16 + ch - 65 /* CharacterCodes.A */ + 10;\n }\n else if (ch >= 97 /* CharacterCodes.a */ && ch <= 102 /* CharacterCodes.f */) {\n value = value * 16 + ch - 97 /* CharacterCodes.a */ + 10;\n }\n else {\n break;\n }\n pos++;\n digits++;\n }\n if (digits < count) {\n value = -1;\n }\n return value;\n }\n function setPosition(newPosition) {\n pos = newPosition;\n value = '';\n tokenOffset = 0;\n token = 16 /* SyntaxKind.Unknown */;\n scanError = 0 /* ScanError.None */;\n }\n function scanNumber() {\n let start = pos;\n if (text.charCodeAt(pos) === 48 /* CharacterCodes._0 */) {\n pos++;\n }\n else {\n pos++;\n while (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n }\n }\n if (pos < text.length && text.charCodeAt(pos) === 46 /* CharacterCodes.dot */) {\n pos++;\n if (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n while (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n }\n }\n else {\n scanError = 3 /* ScanError.UnexpectedEndOfNumber */;\n return text.substring(start, pos);\n }\n }\n let end = pos;\n if (pos < text.length && (text.charCodeAt(pos) === 69 /* CharacterCodes.E */ || text.charCodeAt(pos) === 101 /* CharacterCodes.e */)) {\n pos++;\n if (pos < text.length && text.charCodeAt(pos) === 43 /* CharacterCodes.plus */ || text.charCodeAt(pos) === 45 /* CharacterCodes.minus */) {\n pos++;\n }\n if (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n while (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n }\n end = pos;\n }\n else {\n scanError = 3 /* ScanError.UnexpectedEndOfNumber */;\n }\n }\n return text.substring(start, end);\n }\n function scanString() {\n let result = '', start = pos;\n while (true) {\n if (pos >= len) {\n result += text.substring(start, pos);\n scanError = 2 /* ScanError.UnexpectedEndOfString */;\n break;\n }\n const ch = text.charCodeAt(pos);\n if (ch === 34 /* CharacterCodes.doubleQuote */) {\n result += text.substring(start, pos);\n pos++;\n break;\n }\n if (ch === 92 /* CharacterCodes.backslash */) {\n result += text.substring(start, pos);\n pos++;\n if (pos >= len) {\n scanError = 2 /* ScanError.UnexpectedEndOfString */;\n break;\n }\n const ch2 = text.charCodeAt(pos++);\n switch (ch2) {\n case 34 /* CharacterCodes.doubleQuote */:\n result += '\\\"';\n break;\n case 92 /* CharacterCodes.backslash */:\n result += '\\\\';\n break;\n case 47 /* CharacterCodes.slash */:\n result += '/';\n break;\n case 98 /* CharacterCodes.b */:\n result += '\\b';\n break;\n case 102 /* CharacterCodes.f */:\n result += '\\f';\n break;\n case 110 /* CharacterCodes.n */:\n result += '\\n';\n break;\n case 114 /* CharacterCodes.r */:\n result += '\\r';\n break;\n case 116 /* CharacterCodes.t */:\n result += '\\t';\n break;\n case 117 /* CharacterCodes.u */:\n const ch3 = scanHexDigits(4, true);\n if (ch3 >= 0) {\n result += String.fromCharCode(ch3);\n }\n else {\n scanError = 4 /* ScanError.InvalidUnicode */;\n }\n break;\n default:\n scanError = 5 /* ScanError.InvalidEscapeCharacter */;\n }\n start = pos;\n continue;\n }\n if (ch >= 0 && ch <= 0x1f) {\n if (isLineBreak(ch)) {\n result += text.substring(start, pos);\n scanError = 2 /* ScanError.UnexpectedEndOfString */;\n break;\n }\n else {\n scanError = 6 /* ScanError.InvalidCharacter */;\n // mark as error but continue with string\n }\n }\n pos++;\n }\n return result;\n }\n function scanNext() {\n value = '';\n scanError = 0 /* ScanError.None */;\n tokenOffset = pos;\n lineStartOffset = lineNumber;\n prevTokenLineStartOffset = tokenLineStartOffset;\n if (pos >= len) {\n // at the end\n tokenOffset = len;\n return token = 17 /* SyntaxKind.EOF */;\n }\n let code = text.charCodeAt(pos);\n // trivia: whitespace\n if (isWhiteSpace(code)) {\n do {\n pos++;\n value += String.fromCharCode(code);\n code = text.charCodeAt(pos);\n } while (isWhiteSpace(code));\n return token = 15 /* SyntaxKind.Trivia */;\n }\n // trivia: newlines\n if (isLineBreak(code)) {\n pos++;\n value += String.fromCharCode(code);\n if (code === 13 /* CharacterCodes.carriageReturn */ && text.charCodeAt(pos) === 10 /* CharacterCodes.lineFeed */) {\n pos++;\n value += '\\n';\n }\n lineNumber++;\n tokenLineStartOffset = pos;\n return token = 14 /* SyntaxKind.LineBreakTrivia */;\n }\n switch (code) {\n // tokens: []{}:,\n case 123 /* CharacterCodes.openBrace */:\n pos++;\n return token = 1 /* SyntaxKind.OpenBraceToken */;\n case 125 /* CharacterCodes.closeBrace */:\n pos++;\n return token = 2 /* SyntaxKind.CloseBraceToken */;\n case 91 /* CharacterCodes.openBracket */:\n pos++;\n return token = 3 /* SyntaxKind.OpenBracketToken */;\n case 93 /* CharacterCodes.closeBracket */:\n pos++;\n return token = 4 /* SyntaxKind.CloseBracketToken */;\n case 58 /* CharacterCodes.colon */:\n pos++;\n return token = 6 /* SyntaxKind.ColonToken */;\n case 44 /* CharacterCodes.comma */:\n pos++;\n return token = 5 /* SyntaxKind.CommaToken */;\n // strings\n case 34 /* CharacterCodes.doubleQuote */:\n pos++;\n value = scanString();\n return token = 10 /* SyntaxKind.StringLiteral */;\n // comments\n case 47 /* CharacterCodes.slash */:\n const start = pos - 1;\n // Single-line comment\n if (text.charCodeAt(pos + 1) === 47 /* CharacterCodes.slash */) {\n pos += 2;\n while (pos < len) {\n if (isLineBreak(text.charCodeAt(pos))) {\n break;\n }\n pos++;\n }\n value = text.substring(start, pos);\n return token = 12 /* SyntaxKind.LineCommentTrivia */;\n }\n // Multi-line comment\n if (text.charCodeAt(pos + 1) === 42 /* CharacterCodes.asterisk */) {\n pos += 2;\n const safeLength = len - 1; // For lookahead.\n let commentClosed = false;\n while (pos < safeLength) {\n const ch = text.charCodeAt(pos);\n if (ch === 42 /* CharacterCodes.asterisk */ && text.charCodeAt(pos + 1) === 47 /* CharacterCodes.slash */) {\n pos += 2;\n commentClosed = true;\n break;\n }\n pos++;\n if (isLineBreak(ch)) {\n if (ch === 13 /* CharacterCodes.carriageReturn */ && text.charCodeAt(pos) === 10 /* CharacterCodes.lineFeed */) {\n pos++;\n }\n lineNumber++;\n tokenLineStartOffset = pos;\n }\n }\n if (!commentClosed) {\n pos++;\n scanError = 1 /* ScanError.UnexpectedEndOfComment */;\n }\n value = text.substring(start, pos);\n return token = 13 /* SyntaxKind.BlockCommentTrivia */;\n }\n // just a single slash\n value += String.fromCharCode(code);\n pos++;\n return token = 16 /* SyntaxKind.Unknown */;\n // numbers\n case 45 /* CharacterCodes.minus */:\n value += String.fromCharCode(code);\n pos++;\n if (pos === len || !isDigit(text.charCodeAt(pos))) {\n return token = 16 /* SyntaxKind.Unknown */;\n }\n // found a minus, followed by a number so\n // we fall through to proceed with scanning\n // numbers\n case 48 /* CharacterCodes._0 */:\n case 49 /* CharacterCodes._1 */:\n case 50 /* CharacterCodes._2 */:\n case 51 /* CharacterCodes._3 */:\n case 52 /* CharacterCodes._4 */:\n case 53 /* CharacterCodes._5 */:\n case 54 /* CharacterCodes._6 */:\n case 55 /* CharacterCodes._7 */:\n case 56 /* CharacterCodes._8 */:\n case 57 /* CharacterCodes._9 */:\n value += scanNumber();\n return token = 11 /* SyntaxKind.NumericLiteral */;\n // literals and unknown symbols\n default:\n // is a literal? Read the full word.\n while (pos < len && isUnknownContentCharacter(code)) {\n pos++;\n code = text.charCodeAt(pos);\n }\n if (tokenOffset !== pos) {\n value = text.substring(tokenOffset, pos);\n // keywords: true, false, null\n switch (value) {\n case 'true': return token = 8 /* SyntaxKind.TrueKeyword */;\n case 'false': return token = 9 /* SyntaxKind.FalseKeyword */;\n case 'null': return token = 7 /* SyntaxKind.NullKeyword */;\n }\n return token = 16 /* SyntaxKind.Unknown */;\n }\n // some\n value += String.fromCharCode(code);\n pos++;\n return token = 16 /* SyntaxKind.Unknown */;\n }\n }\n function isUnknownContentCharacter(code) {\n if (isWhiteSpace(code) || isLineBreak(code)) {\n return false;\n }\n switch (code) {\n case 125 /* CharacterCodes.closeBrace */:\n case 93 /* CharacterCodes.closeBracket */:\n case 123 /* CharacterCodes.openBrace */:\n case 91 /* CharacterCodes.openBracket */:\n case 34 /* CharacterCodes.doubleQuote */:\n case 58 /* CharacterCodes.colon */:\n case 44 /* CharacterCodes.comma */:\n case 47 /* CharacterCodes.slash */:\n return false;\n }\n return true;\n }\n function scanNextNonTrivia() {\n let result;\n do {\n result = scanNext();\n } while (result >= 12 /* SyntaxKind.LineCommentTrivia */ && result <= 15 /* SyntaxKind.Trivia */);\n return result;\n }\n return {\n setPosition: setPosition,\n getPosition: () => pos,\n scan: ignoreTrivia ? scanNextNonTrivia : scanNext,\n getToken: () => token,\n getTokenValue: () => value,\n getTokenOffset: () => tokenOffset,\n getTokenLength: () => pos - tokenOffset,\n getTokenStartLine: () => lineStartOffset,\n getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,\n getTokenError: () => scanError,\n };\n}\nfunction isWhiteSpace(ch) {\n return ch === 32 /* CharacterCodes.space */ || ch === 9 /* CharacterCodes.tab */;\n}\nfunction isLineBreak(ch) {\n return ch === 10 /* CharacterCodes.lineFeed */ || ch === 13 /* CharacterCodes.carriageReturn */;\n}\nfunction isDigit(ch) {\n return ch >= 48 /* CharacterCodes._0 */ && ch <= 57 /* CharacterCodes._9 */;\n}\nvar CharacterCodes;\n(function (CharacterCodes) {\n CharacterCodes[CharacterCodes[\"lineFeed\"] = 10] = \"lineFeed\";\n CharacterCodes[CharacterCodes[\"carriageReturn\"] = 13] = \"carriageReturn\";\n CharacterCodes[CharacterCodes[\"space\"] = 32] = \"space\";\n CharacterCodes[CharacterCodes[\"_0\"] = 48] = \"_0\";\n CharacterCodes[CharacterCodes[\"_1\"] = 49] = \"_1\";\n CharacterCodes[CharacterCodes[\"_2\"] = 50] = \"_2\";\n CharacterCodes[CharacterCodes[\"_3\"] = 51] = \"_3\";\n CharacterCodes[CharacterCodes[\"_4\"] = 52] = \"_4\";\n CharacterCodes[CharacterCodes[\"_5\"] = 53] = \"_5\";\n CharacterCodes[CharacterCodes[\"_6\"] = 54] = \"_6\";\n CharacterCodes[CharacterCodes[\"_7\"] = 55] = \"_7\";\n CharacterCodes[CharacterCodes[\"_8\"] = 56] = \"_8\";\n CharacterCodes[CharacterCodes[\"_9\"] = 57] = \"_9\";\n CharacterCodes[CharacterCodes[\"a\"] = 97] = \"a\";\n CharacterCodes[CharacterCodes[\"b\"] = 98] = \"b\";\n CharacterCodes[CharacterCodes[\"c\"] = 99] = \"c\";\n CharacterCodes[CharacterCodes[\"d\"] = 100] = \"d\";\n CharacterCodes[CharacterCodes[\"e\"] = 101] = \"e\";\n CharacterCodes[CharacterCodes[\"f\"] = 102] = \"f\";\n CharacterCodes[CharacterCodes[\"g\"] = 103] = \"g\";\n CharacterCodes[CharacterCodes[\"h\"] = 104] = \"h\";\n CharacterCodes[CharacterCodes[\"i\"] = 105] = \"i\";\n CharacterCodes[CharacterCodes[\"j\"] = 106] = \"j\";\n CharacterCodes[CharacterCodes[\"k\"] = 107] = \"k\";\n CharacterCodes[CharacterCodes[\"l\"] = 108] = \"l\";\n CharacterCodes[CharacterCodes[\"m\"] = 109] = \"m\";\n CharacterCodes[CharacterCodes[\"n\"] = 110] = \"n\";\n CharacterCodes[CharacterCodes[\"o\"] = 111] = \"o\";\n CharacterCodes[CharacterCodes[\"p\"] = 112] = \"p\";\n CharacterCodes[CharacterCodes[\"q\"] = 113] = \"q\";\n CharacterCodes[CharacterCodes[\"r\"] = 114] = \"r\";\n CharacterCodes[CharacterCodes[\"s\"] = 115] = \"s\";\n CharacterCodes[CharacterCodes[\"t\"] = 116] = \"t\";\n CharacterCodes[CharacterCodes[\"u\"] = 117] = \"u\";\n CharacterCodes[CharacterCodes[\"v\"] = 118] = \"v\";\n CharacterCodes[CharacterCodes[\"w\"] = 119] = \"w\";\n CharacterCodes[CharacterCodes[\"x\"] = 120] = \"x\";\n CharacterCodes[CharacterCodes[\"y\"] = 121] = \"y\";\n CharacterCodes[CharacterCodes[\"z\"] = 122] = \"z\";\n CharacterCodes[CharacterCodes[\"A\"] = 65] = \"A\";\n CharacterCodes[CharacterCodes[\"B\"] = 66] = \"B\";\n CharacterCodes[CharacterCodes[\"C\"] = 67] = \"C\";\n CharacterCodes[CharacterCodes[\"D\"] = 68] = \"D\";\n CharacterCodes[CharacterCodes[\"E\"] = 69] = \"E\";\n CharacterCodes[CharacterCodes[\"F\"] = 70] = \"F\";\n CharacterCodes[CharacterCodes[\"G\"] = 71] = \"G\";\n CharacterCodes[CharacterCodes[\"H\"] = 72] = \"H\";\n CharacterCodes[CharacterCodes[\"I\"] = 73] = \"I\";\n CharacterCodes[CharacterCodes[\"J\"] = 74] = \"J\";\n CharacterCodes[CharacterCodes[\"K\"] = 75] = \"K\";\n CharacterCodes[CharacterCodes[\"L\"] = 76] = \"L\";\n CharacterCodes[CharacterCodes[\"M\"] = 77] = \"M\";\n CharacterCodes[CharacterCodes[\"N\"] = 78] = \"N\";\n CharacterCodes[CharacterCodes[\"O\"] = 79] = \"O\";\n CharacterCodes[CharacterCodes[\"P\"] = 80] = \"P\";\n CharacterCodes[CharacterCodes[\"Q\"] = 81] = \"Q\";\n CharacterCodes[CharacterCodes[\"R\"] = 82] = \"R\";\n CharacterCodes[CharacterCodes[\"S\"] = 83] = \"S\";\n CharacterCodes[CharacterCodes[\"T\"] = 84] = \"T\";\n CharacterCodes[CharacterCodes[\"U\"] = 85] = \"U\";\n CharacterCodes[CharacterCodes[\"V\"] = 86] = \"V\";\n CharacterCodes[CharacterCodes[\"W\"] = 87] = \"W\";\n CharacterCodes[CharacterCodes[\"X\"] = 88] = \"X\";\n CharacterCodes[CharacterCodes[\"Y\"] = 89] = \"Y\";\n CharacterCodes[CharacterCodes[\"Z\"] = 90] = \"Z\";\n CharacterCodes[CharacterCodes[\"asterisk\"] = 42] = \"asterisk\";\n CharacterCodes[CharacterCodes[\"backslash\"] = 92] = \"backslash\";\n CharacterCodes[CharacterCodes[\"closeBrace\"] = 125] = \"closeBrace\";\n CharacterCodes[CharacterCodes[\"closeBracket\"] = 93] = \"closeBracket\";\n CharacterCodes[CharacterCodes[\"colon\"] = 58] = \"colon\";\n CharacterCodes[CharacterCodes[\"comma\"] = 44] = \"comma\";\n CharacterCodes[CharacterCodes[\"dot\"] = 46] = \"dot\";\n CharacterCodes[CharacterCodes[\"doubleQuote\"] = 34] = \"doubleQuote\";\n CharacterCodes[CharacterCodes[\"minus\"] = 45] = \"minus\";\n CharacterCodes[CharacterCodes[\"openBrace\"] = 123] = \"openBrace\";\n CharacterCodes[CharacterCodes[\"openBracket\"] = 91] = \"openBracket\";\n CharacterCodes[CharacterCodes[\"plus\"] = 43] = \"plus\";\n CharacterCodes[CharacterCodes[\"slash\"] = 47] = \"slash\";\n CharacterCodes[CharacterCodes[\"formFeed\"] = 12] = \"formFeed\";\n CharacterCodes[CharacterCodes[\"tab\"] = 9] = \"tab\";\n})(CharacterCodes || (CharacterCodes = {}));\n",
34
- "export const cachedSpaces = new Array(20).fill(0).map((_, index) => {\n return ' '.repeat(index);\n});\nconst maxCachedValues = 200;\nexport const cachedBreakLinesWithSpaces = {\n ' ': {\n '\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\n' + ' '.repeat(index);\n }),\n '\\r': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r' + ' '.repeat(index);\n }),\n '\\r\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r\\n' + ' '.repeat(index);\n }),\n },\n '\\t': {\n '\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\n' + '\\t'.repeat(index);\n }),\n '\\r': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r' + '\\t'.repeat(index);\n }),\n '\\r\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r\\n' + '\\t'.repeat(index);\n }),\n }\n};\nexport const supportedEols = ['\\n', '\\r', '\\r\\n'];\n",
35
- "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport { createScanner } from './scanner';\nimport { cachedSpaces, cachedBreakLinesWithSpaces, supportedEols } from './string-intern';\nexport function format(documentText, range, options) {\n let initialIndentLevel;\n let formatText;\n let formatTextStart;\n let rangeStart;\n let rangeEnd;\n if (range) {\n rangeStart = range.offset;\n rangeEnd = rangeStart + range.length;\n formatTextStart = rangeStart;\n while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {\n formatTextStart--;\n }\n let endOffset = rangeEnd;\n while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {\n endOffset++;\n }\n formatText = documentText.substring(formatTextStart, endOffset);\n initialIndentLevel = computeIndentLevel(formatText, options);\n }\n else {\n formatText = documentText;\n initialIndentLevel = 0;\n formatTextStart = 0;\n rangeStart = 0;\n rangeEnd = documentText.length;\n }\n const eol = getEOL(options, documentText);\n const eolFastPathSupported = supportedEols.includes(eol);\n let numberLineBreaks = 0;\n let indentLevel = 0;\n let indentValue;\n if (options.insertSpaces) {\n indentValue = cachedSpaces[options.tabSize || 4] ?? repeat(cachedSpaces[1], options.tabSize || 4);\n }\n else {\n indentValue = '\\t';\n }\n const indentType = indentValue === '\\t' ? '\\t' : ' ';\n let scanner = createScanner(formatText, false);\n let hasError = false;\n function newLinesAndIndent() {\n if (numberLineBreaks > 1) {\n return repeat(eol, numberLineBreaks) + repeat(indentValue, initialIndentLevel + indentLevel);\n }\n const amountOfSpaces = indentValue.length * (initialIndentLevel + indentLevel);\n if (!eolFastPathSupported || amountOfSpaces > cachedBreakLinesWithSpaces[indentType][eol].length) {\n return eol + repeat(indentValue, initialIndentLevel + indentLevel);\n }\n if (amountOfSpaces <= 0) {\n return eol;\n }\n return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces];\n }\n function scanNext() {\n let token = scanner.scan();\n numberLineBreaks = 0;\n while (token === 15 /* SyntaxKind.Trivia */ || token === 14 /* SyntaxKind.LineBreakTrivia */) {\n if (token === 14 /* SyntaxKind.LineBreakTrivia */ && options.keepLines) {\n numberLineBreaks += 1;\n }\n else if (token === 14 /* SyntaxKind.LineBreakTrivia */) {\n numberLineBreaks = 1;\n }\n token = scanner.scan();\n }\n hasError = token === 16 /* SyntaxKind.Unknown */ || scanner.getTokenError() !== 0 /* ScanError.None */;\n return token;\n }\n const editOperations = [];\n function addEdit(text, startOffset, endOffset) {\n if (!hasError && (!range || (startOffset < rangeEnd && endOffset > rangeStart)) && documentText.substring(startOffset, endOffset) !== text) {\n editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });\n }\n }\n let firstToken = scanNext();\n if (options.keepLines && numberLineBreaks > 0) {\n addEdit(repeat(eol, numberLineBreaks), 0, 0);\n }\n if (firstToken !== 17 /* SyntaxKind.EOF */) {\n let firstTokenStart = scanner.getTokenOffset() + formatTextStart;\n let initialIndent = (indentValue.length * initialIndentLevel < 20) && options.insertSpaces\n ? cachedSpaces[indentValue.length * initialIndentLevel]\n : repeat(indentValue, initialIndentLevel);\n addEdit(initialIndent, formatTextStart, firstTokenStart);\n }\n while (firstToken !== 17 /* SyntaxKind.EOF */) {\n let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;\n let secondToken = scanNext();\n let replaceContent = '';\n let needsLineBreak = false;\n while (numberLineBreaks === 0 && (secondToken === 12 /* SyntaxKind.LineCommentTrivia */ || secondToken === 13 /* SyntaxKind.BlockCommentTrivia */)) {\n let commentTokenStart = scanner.getTokenOffset() + formatTextStart;\n addEdit(cachedSpaces[1], firstTokenEnd, commentTokenStart);\n firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;\n needsLineBreak = secondToken === 12 /* SyntaxKind.LineCommentTrivia */;\n replaceContent = needsLineBreak ? newLinesAndIndent() : '';\n secondToken = scanNext();\n }\n if (secondToken === 2 /* SyntaxKind.CloseBraceToken */) {\n if (firstToken !== 1 /* SyntaxKind.OpenBraceToken */) {\n indentLevel--;\n }\n ;\n if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1 /* SyntaxKind.OpenBraceToken */) {\n replaceContent = newLinesAndIndent();\n }\n else if (options.keepLines) {\n replaceContent = cachedSpaces[1];\n }\n }\n else if (secondToken === 4 /* SyntaxKind.CloseBracketToken */) {\n if (firstToken !== 3 /* SyntaxKind.OpenBracketToken */) {\n indentLevel--;\n }\n ;\n if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3 /* SyntaxKind.OpenBracketToken */) {\n replaceContent = newLinesAndIndent();\n }\n else if (options.keepLines) {\n replaceContent = cachedSpaces[1];\n }\n }\n else {\n switch (firstToken) {\n case 3 /* SyntaxKind.OpenBracketToken */:\n case 1 /* SyntaxKind.OpenBraceToken */:\n indentLevel++;\n if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {\n replaceContent = newLinesAndIndent();\n }\n else {\n replaceContent = cachedSpaces[1];\n }\n break;\n case 5 /* SyntaxKind.CommaToken */:\n if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {\n replaceContent = newLinesAndIndent();\n }\n else {\n replaceContent = cachedSpaces[1];\n }\n break;\n case 12 /* SyntaxKind.LineCommentTrivia */:\n replaceContent = newLinesAndIndent();\n break;\n case 13 /* SyntaxKind.BlockCommentTrivia */:\n if (numberLineBreaks > 0) {\n replaceContent = newLinesAndIndent();\n }\n else if (!needsLineBreak) {\n replaceContent = cachedSpaces[1];\n }\n break;\n case 6 /* SyntaxKind.ColonToken */:\n if (options.keepLines && numberLineBreaks > 0) {\n replaceContent = newLinesAndIndent();\n }\n else if (!needsLineBreak) {\n replaceContent = cachedSpaces[1];\n }\n break;\n case 10 /* SyntaxKind.StringLiteral */:\n if (options.keepLines && numberLineBreaks > 0) {\n replaceContent = newLinesAndIndent();\n }\n else if (secondToken === 6 /* SyntaxKind.ColonToken */ && !needsLineBreak) {\n replaceContent = '';\n }\n break;\n case 7 /* SyntaxKind.NullKeyword */:\n case 8 /* SyntaxKind.TrueKeyword */:\n case 9 /* SyntaxKind.FalseKeyword */:\n case 11 /* SyntaxKind.NumericLiteral */:\n case 2 /* SyntaxKind.CloseBraceToken */:\n case 4 /* SyntaxKind.CloseBracketToken */:\n if (options.keepLines && numberLineBreaks > 0) {\n replaceContent = newLinesAndIndent();\n }\n else {\n if ((secondToken === 12 /* SyntaxKind.LineCommentTrivia */ || secondToken === 13 /* SyntaxKind.BlockCommentTrivia */) && !needsLineBreak) {\n replaceContent = cachedSpaces[1];\n }\n else if (secondToken !== 5 /* SyntaxKind.CommaToken */ && secondToken !== 17 /* SyntaxKind.EOF */) {\n hasError = true;\n }\n }\n break;\n case 16 /* SyntaxKind.Unknown */:\n hasError = true;\n break;\n }\n if (numberLineBreaks > 0 && (secondToken === 12 /* SyntaxKind.LineCommentTrivia */ || secondToken === 13 /* SyntaxKind.BlockCommentTrivia */)) {\n replaceContent = newLinesAndIndent();\n }\n }\n if (secondToken === 17 /* SyntaxKind.EOF */) {\n if (options.keepLines && numberLineBreaks > 0) {\n replaceContent = newLinesAndIndent();\n }\n else {\n replaceContent = options.insertFinalNewline ? eol : '';\n }\n }\n const secondTokenStart = scanner.getTokenOffset() + formatTextStart;\n addEdit(replaceContent, firstTokenEnd, secondTokenStart);\n firstToken = secondToken;\n }\n return editOperations;\n}\nfunction repeat(s, count) {\n let result = '';\n for (let i = 0; i < count; i++) {\n result += s;\n }\n return result;\n}\nfunction computeIndentLevel(content, options) {\n let i = 0;\n let nChars = 0;\n const tabSize = options.tabSize || 4;\n while (i < content.length) {\n let ch = content.charAt(i);\n if (ch === cachedSpaces[1]) {\n nChars++;\n }\n else if (ch === '\\t') {\n nChars += tabSize;\n }\n else {\n break;\n }\n i++;\n }\n return Math.floor(nChars / tabSize);\n}\nfunction getEOL(options, text) {\n for (let i = 0; i < text.length; i++) {\n const ch = text.charAt(i);\n if (ch === '\\r') {\n if (i + 1 < text.length && text.charAt(i + 1) === '\\n') {\n return '\\r\\n';\n }\n return '\\r';\n }\n else if (ch === '\\n') {\n return '\\n';\n }\n }\n return (options && options.eol) || '\\n';\n}\nexport function isEOL(text, offset) {\n return '\\r\\n'.indexOf(text.charAt(offset)) !== -1;\n}\n",
36
- "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport { createScanner } from './scanner';\nvar ParseOptions;\n(function (ParseOptions) {\n ParseOptions.DEFAULT = {\n allowTrailingComma: false\n };\n})(ParseOptions || (ParseOptions = {}));\n/**\n * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.\n */\nexport function getLocation(text, position) {\n const segments = []; // strings or numbers\n const earlyReturnException = new Object();\n let previousNode = undefined;\n const previousNodeInst = {\n value: {},\n offset: 0,\n length: 0,\n type: 'object',\n parent: undefined\n };\n let isAtPropertyKey = false;\n function setPreviousNode(value, offset, length, type) {\n previousNodeInst.value = value;\n previousNodeInst.offset = offset;\n previousNodeInst.length = length;\n previousNodeInst.type = type;\n previousNodeInst.colonOffset = undefined;\n previousNode = previousNodeInst;\n }\n try {\n visit(text, {\n onObjectBegin: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n isAtPropertyKey = position > offset;\n segments.push(''); // push a placeholder (will be replaced)\n },\n onObjectProperty: (name, offset, length) => {\n if (position < offset) {\n throw earlyReturnException;\n }\n setPreviousNode(name, offset, length, 'property');\n segments[segments.length - 1] = name;\n if (position <= offset + length) {\n throw earlyReturnException;\n }\n },\n onObjectEnd: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n segments.pop();\n },\n onArrayBegin: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n segments.push(0);\n },\n onArrayEnd: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n segments.pop();\n },\n onLiteralValue: (value, offset, length) => {\n if (position < offset) {\n throw earlyReturnException;\n }\n setPreviousNode(value, offset, length, getNodeType(value));\n if (position <= offset + length) {\n throw earlyReturnException;\n }\n },\n onSeparator: (sep, offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n if (sep === ':' && previousNode && previousNode.type === 'property') {\n previousNode.colonOffset = offset;\n isAtPropertyKey = false;\n previousNode = undefined;\n }\n else if (sep === ',') {\n const last = segments[segments.length - 1];\n if (typeof last === 'number') {\n segments[segments.length - 1] = last + 1;\n }\n else {\n isAtPropertyKey = true;\n segments[segments.length - 1] = '';\n }\n previousNode = undefined;\n }\n }\n });\n }\n catch (e) {\n if (e !== earlyReturnException) {\n throw e;\n }\n }\n return {\n path: segments,\n previousNode,\n isAtPropertyKey,\n matches: (pattern) => {\n let k = 0;\n for (let i = 0; k < pattern.length && i < segments.length; i++) {\n if (pattern[k] === segments[i] || pattern[k] === '*') {\n k++;\n }\n else if (pattern[k] !== '**') {\n return false;\n }\n }\n return k === pattern.length;\n }\n };\n}\n/**\n * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n * Therefore always check the errors list to find out if the input was valid.\n */\nexport function parse(text, errors = [], options = ParseOptions.DEFAULT) {\n let currentProperty = null;\n let currentParent = [];\n const previousParents = [];\n function onValue(value) {\n if (Array.isArray(currentParent)) {\n currentParent.push(value);\n }\n else if (currentProperty !== null) {\n currentParent[currentProperty] = value;\n }\n }\n const visitor = {\n onObjectBegin: () => {\n const object = {};\n onValue(object);\n previousParents.push(currentParent);\n currentParent = object;\n currentProperty = null;\n },\n onObjectProperty: (name) => {\n currentProperty = name;\n },\n onObjectEnd: () => {\n currentParent = previousParents.pop();\n },\n onArrayBegin: () => {\n const array = [];\n onValue(array);\n previousParents.push(currentParent);\n currentParent = array;\n currentProperty = null;\n },\n onArrayEnd: () => {\n currentParent = previousParents.pop();\n },\n onLiteralValue: onValue,\n onError: (error, offset, length) => {\n errors.push({ error, offset, length });\n }\n };\n visit(text, visitor, options);\n return currentParent[0];\n}\n/**\n * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n */\nexport function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {\n let currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root\n function ensurePropertyComplete(endOffset) {\n if (currentParent.type === 'property') {\n currentParent.length = endOffset - currentParent.offset;\n currentParent = currentParent.parent;\n }\n }\n function onValue(valueNode) {\n currentParent.children.push(valueNode);\n return valueNode;\n }\n const visitor = {\n onObjectBegin: (offset) => {\n currentParent = onValue({ type: 'object', offset, length: -1, parent: currentParent, children: [] });\n },\n onObjectProperty: (name, offset, length) => {\n currentParent = onValue({ type: 'property', offset, length: -1, parent: currentParent, children: [] });\n currentParent.children.push({ type: 'string', value: name, offset, length, parent: currentParent });\n },\n onObjectEnd: (offset, length) => {\n ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onArrayBegin: (offset, length) => {\n currentParent = onValue({ type: 'array', offset, length: -1, parent: currentParent, children: [] });\n },\n onArrayEnd: (offset, length) => {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onLiteralValue: (value, offset, length) => {\n onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });\n ensurePropertyComplete(offset + length);\n },\n onSeparator: (sep, offset, length) => {\n if (currentParent.type === 'property') {\n if (sep === ':') {\n currentParent.colonOffset = offset;\n }\n else if (sep === ',') {\n ensurePropertyComplete(offset);\n }\n }\n },\n onError: (error, offset, length) => {\n errors.push({ error, offset, length });\n }\n };\n visit(text, visitor, options);\n const result = currentParent.children[0];\n if (result) {\n delete result.parent;\n }\n return result;\n}\n/**\n * Finds the node at the given path in a JSON DOM.\n */\nexport function findNodeAtLocation(root, path) {\n if (!root) {\n return undefined;\n }\n let node = root;\n for (let segment of path) {\n if (typeof segment === 'string') {\n if (node.type !== 'object' || !Array.isArray(node.children)) {\n return undefined;\n }\n let found = false;\n for (const propertyNode of node.children) {\n if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {\n node = propertyNode.children[1];\n found = true;\n break;\n }\n }\n if (!found) {\n return undefined;\n }\n }\n else {\n const index = segment;\n if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {\n return undefined;\n }\n node = node.children[index];\n }\n }\n return node;\n}\n/**\n * Gets the JSON path of the given JSON DOM node\n */\nexport function getNodePath(node) {\n if (!node.parent || !node.parent.children) {\n return [];\n }\n const path = getNodePath(node.parent);\n if (node.parent.type === 'property') {\n const key = node.parent.children[0].value;\n path.push(key);\n }\n else if (node.parent.type === 'array') {\n const index = node.parent.children.indexOf(node);\n if (index !== -1) {\n path.push(index);\n }\n }\n return path;\n}\n/**\n * Evaluates the JavaScript object of the given JSON DOM node\n */\nexport function getNodeValue(node) {\n switch (node.type) {\n case 'array':\n return node.children.map(getNodeValue);\n case 'object':\n const obj = Object.create(null);\n for (let prop of node.children) {\n const valueNode = prop.children[1];\n if (valueNode) {\n obj[prop.children[0].value] = getNodeValue(valueNode);\n }\n }\n return obj;\n case 'null':\n case 'string':\n case 'number':\n case 'boolean':\n return node.value;\n default:\n return undefined;\n }\n}\nexport function contains(node, offset, includeRightBound = false) {\n return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length));\n}\n/**\n * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.\n */\nexport function findNodeAtOffset(node, offset, includeRightBound = false) {\n if (contains(node, offset, includeRightBound)) {\n const children = node.children;\n if (Array.isArray(children)) {\n for (let i = 0; i < children.length && children[i].offset <= offset; i++) {\n const item = findNodeAtOffset(children[i], offset, includeRightBound);\n if (item) {\n return item;\n }\n }\n }\n return node;\n }\n return undefined;\n}\n/**\n * Parses the given text and invokes the visitor functions for each object, array and literal reached.\n */\nexport function visit(text, visitor, options = ParseOptions.DEFAULT) {\n const _scanner = createScanner(text, false);\n // Important: Only pass copies of this to visitor functions to prevent accidental modification, and\n // to not affect visitor functions which stored a reference to a previous JSONPath\n const _jsonPath = [];\n // Depth of onXXXBegin() callbacks suppressed. onXXXEnd() decrements this if it isn't 0 already.\n // Callbacks are only called when this value is 0.\n let suppressedCallbacks = 0;\n function toNoArgVisit(visitFunction) {\n return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;\n }\n function toOneArgVisit(visitFunction) {\n return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;\n }\n function toOneArgVisitWithPath(visitFunction) {\n return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;\n }\n function toBeginVisit(visitFunction) {\n return visitFunction ?\n () => {\n if (suppressedCallbacks > 0) {\n suppressedCallbacks++;\n }\n else {\n let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());\n if (cbReturn === false) {\n suppressedCallbacks = 1;\n }\n }\n }\n : () => true;\n }\n function toEndVisit(visitFunction) {\n return visitFunction ?\n () => {\n if (suppressedCallbacks > 0) {\n suppressedCallbacks--;\n }\n if (suppressedCallbacks === 0) {\n visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());\n }\n }\n : () => true;\n }\n const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);\n const disallowComments = options && options.disallowComments;\n const allowTrailingComma = options && options.allowTrailingComma;\n function scanNext() {\n while (true) {\n const token = _scanner.scan();\n switch (_scanner.getTokenError()) {\n case 4 /* ScanError.InvalidUnicode */:\n handleError(14 /* ParseErrorCode.InvalidUnicode */);\n break;\n case 5 /* ScanError.InvalidEscapeCharacter */:\n handleError(15 /* ParseErrorCode.InvalidEscapeCharacter */);\n break;\n case 3 /* ScanError.UnexpectedEndOfNumber */:\n handleError(13 /* ParseErrorCode.UnexpectedEndOfNumber */);\n break;\n case 1 /* ScanError.UnexpectedEndOfComment */:\n if (!disallowComments) {\n handleError(11 /* ParseErrorCode.UnexpectedEndOfComment */);\n }\n break;\n case 2 /* ScanError.UnexpectedEndOfString */:\n handleError(12 /* ParseErrorCode.UnexpectedEndOfString */);\n break;\n case 6 /* ScanError.InvalidCharacter */:\n handleError(16 /* ParseErrorCode.InvalidCharacter */);\n break;\n }\n switch (token) {\n case 12 /* SyntaxKind.LineCommentTrivia */:\n case 13 /* SyntaxKind.BlockCommentTrivia */:\n if (disallowComments) {\n handleError(10 /* ParseErrorCode.InvalidCommentToken */);\n }\n else {\n onComment();\n }\n break;\n case 16 /* SyntaxKind.Unknown */:\n handleError(1 /* ParseErrorCode.InvalidSymbol */);\n break;\n case 15 /* SyntaxKind.Trivia */:\n case 14 /* SyntaxKind.LineBreakTrivia */:\n break;\n default:\n return token;\n }\n }\n }\n function handleError(error, skipUntilAfter = [], skipUntil = []) {\n onError(error);\n if (skipUntilAfter.length + skipUntil.length > 0) {\n let token = _scanner.getToken();\n while (token !== 17 /* SyntaxKind.EOF */) {\n if (skipUntilAfter.indexOf(token) !== -1) {\n scanNext();\n break;\n }\n else if (skipUntil.indexOf(token) !== -1) {\n break;\n }\n token = scanNext();\n }\n }\n }\n function parseString(isValue) {\n const value = _scanner.getTokenValue();\n if (isValue) {\n onLiteralValue(value);\n }\n else {\n onObjectProperty(value);\n // add property name afterwards\n _jsonPath.push(value);\n }\n scanNext();\n return true;\n }\n function parseLiteral() {\n switch (_scanner.getToken()) {\n case 11 /* SyntaxKind.NumericLiteral */:\n const tokenValue = _scanner.getTokenValue();\n let value = Number(tokenValue);\n if (isNaN(value)) {\n handleError(2 /* ParseErrorCode.InvalidNumberFormat */);\n value = 0;\n }\n onLiteralValue(value);\n break;\n case 7 /* SyntaxKind.NullKeyword */:\n onLiteralValue(null);\n break;\n case 8 /* SyntaxKind.TrueKeyword */:\n onLiteralValue(true);\n break;\n case 9 /* SyntaxKind.FalseKeyword */:\n onLiteralValue(false);\n break;\n default:\n return false;\n }\n scanNext();\n return true;\n }\n function parseProperty() {\n if (_scanner.getToken() !== 10 /* SyntaxKind.StringLiteral */) {\n handleError(3 /* ParseErrorCode.PropertyNameExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n return false;\n }\n parseString(false);\n if (_scanner.getToken() === 6 /* SyntaxKind.ColonToken */) {\n onSeparator(':');\n scanNext(); // consume colon\n if (!parseValue()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n }\n else {\n handleError(5 /* ParseErrorCode.ColonExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n _jsonPath.pop(); // remove processed property name\n return true;\n }\n function parseObject() {\n onObjectBegin();\n scanNext(); // consume open brace\n let needsComma = false;\n while (_scanner.getToken() !== 2 /* SyntaxKind.CloseBraceToken */ && _scanner.getToken() !== 17 /* SyntaxKind.EOF */) {\n if (_scanner.getToken() === 5 /* SyntaxKind.CommaToken */) {\n if (!needsComma) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n }\n onSeparator(',');\n scanNext(); // consume comma\n if (_scanner.getToken() === 2 /* SyntaxKind.CloseBraceToken */ && allowTrailingComma) {\n break;\n }\n }\n else if (needsComma) {\n handleError(6 /* ParseErrorCode.CommaExpected */, [], []);\n }\n if (!parseProperty()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n needsComma = true;\n }\n onObjectEnd();\n if (_scanner.getToken() !== 2 /* SyntaxKind.CloseBraceToken */) {\n handleError(7 /* ParseErrorCode.CloseBraceExpected */, [2 /* SyntaxKind.CloseBraceToken */], []);\n }\n else {\n scanNext(); // consume close brace\n }\n return true;\n }\n function parseArray() {\n onArrayBegin();\n scanNext(); // consume open bracket\n let isFirstElement = true;\n let needsComma = false;\n while (_scanner.getToken() !== 4 /* SyntaxKind.CloseBracketToken */ && _scanner.getToken() !== 17 /* SyntaxKind.EOF */) {\n if (_scanner.getToken() === 5 /* SyntaxKind.CommaToken */) {\n if (!needsComma) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n }\n onSeparator(',');\n scanNext(); // consume comma\n if (_scanner.getToken() === 4 /* SyntaxKind.CloseBracketToken */ && allowTrailingComma) {\n break;\n }\n }\n else if (needsComma) {\n handleError(6 /* ParseErrorCode.CommaExpected */, [], []);\n }\n if (isFirstElement) {\n _jsonPath.push(0);\n isFirstElement = false;\n }\n else {\n _jsonPath[_jsonPath.length - 1]++;\n }\n if (!parseValue()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], [4 /* SyntaxKind.CloseBracketToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n needsComma = true;\n }\n onArrayEnd();\n if (!isFirstElement) {\n _jsonPath.pop(); // remove array index\n }\n if (_scanner.getToken() !== 4 /* SyntaxKind.CloseBracketToken */) {\n handleError(8 /* ParseErrorCode.CloseBracketExpected */, [4 /* SyntaxKind.CloseBracketToken */], []);\n }\n else {\n scanNext(); // consume close bracket\n }\n return true;\n }\n function parseValue() {\n switch (_scanner.getToken()) {\n case 3 /* SyntaxKind.OpenBracketToken */:\n return parseArray();\n case 1 /* SyntaxKind.OpenBraceToken */:\n return parseObject();\n case 10 /* SyntaxKind.StringLiteral */:\n return parseString(true);\n default:\n return parseLiteral();\n }\n }\n scanNext();\n if (_scanner.getToken() === 17 /* SyntaxKind.EOF */) {\n if (options.allowEmptyContent) {\n return true;\n }\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n return false;\n }\n if (!parseValue()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n return false;\n }\n if (_scanner.getToken() !== 17 /* SyntaxKind.EOF */) {\n handleError(9 /* ParseErrorCode.EndOfFileExpected */, [], []);\n }\n return true;\n}\n/**\n * Takes JSON with JavaScript-style comments and remove\n * them. Optionally replaces every none-newline character\n * of comments with a replaceCharacter\n */\nexport function stripComments(text, replaceCh) {\n let _scanner = createScanner(text), parts = [], kind, offset = 0, pos;\n do {\n pos = _scanner.getPosition();\n kind = _scanner.scan();\n switch (kind) {\n case 12 /* SyntaxKind.LineCommentTrivia */:\n case 13 /* SyntaxKind.BlockCommentTrivia */:\n case 17 /* SyntaxKind.EOF */:\n if (offset !== pos) {\n parts.push(text.substring(offset, pos));\n }\n if (replaceCh !== undefined) {\n parts.push(_scanner.getTokenValue().replace(/[^\\r\\n]/g, replaceCh));\n }\n offset = _scanner.getPosition();\n break;\n }\n } while (kind !== 17 /* SyntaxKind.EOF */);\n return parts.join('');\n}\nexport function getNodeType(value) {\n switch (typeof value) {\n case 'boolean': return 'boolean';\n case 'number': return 'number';\n case 'string': return 'string';\n case 'object': {\n if (!value) {\n return 'null';\n }\n else if (Array.isArray(value)) {\n return 'array';\n }\n return 'object';\n }\n default: return 'null';\n }\n}\n",
37
- "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport { format, isEOL } from './format';\nimport { parseTree, findNodeAtLocation } from './parser';\nexport function removeProperty(text, path, options) {\n return setProperty(text, path, void 0, options);\n}\nexport function setProperty(text, originalPath, value, options) {\n const path = originalPath.slice();\n const errors = [];\n const root = parseTree(text, errors);\n let parent = void 0;\n let lastSegment = void 0;\n while (path.length > 0) {\n lastSegment = path.pop();\n parent = findNodeAtLocation(root, path);\n if (parent === void 0 && value !== void 0) {\n if (typeof lastSegment === 'string') {\n value = { [lastSegment]: value };\n }\n else {\n value = [value];\n }\n }\n else {\n break;\n }\n }\n if (!parent) {\n // empty document\n if (value === void 0) { // delete\n throw new Error('Can not delete in empty document');\n }\n return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);\n }\n else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {\n const existing = findNodeAtLocation(parent, [lastSegment]);\n if (existing !== void 0) {\n if (value === void 0) { // delete\n if (!existing.parent) {\n throw new Error('Malformed AST');\n }\n const propertyIndex = parent.children.indexOf(existing.parent);\n let removeBegin;\n let removeEnd = existing.parent.offset + existing.parent.length;\n if (propertyIndex > 0) {\n // remove the comma of the previous node\n let previous = parent.children[propertyIndex - 1];\n removeBegin = previous.offset + previous.length;\n }\n else {\n removeBegin = parent.offset + 1;\n if (parent.children.length > 1) {\n // remove the comma of the next node\n let next = parent.children[1];\n removeEnd = next.offset;\n }\n }\n return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, options);\n }\n else {\n // set value of existing property\n return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);\n }\n }\n else {\n if (value === void 0) { // delete\n return []; // property does not exist, nothing to do\n }\n const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;\n const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map(p => p.children[0].value)) : parent.children.length;\n let edit;\n if (index > 0) {\n let previous = parent.children[index - 1];\n edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };\n }\n else if (parent.children.length === 0) {\n edit = { offset: parent.offset + 1, length: 0, content: newProperty };\n }\n else {\n edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };\n }\n return withFormatting(text, edit, options);\n }\n }\n else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {\n const insertIndex = lastSegment;\n if (insertIndex === -1) {\n // Insert\n const newProperty = `${JSON.stringify(value)}`;\n let edit;\n if (parent.children.length === 0) {\n edit = { offset: parent.offset + 1, length: 0, content: newProperty };\n }\n else {\n const previous = parent.children[parent.children.length - 1];\n edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };\n }\n return withFormatting(text, edit, options);\n }\n else if (value === void 0 && parent.children.length >= 0) {\n // Removal\n const removalIndex = lastSegment;\n const toRemove = parent.children[removalIndex];\n let edit;\n if (parent.children.length === 1) {\n // only item\n edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };\n }\n else if (parent.children.length - 1 === removalIndex) {\n // last item\n let previous = parent.children[removalIndex - 1];\n let offset = previous.offset + previous.length;\n let parentEndOffset = parent.offset + parent.length;\n edit = { offset, length: parentEndOffset - 2 - offset, content: '' };\n }\n else {\n edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };\n }\n return withFormatting(text, edit, options);\n }\n else if (value !== void 0) {\n let edit;\n const newProperty = `${JSON.stringify(value)}`;\n if (!options.isArrayInsertion && parent.children.length > lastSegment) {\n const toModify = parent.children[lastSegment];\n edit = { offset: toModify.offset, length: toModify.length, content: newProperty };\n }\n else if (parent.children.length === 0 || lastSegment === 0) {\n edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };\n }\n else {\n const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;\n const previous = parent.children[index - 1];\n edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };\n }\n return withFormatting(text, edit, options);\n }\n else {\n throw new Error(`Can not ${value === void 0 ? 'remove' : (options.isArrayInsertion ? 'insert' : 'modify')} Array index ${insertIndex} as length is not sufficient`);\n }\n }\n else {\n throw new Error(`Can not add ${typeof lastSegment !== 'number' ? 'index' : 'property'} to parent of type ${parent.type}`);\n }\n}\nfunction withFormatting(text, edit, options) {\n if (!options.formattingOptions) {\n return [edit];\n }\n // apply the edit\n let newText = applyEdit(text, edit);\n // format the new text\n let begin = edit.offset;\n let end = edit.offset + edit.content.length;\n if (edit.length === 0 || edit.content.length === 0) { // insert or remove\n while (begin > 0 && !isEOL(newText, begin - 1)) {\n begin--;\n }\n while (end < newText.length && !isEOL(newText, end)) {\n end++;\n }\n }\n const edits = format(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });\n // apply the formatting edits and track the begin and end offsets of the changes\n for (let i = edits.length - 1; i >= 0; i--) {\n const edit = edits[i];\n newText = applyEdit(newText, edit);\n begin = Math.min(begin, edit.offset);\n end = Math.max(end, edit.offset + edit.length);\n end += edit.content.length - edit.length;\n }\n // create a single edit with all changes\n const editLength = text.length - (newText.length - end) - begin;\n return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];\n}\nexport function applyEdit(text, edit) {\n return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);\n}\nexport function isWS(text, offset) {\n return '\\r\\n \\t'.indexOf(text.charAt(offset)) !== -1;\n}\n",
38
- "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport * as formatter from './impl/format';\nimport * as edit from './impl/edit';\nimport * as scanner from './impl/scanner';\nimport * as parser from './impl/parser';\n/**\n * Creates a JSON scanner on the given text.\n * If ignoreTrivia is set, whitespaces or comments are ignored.\n */\nexport const createScanner = scanner.createScanner;\nexport var ScanError;\n(function (ScanError) {\n ScanError[ScanError[\"None\"] = 0] = \"None\";\n ScanError[ScanError[\"UnexpectedEndOfComment\"] = 1] = \"UnexpectedEndOfComment\";\n ScanError[ScanError[\"UnexpectedEndOfString\"] = 2] = \"UnexpectedEndOfString\";\n ScanError[ScanError[\"UnexpectedEndOfNumber\"] = 3] = \"UnexpectedEndOfNumber\";\n ScanError[ScanError[\"InvalidUnicode\"] = 4] = \"InvalidUnicode\";\n ScanError[ScanError[\"InvalidEscapeCharacter\"] = 5] = \"InvalidEscapeCharacter\";\n ScanError[ScanError[\"InvalidCharacter\"] = 6] = \"InvalidCharacter\";\n})(ScanError || (ScanError = {}));\nexport var SyntaxKind;\n(function (SyntaxKind) {\n SyntaxKind[SyntaxKind[\"OpenBraceToken\"] = 1] = \"OpenBraceToken\";\n SyntaxKind[SyntaxKind[\"CloseBraceToken\"] = 2] = \"CloseBraceToken\";\n SyntaxKind[SyntaxKind[\"OpenBracketToken\"] = 3] = \"OpenBracketToken\";\n SyntaxKind[SyntaxKind[\"CloseBracketToken\"] = 4] = \"CloseBracketToken\";\n SyntaxKind[SyntaxKind[\"CommaToken\"] = 5] = \"CommaToken\";\n SyntaxKind[SyntaxKind[\"ColonToken\"] = 6] = \"ColonToken\";\n SyntaxKind[SyntaxKind[\"NullKeyword\"] = 7] = \"NullKeyword\";\n SyntaxKind[SyntaxKind[\"TrueKeyword\"] = 8] = \"TrueKeyword\";\n SyntaxKind[SyntaxKind[\"FalseKeyword\"] = 9] = \"FalseKeyword\";\n SyntaxKind[SyntaxKind[\"StringLiteral\"] = 10] = \"StringLiteral\";\n SyntaxKind[SyntaxKind[\"NumericLiteral\"] = 11] = \"NumericLiteral\";\n SyntaxKind[SyntaxKind[\"LineCommentTrivia\"] = 12] = \"LineCommentTrivia\";\n SyntaxKind[SyntaxKind[\"BlockCommentTrivia\"] = 13] = \"BlockCommentTrivia\";\n SyntaxKind[SyntaxKind[\"LineBreakTrivia\"] = 14] = \"LineBreakTrivia\";\n SyntaxKind[SyntaxKind[\"Trivia\"] = 15] = \"Trivia\";\n SyntaxKind[SyntaxKind[\"Unknown\"] = 16] = \"Unknown\";\n SyntaxKind[SyntaxKind[\"EOF\"] = 17] = \"EOF\";\n})(SyntaxKind || (SyntaxKind = {}));\n/**\n * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.\n */\nexport const getLocation = parser.getLocation;\n/**\n * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n * Therefore, always check the errors list to find out if the input was valid.\n */\nexport const parse = parser.parse;\n/**\n * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n */\nexport const parseTree = parser.parseTree;\n/**\n * Finds the node at the given path in a JSON DOM.\n */\nexport const findNodeAtLocation = parser.findNodeAtLocation;\n/**\n * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.\n */\nexport const findNodeAtOffset = parser.findNodeAtOffset;\n/**\n * Gets the JSON path of the given JSON DOM node\n */\nexport const getNodePath = parser.getNodePath;\n/**\n * Evaluates the JavaScript object of the given JSON DOM node\n */\nexport const getNodeValue = parser.getNodeValue;\n/**\n * Parses the given text and invokes the visitor functions for each object, array and literal reached.\n */\nexport const visit = parser.visit;\n/**\n * Takes JSON with JavaScript-style comments and remove\n * them. Optionally replaces every none-newline character\n * of comments with a replaceCharacter\n */\nexport const stripComments = parser.stripComments;\nexport var ParseErrorCode;\n(function (ParseErrorCode) {\n ParseErrorCode[ParseErrorCode[\"InvalidSymbol\"] = 1] = \"InvalidSymbol\";\n ParseErrorCode[ParseErrorCode[\"InvalidNumberFormat\"] = 2] = \"InvalidNumberFormat\";\n ParseErrorCode[ParseErrorCode[\"PropertyNameExpected\"] = 3] = \"PropertyNameExpected\";\n ParseErrorCode[ParseErrorCode[\"ValueExpected\"] = 4] = \"ValueExpected\";\n ParseErrorCode[ParseErrorCode[\"ColonExpected\"] = 5] = \"ColonExpected\";\n ParseErrorCode[ParseErrorCode[\"CommaExpected\"] = 6] = \"CommaExpected\";\n ParseErrorCode[ParseErrorCode[\"CloseBraceExpected\"] = 7] = \"CloseBraceExpected\";\n ParseErrorCode[ParseErrorCode[\"CloseBracketExpected\"] = 8] = \"CloseBracketExpected\";\n ParseErrorCode[ParseErrorCode[\"EndOfFileExpected\"] = 9] = \"EndOfFileExpected\";\n ParseErrorCode[ParseErrorCode[\"InvalidCommentToken\"] = 10] = \"InvalidCommentToken\";\n ParseErrorCode[ParseErrorCode[\"UnexpectedEndOfComment\"] = 11] = \"UnexpectedEndOfComment\";\n ParseErrorCode[ParseErrorCode[\"UnexpectedEndOfString\"] = 12] = \"UnexpectedEndOfString\";\n ParseErrorCode[ParseErrorCode[\"UnexpectedEndOfNumber\"] = 13] = \"UnexpectedEndOfNumber\";\n ParseErrorCode[ParseErrorCode[\"InvalidUnicode\"] = 14] = \"InvalidUnicode\";\n ParseErrorCode[ParseErrorCode[\"InvalidEscapeCharacter\"] = 15] = \"InvalidEscapeCharacter\";\n ParseErrorCode[ParseErrorCode[\"InvalidCharacter\"] = 16] = \"InvalidCharacter\";\n})(ParseErrorCode || (ParseErrorCode = {}));\nexport function printParseErrorCode(code) {\n switch (code) {\n case 1 /* ParseErrorCode.InvalidSymbol */: return 'InvalidSymbol';\n case 2 /* ParseErrorCode.InvalidNumberFormat */: return 'InvalidNumberFormat';\n case 3 /* ParseErrorCode.PropertyNameExpected */: return 'PropertyNameExpected';\n case 4 /* ParseErrorCode.ValueExpected */: return 'ValueExpected';\n case 5 /* ParseErrorCode.ColonExpected */: return 'ColonExpected';\n case 6 /* ParseErrorCode.CommaExpected */: return 'CommaExpected';\n case 7 /* ParseErrorCode.CloseBraceExpected */: return 'CloseBraceExpected';\n case 8 /* ParseErrorCode.CloseBracketExpected */: return 'CloseBracketExpected';\n case 9 /* ParseErrorCode.EndOfFileExpected */: return 'EndOfFileExpected';\n case 10 /* ParseErrorCode.InvalidCommentToken */: return 'InvalidCommentToken';\n case 11 /* ParseErrorCode.UnexpectedEndOfComment */: return 'UnexpectedEndOfComment';\n case 12 /* ParseErrorCode.UnexpectedEndOfString */: return 'UnexpectedEndOfString';\n case 13 /* ParseErrorCode.UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber';\n case 14 /* ParseErrorCode.InvalidUnicode */: return 'InvalidUnicode';\n case 15 /* ParseErrorCode.InvalidEscapeCharacter */: return 'InvalidEscapeCharacter';\n case 16 /* ParseErrorCode.InvalidCharacter */: return 'InvalidCharacter';\n }\n return '<unknown ParseErrorCode>';\n}\n/**\n * Computes the edit operations needed to format a JSON document.\n *\n * @param documentText The input text\n * @param range The range to format or `undefined` to format the full content\n * @param options The formatting options\n * @returns The edit operations describing the formatting changes to the original document following the format described in {@linkcode EditResult}.\n * To apply the edit operations to the input, use {@linkcode applyEdits}.\n */\nexport function format(documentText, range, options) {\n return formatter.format(documentText, range, options);\n}\n/**\n * Computes the edit operations needed to modify a value in the JSON document.\n *\n * @param documentText The input text\n * @param path The path of the value to change. The path represents either to the document root, a property or an array item.\n * If the path points to an non-existing property or item, it will be created.\n * @param value The new value for the specified property or item. If the value is undefined,\n * the property or item will be removed.\n * @param options Options\n * @returns The edit operations describing the changes to the original document, following the format described in {@linkcode EditResult}.\n * To apply the edit operations to the input, use {@linkcode applyEdits}.\n */\nexport function modify(text, path, value, options) {\n return edit.setProperty(text, path, value, options);\n}\n/**\n * Applies edits to an input string.\n * @param text The input text\n * @param edits Edit operations following the format described in {@linkcode EditResult}.\n * @returns The text with the applied edits.\n * @throws An error if the edit operations are not well-formed as described in {@linkcode EditResult}.\n */\nexport function applyEdits(text, edits) {\n let sortedEdits = edits.slice(0).sort((a, b) => {\n const diff = a.offset - b.offset;\n if (diff === 0) {\n return a.length - b.length;\n }\n return diff;\n });\n let lastModifiedOffset = text.length;\n for (let i = sortedEdits.length - 1; i >= 0; i--) {\n let e = sortedEdits[i];\n if (e.offset + e.length <= lastModifiedOffset) {\n text = edit.applyEdit(text, e);\n }\n else {\n throw new Error('Overlapping edit');\n }\n lastModifiedOffset = e.offset;\n }\n return text;\n}\n",
39
- "/**\n * ConfigProvider Interface\n *\n * Abstract configuration provider pattern following the 5 Laws of Elegant Defense:\n * - Parse at boundary (async factory), sync getters (trusted internal state)\n * - Early exit via guard clauses in factories\n * - Fail fast with descriptive errors\n *\n * Implementations parse config at construction; getters are sync and pure.\n */\n\nimport { type OcxConfig, type RegistryConfig, readOcxConfig } from \"../schemas/config\"\nimport { ConfigError } from \"../utils/errors\"\nimport { getGlobalConfigPath, globalDirectoryExists } from \"../utils/paths\"\n\n// =============================================================================\n// INTERFACE\n// =============================================================================\n\n/**\n * Abstract configuration provider interface.\n * Implementations parse config at construction (boundary), getters are sync and pure.\n */\nexport interface ConfigProvider {\n\t/** Working directory for this config context */\n\treadonly cwd: string\n\n\t/** Get registries for this scope (sync - data already parsed at construction) */\n\tgetRegistries(): Record<string, RegistryConfig>\n\n\t/** Get component installation path */\n\tgetComponentPath(): string\n}\n\n// =============================================================================\n// LOCAL CONFIG PROVIDER\n// =============================================================================\n\n/**\n * Provides configuration from local project (ocx.jsonc).\n *\n * Use this when operating on a project with an ocx.jsonc file.\n */\nexport class LocalConfigProvider implements ConfigProvider {\n\treadonly cwd: string\n\tprivate readonly config: OcxConfig // immutable, parsed at construction\n\n\tprivate constructor(cwd: string, config: OcxConfig) {\n\t\tthis.cwd = cwd\n\t\tthis.config = config\n\t}\n\n\t/**\n\t * Require an initialized local config, throwing if not found.\n\t * Use this in commands that require a local ocx.jsonc to exist.\n\t *\n\t * @throws ConfigError if ocx.jsonc doesn't exist or is invalid\n\t * @returns LocalConfigProvider instance guaranteed to have valid config\n\t */\n\tstatic async requireInitialized(cwd: string): Promise<LocalConfigProvider> {\n\t\tconst config = await readOcxConfig(cwd)\n\n\t\t// Guard: No config file (Law 1: Early Exit)\n\t\tif (!config) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t\"No ocx.jsonc found in .opencode/ or project root. Run 'ocx init' first.\",\n\t\t\t)\n\t\t}\n\n\t\treturn new LocalConfigProvider(cwd, config)\n\t}\n\n\tgetRegistries(): Record<string, RegistryConfig> {\n\t\treturn this.config.registries\n\t}\n\n\tgetComponentPath(): string {\n\t\t// Default to .opencode directory for local projects\n\t\treturn \".opencode\"\n\t}\n}\n\n// =============================================================================\n// GLOBAL CONFIG PROVIDER\n// =============================================================================\n\n/**\n * Config provider for global OpenCode installations.\n * Installs to ~/.config/opencode/ without .opencode prefix.\n */\nexport class GlobalConfigProvider implements ConfigProvider {\n\treadonly cwd: string\n\tprivate readonly config: OcxConfig | null\n\n\tprivate constructor(basePath: string, config: OcxConfig | null) {\n\t\tthis.cwd = basePath\n\t\tthis.config = config\n\t}\n\n\t/**\n\t * Require an initialized global config, throwing if not found.\n\t * Use this in commands that require global OpenCode config to exist.\n\t *\n\t * @throws ConfigError if OpenCode hasn't been initialized globally\n\t * @returns GlobalConfigProvider instance guaranteed to have valid config\n\t */\n\tstatic async requireInitialized(): Promise<GlobalConfigProvider> {\n\t\tconst basePath = getGlobalConfigPath()\n\n\t\t// Guard: Global directory must exist (Law 1: Early Exit)\n\t\tif (!(await globalDirectoryExists())) {\n\t\t\tthrow new ConfigError(\"Global config not found. Run 'ocx init --global' first.\")\n\t\t}\n\n\t\t// Load ocx.jsonc if it exists (returns null if not found)\n\t\tconst config = await readOcxConfig(basePath)\n\t\tif (!config) {\n\t\t\tthrow new ConfigError(\"Global config not found. Run 'ocx init --global' first.\")\n\t\t}\n\n\t\treturn new GlobalConfigProvider(basePath, config)\n\t}\n\n\tgetRegistries(): Record<string, RegistryConfig> {\n\t\treturn this.config?.registries ?? {}\n\t}\n\n\t/**\n\t * Returns empty string - global installs have no .opencode prefix.\n\t */\n\tgetComponentPath(): string {\n\t\treturn \"\"\n\t}\n}\n",
40
- "import { stat } from \"node:fs/promises\"\nimport { homedir } from \"node:os\"\nimport { isAbsolute, join, relative, resolve } from \"node:path\"\nimport { resolveComponentTargetRoot } from \"./component-root-resolution\"\nimport { ValidationError } from \"./errors\"\nimport { PathValidationError, validatePath } from \"./path-security\"\n\nconst LOCAL_CONFIG_ROOT = \".opencode\"\nconst LOCAL_CONFIG_PREFIX = `${LOCAL_CONFIG_ROOT}/`\n\n/**\n * Strip a single leading .opencode/ prefix so local targets can be\n * normalized and re-anchored without duplicating the directory.\n */\nfunction stripLocalPrefix(target: string): string {\n\tconst unifiedSeparators = target.replace(/\\\\/g, \"/\")\n\n\tif (unifiedSeparators === LOCAL_CONFIG_ROOT) {\n\t\treturn \".\"\n\t}\n\n\tif (unifiedSeparators.startsWith(LOCAL_CONFIG_PREFIX)) {\n\t\treturn unifiedSeparators.slice(LOCAL_CONFIG_PREFIX.length)\n\t}\n\n\treturn target\n}\n\n/**\n * Returns the global OpenCode config directory path.\n * Uses XDG_CONFIG_HOME if set and absolute, otherwise ~/.config/opencode\n */\nexport function getGlobalConfigPath(): string {\n\tconst xdg = process.env.XDG_CONFIG_HOME\n\tconst base = xdg && isAbsolute(xdg) ? xdg : join(homedir(), \".config\")\n\treturn join(base, \"opencode\")\n}\n\n/**\n * Checks if the global OpenCode config directory exists.\n * Returns true if ~/.config/opencode/ (or XDG equivalent) is a directory.\n */\nexport async function globalDirectoryExists(): Promise<boolean> {\n\ttry {\n\t\tconst info = await stat(getGlobalConfigPath())\n\t\treturn info.isDirectory()\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Resolves a component target path for install location.\n *\n * Targets in registries are root-relative (e.g., \"plugins/foo.ts\").\n * - Flattened modes (global/profile) install at root-relative paths.\n * - Local mode installs under .opencode/.\n *\n * @param target - Root-relative target path from registry (e.g., \"plugins/foo.ts\")\n * @param isFlattened - Whether install mode is flattened (global/profile)\n * @param installRoot - Absolute install root for adaptive root resolution\n * @returns Resolved install path for the active mode\n */\nexport function resolveTargetPath(\n\ttarget: string,\n\tisFlattened: boolean,\n\tinstallRoot?: string,\n): string {\n\tif (isFlattened) {\n\t\tif (!installRoot) {\n\t\t\treturn target\n\t\t}\n\n\t\treturn resolveComponentTargetRoot(target, installRoot)\n\t}\n\n\tconst localRelativeTarget = stripLocalPrefix(target)\n\tconst installRootAbsolute = installRoot ? resolve(installRoot) : process.cwd()\n\tconst localRootAbsolute = resolve(installRootAbsolute, LOCAL_CONFIG_ROOT)\n\n\tlet safeAbsoluteTarget: string\n\ttry {\n\t\tsafeAbsoluteTarget = validatePath(localRootAbsolute, localRelativeTarget)\n\t} catch (error) {\n\t\tif (error instanceof PathValidationError) {\n\t\t\tthrow new ValidationError(`Invalid local target \"${target}\": ${error.message}`)\n\t\t}\n\t\tthrow error\n\t}\n\n\tconst normalizedRelativeTarget = relative(localRootAbsolute, safeAbsoluteTarget).replace(\n\t\t/\\\\/g,\n\t\t\"/\",\n\t)\n\n\tif (normalizedRelativeTarget === \".\" || normalizedRelativeTarget === \"\") {\n\t\treturn LOCAL_CONFIG_ROOT\n\t}\n\n\tconst adaptiveLocalTarget = installRoot\n\t\t? resolveComponentTargetRoot(normalizedRelativeTarget, localRootAbsolute)\n\t\t: normalizedRelativeTarget\n\n\treturn `${LOCAL_CONFIG_PREFIX}${adaptiveLocalTarget}`\n}\n",
41
- "import { existsSync, statSync } from \"node:fs\"\nimport { join } from \"node:path\"\nimport { ConflictError, ValidationError } from \"./errors\"\n\nconst ROOT_PAIRS = {\n\tagent: \"agents\",\n\tcommand: \"commands\",\n\tplugin: \"plugins\",\n\tskill: \"skills\",\n\ttool: \"tools\",\n\tbundle: \"bundles\",\n\tprofile: \"profiles\",\n} as const\n\ntype SingularRoot = keyof typeof ROOT_PAIRS\ntype PluralRoot = (typeof ROOT_PAIRS)[SingularRoot]\n\ntype RootPair = {\n\tsingular: SingularRoot\n\tplural: PluralRoot\n}\n\nconst ROOT_LOOKUP = new Map<string, RootPair>(\n\tObject.entries(ROOT_PAIRS).flatMap(([singular, plural]) => {\n\t\tconst pair = {\n\t\t\tsingular: singular as SingularRoot,\n\t\t\tplural,\n\t\t}\n\n\t\treturn [\n\t\t\t[singular, pair],\n\t\t\t[plural, pair],\n\t\t]\n\t}),\n)\n\nfunction readRootState(installRoot: string, rootSegment: string): \"missing\" | \"directory\" {\n\tconst candidatePath = join(installRoot, rootSegment)\n\n\tif (!existsSync(candidatePath)) {\n\t\treturn \"missing\"\n\t}\n\n\tconst stats = statSync(candidatePath)\n\tif (!stats.isDirectory()) {\n\t\tthrow new ValidationError(\n\t\t\t`Component root \"${rootSegment}\" exists at \"${candidatePath}\" but is not a directory.`,\n\t\t)\n\t}\n\n\treturn \"directory\"\n}\n\nfunction resolvePreferredRoot(installRoot: string, pair: RootPair): SingularRoot | PluralRoot {\n\tconst singularState = readRootState(installRoot, pair.singular)\n\tconst pluralState = readRootState(installRoot, pair.plural)\n\n\tif (singularState === \"directory\" && pluralState === \"directory\") {\n\t\treturn pair.plural\n\t}\n\n\tif (singularState === \"directory\") {\n\t\treturn pair.singular\n\t}\n\n\tif (pluralState === \"directory\") {\n\t\treturn pair.plural\n\t}\n\n\treturn pair.plural\n}\n\nfunction assertNoCrossRootCollision(\n\tinstallRoot: string,\n\toriginalTarget: string,\n\tselectedRoot: SingularRoot | PluralRoot,\n\tpair: RootPair,\n\tsuffix: string,\n): void {\n\tif (!suffix) {\n\t\treturn\n\t}\n\n\tconst alternateRoot = selectedRoot === pair.plural ? pair.singular : pair.plural\n\tconst alternateRelativePath = `${alternateRoot}/${suffix}`\n\tconst alternateAbsolutePath = join(installRoot, alternateRelativePath)\n\n\tif (!existsSync(alternateAbsolutePath)) {\n\t\treturn\n\t}\n\n\tthrow new ConflictError(\n\t\t`Cross-root logical collision for \"${originalTarget}\": selected root \"${selectedRoot}\" but \"${alternateRelativePath}\" already exists.`,\n\t)\n}\n\n/**\n * Resolve singular/plural component root segments for installation targets.\n * Preserves all nested path segments exactly.\n */\nexport function resolveComponentTargetRoot(targetPath: string, installRoot: string): string {\n\tconst [firstSegment, ...remainingSegments] = targetPath.split(\"/\")\n\tif (!firstSegment) {\n\t\treturn targetPath\n\t}\n\n\tconst pair = ROOT_LOOKUP.get(firstSegment)\n\tif (!pair) {\n\t\treturn targetPath\n\t}\n\n\tconst preferredRoot = resolvePreferredRoot(installRoot, pair)\n\tconst suffix = remainingSegments.join(\"/\")\n\n\tassertNoCrossRootCollision(installRoot, targetPath, preferredRoot, pair, suffix)\n\n\tif (!suffix) {\n\t\treturn preferredRoot\n\t}\n\n\treturn `${preferredRoot}/${suffix}`\n}\n",
42
- "/**\n * ConfigResolver - Global Profile Resolution\n *\n * Profile selection via `.opencode/ocx.jsonc` field: `{ \"profile\": \"work\" }`\n * Profiles are global-only (~/.config/opencode/profiles/). Local profiles are\n * unsupported and produce a hard error via ProfileManager.getLayered().\n *\n * Visibility controlled by profile `ocx.jsonc` include/exclude patterns.\n * OCX configs (ocx.jsonc) remain ISOLATED per scope - they do NOT merge.\n * OpenCode configs (opencode.jsonc) ALWAYS merge: profile → local.\n * Local opencode.jsonc always participates regardless of exclude/include\n * patterns, matching OpenCode's native layering semantics.\n *\n * This is controlled by exclude/include patterns from the profile.\n *\n * Security: This isolation prevents global registries from injecting\n * components into all projects.\n *\n * Follows the 5 Laws of Elegant Defense:\n * - Law 1 (Early Exit): Guard clauses handle edge cases at top\n * - Law 2 (Parse Don't Validate): Async factory parses at boundary, sync getters use trusted state\n * - Law 3 (Atomic Predictability): Pure resolve method, no hidden mutations\n * - Law 4 (Fail Fast): Throws ProfileNotFoundError for missing profiles\n * - Law 5 (Intentional Naming): Names describe exact purpose\n */\n\nimport { existsSync, readFileSync, statSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport { join, relative } from \"node:path\"\nimport { Glob } from \"bun\"\nimport { type ParseError, parse as parseJsonc, printParseErrorCode } from \"jsonc-parser\"\nimport { ProfileManager } from \"../profile/manager\"\nimport {\n\tfindLocalConfigDir,\n\tgetProfileDir,\n\tLOCAL_CONFIG_DIR,\n\tOCX_CONFIG_FILE,\n\tOPENCODE_CONFIG_FILE,\n} from \"../profile/paths\"\nimport type { Profile } from \"../profile/schema\"\nimport { mergeOpencodeConfig } from \"../registry/merge\"\nimport type { OcxConfig, RegistryConfig } from \"../schemas/config\"\nimport { ocxConfigSchema, readReceipt } from \"../schemas/config\"\nimport type { NormalizedOpencodeConfig } from \"../schemas/registry\"\nimport { ConfigError, ProfileNotFoundError, ProfilesNotInitializedError } from \"../utils/errors\"\nimport { resolveGitRootSync } from \"../utils/git-root\"\nimport { resolveRegistryInstructionPaths } from \"../utils/instruction-paths\"\nimport { getGlobalConfigPath } from \"../utils/paths\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/**\n * The fully resolved configuration from all sources.\n */\nexport interface ResolvedConfig {\n\t/** Registries from active scope (profile OR local, never merged) */\n\tregistries: Record<string, RegistryConfig>\n\t/** Component installation path */\n\tcomponentPath: string\n\t/** Merged OpenCode config */\n\topencode: Record<string, unknown>\n\t/** Discovered instruction files (filtered by exclude/include) */\n\tinstructions: string[]\n\t/** The resolved profile name, or null if no profile */\n\tprofileName: string | null\n}\n\n/**\n * Source of a configuration value for debugging.\n */\nexport type ConfigSource = \"global-profile\" | \"local-config\" | \"local-opencode\" | \"default\"\n\n/**\n * Tracks where a configuration value originated.\n */\nexport interface ConfigOrigin {\n\tpath: string\n\tsource: ConfigSource\n}\n\n/**\n * Resolved configuration with origin tracking for debugging.\n */\nexport interface ResolvedConfigWithOrigin extends ResolvedConfig {\n\t/** Origin tracking for each setting (for debugging) */\n\torigins: Map<string, ConfigOrigin>\n}\n\ntype ProfileResolutionSource = \"none\" | \"local-config\" | \"cli\" | \"env\" | \"default\"\n\nfunction isExplicitProfileSource(source: ProfileResolutionSource): boolean {\n\treturn source === \"local-config\" || source === \"cli\" || source === \"env\"\n}\n\nfunction requireNonEmptyExplicitProfile(profileName: string, sourceDescription: string): string {\n\tif (profileName.trim().length === 0) {\n\t\tthrow new ConfigError(\n\t\t\t`Invalid profile from ${sourceDescription}: value cannot be empty or whitespace`,\n\t\t)\n\t}\n\n\treturn profileName\n}\n\nfunction formatJsoncParseError(parseErrors: ParseError[]): string {\n\tif (parseErrors.length === 0) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\tconst firstError = parseErrors[0]\n\tif (!firstError) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\treturn `${printParseErrorCode(firstError.error)} at offset ${firstError.offset}`\n}\n\nfunction parseLocalOcxConfig(configPath: string): OcxConfig {\n\tlet text: string\n\ttry {\n\t\ttext = readFileSync(configPath, \"utf8\")\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : \"Unknown read error\"\n\t\tthrow new ConfigError(`Failed to read local config at ${configPath}: ${reason}`)\n\t}\n\n\tconst parseErrors: ParseError[] = []\n\tconst parsed = parseJsonc(text, parseErrors, { allowTrailingComma: true })\n\tif (parseErrors.length > 0) {\n\t\tconst errorDetail = formatJsoncParseError(parseErrors)\n\t\tthrow new ConfigError(`Invalid JSONC in local config at ${configPath}: ${errorDetail}`)\n\t}\n\n\tconst validationResult = ocxConfigSchema.safeParse(parsed)\n\tif (!validationResult.success) {\n\t\tconst firstIssue = validationResult.error.issues[0]\n\t\tconst issuePath = firstIssue?.path.length ? firstIssue.path.join(\".\") : \"root\"\n\t\tconst issueMessage = firstIssue?.message ?? \"Invalid OCX config\"\n\t\tthrow new ConfigError(`Invalid local config at ${configPath}: ${issuePath} ${issueMessage}`)\n\t}\n\n\treturn validationResult.data\n}\n\nfunction parseLocalOpencodeConfig(configPath: string): Record<string, unknown> {\n\tlet text: string\n\ttry {\n\t\ttext = readFileSync(configPath, \"utf8\")\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : \"Unknown read error\"\n\t\tthrow new ConfigError(`Failed to read local OpenCode config at ${configPath}: ${reason}`)\n\t}\n\n\tconst parseErrors: ParseError[] = []\n\tconst parsed = parseJsonc(text, parseErrors, { allowTrailingComma: true })\n\tif (parseErrors.length > 0) {\n\t\tconst errorDetail = formatJsoncParseError(parseErrors)\n\t\tthrow new ConfigError(`Invalid JSONC in local OpenCode config at ${configPath}: ${errorDetail}`)\n\t}\n\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new ConfigError(`Invalid local OpenCode config at ${configPath}: root must be an object`)\n\t}\n\n\treturn parsed as Record<string, unknown>\n}\n\n// =============================================================================\n// INSTRUCTION FILE DISCOVERY\n// =============================================================================\n\n/**\n * Instruction file types to search for, in priority order.\n * OpenCode uses \"first type wins\" pattern - if ANY files of the first type\n * are found, only those are used (remaining types are not checked).\n *\n * Reference: https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/instruction.ts#L75-L84\n */\nconst INSTRUCTION_FILES = [\n\t\"AGENTS.md\",\n\t\"CLAUDE.md\",\n\t\"CONTEXT.md\", // Deprecated - kept for OpenCode compatibility\n] as const\n\n/**\n * Find instruction files of a specific type by walking UP from projectDir to gitRoot.\n * Returns repo-relative paths in deepest-first order.\n */\nfunction findInstructionsByType(filename: string, projectDir: string, gitRoot: string): string[] {\n\tconst discovered: string[] = []\n\tlet currentDir = projectDir\n\n\t// Walk up from projectDir to root\n\twhile (true) {\n\t\tconst filePath = join(currentDir, filename)\n\t\tif (existsSync(filePath) && statSync(filePath).isFile()) {\n\t\t\t// Store as relative to root\n\t\t\tconst relativePath = relative(gitRoot, filePath)\n\t\t\tdiscovered.push(relativePath)\n\t\t}\n\n\t\t// Stop if we've reached the root\n\t\tif (currentDir === gitRoot) break\n\n\t\t// Move up one directory\n\t\tconst parentDir = join(currentDir, \"..\")\n\t\tif (parentDir === currentDir) break // filesystem root\n\t\tcurrentDir = parentDir\n\t}\n\n\treturn discovered\n}\n\n/**\n * Discover instruction files by walking UP from projectDir to gitRoot.\n * Implements OpenCode's \"first type wins\" pattern - searches for AGENTS.md first,\n * only checks CLAUDE.md if no AGENTS.md found, and CONTEXT.md only if neither found.\n *\n * Returns repo-relative paths, deepest first.\n *\n * Reference: https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/instruction.ts#L75-L84\n */\nfunction discoverInstructionFiles(projectDir: string, gitRoot: string): string[] {\n\t// First type wins - check each type in priority order\n\tfor (const filename of INSTRUCTION_FILES) {\n\t\tconst matches = findInstructionsByType(filename, projectDir, gitRoot)\n\t\tif (matches.length > 0) {\n\t\t\treturn matches // Return immediately - first type wins\n\t\t}\n\t}\n\n\treturn []\n}\n\n/**\n * Normalize a glob pattern by stripping leading \"./\" for consistent matching.\n * Discovered paths are repo-relative (e.g. \"src/AGENTS.md\") so patterns\n * with \"./\" prefix (e.g. \"./src/AGENTS.md\") need normalization to match.\n */\nfunction normalizePattern(pattern: string): string {\n\treturn pattern.startsWith(\"./\") ? pattern.slice(2) : pattern\n}\n\n/**\n * Filter files using TypeScript/Vite style include/exclude.\n * Include overrides exclude, order is preserved.\n */\nfunction filterByPatterns(files: string[], exclude: string[], include: string[]): string[] {\n\treturn files.filter((file) => {\n\t\t// Check include first - include overrides exclude\n\t\tfor (const pattern of include) {\n\t\t\tconst glob = new Glob(normalizePattern(pattern))\n\t\t\tif (glob.match(file)) return true\n\t\t}\n\n\t\t// Check exclude\n\t\tfor (const pattern of exclude) {\n\t\t\tconst glob = new Glob(normalizePattern(pattern))\n\t\t\tif (glob.match(file)) return false\n\t\t}\n\n\t\t// Not matched by include or exclude - keep it\n\t\treturn true\n\t})\n}\n\n// =============================================================================\n// REGISTRY INSTRUCTION LOADING\n// =============================================================================\n\n/**\n * Load and resolve registry-provided instruction paths from installed components.\n * Reads the receipt and resolves install-root-relative paths to absolute paths.\n *\n * @param installRoot - The install root directory (absolute)\n * @returns Array of absolute instruction paths (deduplicated)\n */\nasync function loadRegistryInstructionsFromReceipt(installRoot: string): Promise<string[]> {\n\tconst receipt = await readReceipt(installRoot)\n\n\t// Early exit: no receipt or no installed components\n\tif (!receipt || Object.keys(receipt.installed).length === 0) {\n\t\treturn []\n\t}\n\n\tconst allInstructions: string[] = []\n\n\t// Collect all instruction paths from all installed components\n\tfor (const [canonicalId, entry] of Object.entries(receipt.installed)) {\n\t\t// Guard: Skip components without opencode config\n\t\tif (!entry.opencode?.instructions) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst instructions = entry.opencode.instructions\n\t\t// Guard: Skip if not an array\n\t\tif (!Array.isArray(instructions)) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Source description for error messages\n\t\tconst source = `${entry.registryName}/${entry.name} (${canonicalId})`\n\n\t\t// Resolve each instruction path (validates and expands globs)\n\t\tconst resolved = resolveRegistryInstructionPaths(instructions, installRoot, source)\n\t\tallInstructions.push(...resolved)\n\t}\n\n\t// Deduplicate (already done in resolveRegistryInstructionPaths, but safe to repeat)\n\treturn Array.from(new Set(allInstructions))\n}\n\n// =============================================================================\n// CONFIG RESOLVER\n// =============================================================================\n\n/**\n * Configuration resolver with scope-isolated registries.\n *\n * Registries are scoped: profile registries OR local registries, never merged.\n * OpenCode config and instructions use additive merging across scopes.\n *\n * Use the static `create()` factory to construct; it parses at the boundary\n * so that `resolve()` and getter methods are synchronous and pure.\n */\nexport class ConfigResolver {\n\tprivate readonly cwd: string\n\tprivate readonly profileName: string | null\n\tprivate readonly profile: Profile | null\n\tprivate readonly localConfigDir: string | null\n\tprivate readonly registryInstructions: string[]\n\n\t// Cached resolution (computed lazily, memoized)\n\tprivate cachedConfig: ResolvedConfig | null = null\n\n\tprivate constructor(\n\t\tcwd: string,\n\t\tprofileName: string | null,\n\t\tprofile: Profile | null,\n\t\tlocalConfigDir: string | null,\n\t\tregistryInstructions: string[],\n\t) {\n\t\tthis.cwd = cwd\n\t\tthis.profileName = profileName\n\t\tthis.profile = profile\n\t\tthis.localConfigDir = localConfigDir\n\t\tthis.registryInstructions = registryInstructions\n\t}\n\n\t/**\n\t * Create a ConfigResolver for the given directory.\n\t *\n\t * Parses configuration at the boundary (Law 2: Parse Don't Validate).\n\t * After construction, all getter methods are synchronous.\n\t *\n\t * Profile Resolution:\n\t * 1. Check local `.opencode/ocx.jsonc` for `profile` field\n\t * 2. Fall back to options.profile\n\t * 3. Fall back to OCX_PROFILE env var\n\t * 4. Fall back to \"default\" profile (if it exists)\n\t * 5. No profile (base configs only)\n\t *\n\t * Explicit sources (local config, CLI, env) fail fast when invalid.\n\t * Only implicit/default resolution can fall back to base config.\n\t *\n\t * @param cwd - Working directory\n\t * @param options - Optional profile override\n\t * @throws ProfileNotFoundError if specified profile doesn't exist\n\t */\n\tstatic async create(cwd: string, options?: { profile?: string }): Promise<ConfigResolver> {\n\t\tconst manager = ProfileManager.create(cwd)\n\n\t\t// Resolve profile intent with explicit precedence:\n\t\t// local config > CLI option > environment > implicit default\n\t\tlet profileName: string | null = null\n\t\tlet profileSource: ProfileResolutionSource = \"none\"\n\t\tconst localConfigDir = findLocalConfigDir(cwd)\n\t\tif (localConfigDir) {\n\t\t\tconst localOcxPath = join(localConfigDir, OCX_CONFIG_FILE)\n\t\t\tif (existsSync(localOcxPath)) {\n\t\t\t\tconst localConfig = parseLocalOcxConfig(localOcxPath)\n\t\t\t\tif (localConfig.profile !== undefined) {\n\t\t\t\t\tprofileName = requireNonEmptyExplicitProfile(\n\t\t\t\t\t\tlocalConfig.profile,\n\t\t\t\t\t\t`local config at ${localOcxPath}`,\n\t\t\t\t\t)\n\t\t\t\t\tprofileSource = \"local-config\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Preserve short-circuit precedence:\n\t\t// once a higher-priority source is selected, lower-priority sources are ignored.\n\t\tif (profileName === null) {\n\t\t\tif (options?.profile !== undefined) {\n\t\t\t\tprofileName = requireNonEmptyExplicitProfile(options.profile, \"CLI option --profile\")\n\t\t\t\tprofileSource = \"cli\"\n\t\t\t} else if (process.env.OCX_PROFILE !== undefined) {\n\t\t\t\tprofileName = requireNonEmptyExplicitProfile(\n\t\t\t\t\tprocess.env.OCX_PROFILE,\n\t\t\t\t\t\"environment variable OCX_PROFILE\",\n\t\t\t\t)\n\t\t\t\tprofileSource = \"env\"\n\t\t\t}\n\t\t}\n\n\t\tconst isInitialized = await manager.isInitialized()\n\t\tif (isExplicitProfileSource(profileSource) && !isInitialized) {\n\t\t\tthrow new ProfilesNotInitializedError()\n\t\t}\n\n\t\tlet profile: Profile | null = null\n\n\t\tif (isInitialized) {\n\t\t\t// Explicit sources must fail fast: no fallback to default/base config.\n\t\t\tif (profileName !== null) {\n\t\t\t\tprofile = await manager.getLayered(profileName, cwd)\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\t// Implicit resolution can still fall back to base config.\n\t\t\t\t\tprofileName = await manager.resolveProfile()\n\t\t\t\t\tprofile = await manager.getLayered(profileName, cwd)\n\t\t\t\t\tprofileSource = \"default\"\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!(error instanceof ProfileNotFoundError) || error.profile !== \"default\") {\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\n\t\t\t\t\tprofileName = null\n\t\t\t\t\tprofile = null\n\t\t\t\t\tprofileSource = \"none\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Load registry-provided instructions from receipt\n\t\t// Install root selection:\n\t\t// - Profile active → profile directory\n\t\t// - Local config exists → project root (parent of .opencode)\n\t\t// - Otherwise → global config directory\n\t\tlet installRoot: string\n\t\tif (profile) {\n\t\t\t// Use resolved profile object, not profileName\n\t\t\t// profileName could be set but profile failed to load\n\t\t\tinstallRoot = getProfileDir(profileName as string)\n\t\t} else if (localConfigDir) {\n\t\t\t// Project root is parent of .opencode directory\n\t\t\tinstallRoot = join(localConfigDir, \"..\")\n\t\t} else {\n\t\t\tinstallRoot = getGlobalConfigPath()\n\t\t}\n\n\t\tconst registryInstructions = await loadRegistryInstructionsFromReceipt(installRoot)\n\n\t\treturn new ConfigResolver(cwd, profileName, profile, localConfigDir, registryInstructions)\n\t}\n\n\t/**\n\t * Resolve configuration with global profile support.\n\t *\n\t * - Registries: Profile OR local (isolated, not merged)\n\t * - OpenCode config: Always merged (profile + local) to match OpenCode layering.\n\t * Local opencode.jsonc always participates in merge regardless of exclude/include\n\t * patterns, because exclude/include controls instruction file discovery, not config merging.\n\t *\n\t * Uses memoization - first call computes, subsequent calls return cached result.\n\t * Pure function (Law 3: Atomic Predictability) - same instance always returns same result.\n\t */\n\tresolve(): ResolvedConfig {\n\t\t// Return cached if available\n\t\tif (this.cachedConfig) {\n\t\t\treturn this.cachedConfig\n\t\t}\n\n\t\t// 1. Start with defaults\n\t\tlet registries: Record<string, RegistryConfig> = {}\n\t\tlet componentPath = LOCAL_CONFIG_DIR\n\t\tlet opencode: Record<string, unknown> = {}\n\n\t\t// 2. Apply global profile if resolved\n\t\tif (this.profile) {\n\t\t\tregistries = { ...registries, ...this.profile.ocx.registries }\n\t\t\tif (this.profile.ocx.componentPath) {\n\t\t\t\tcomponentPath = this.profile.ocx.componentPath\n\t\t\t}\n\t\t\tif (this.profile.opencode) {\n\t\t\t\topencode = this.mergeOpencode(opencode, this.profile.opencode)\n\t\t\t}\n\t\t}\n\n\t\t// 3. Check exclude/include patterns (for instruction files and OCX registries only)\n\t\tconst shouldLoadLocalOcx = this.shouldLoadLocalConfig()\n\n\t\t// 4. Apply local OCX registries ONLY when no profile active (isolation)\n\t\tif (!this.profile && shouldLoadLocalOcx && this.localConfigDir) {\n\t\t\tconst localOcxConfig = this.loadLocalOcxConfig()\n\t\t\tif (localOcxConfig) {\n\t\t\t\tregistries = localOcxConfig.registries\n\t\t\t}\n\t\t}\n\n\t\t// 5. Apply local OpenCode config (ALWAYS merges with profile)\n\t\t// Local opencode.jsonc always participates in merge regardless of exclude/include\n\t\t// patterns to match OpenCode's layering semantics.\n\t\tif (this.localConfigDir) {\n\t\t\tconst localOpencodeConfig = this.loadLocalOpencodeConfig()\n\t\t\tif (localOpencodeConfig) {\n\t\t\t\topencode = this.mergeOpencode(opencode, localOpencodeConfig)\n\t\t\t}\n\t\t}\n\n\t\t// 6. Discover instruction files\n\t\tconst instructions = this.discoverInstructions()\n\n\t\tthis.cachedConfig = {\n\t\t\tregistries,\n\t\t\tcomponentPath,\n\t\t\topencode,\n\t\t\tinstructions,\n\t\t\tprofileName: this.profileName,\n\t\t}\n\n\t\treturn this.cachedConfig\n\t}\n\n\t/**\n\t * Resolve config with origin tracking for debugging.\n\t * Used by `ocx config show --origin`\n\t */\n\tresolveWithOrigin(): ResolvedConfigWithOrigin {\n\t\tconst origins = new Map<string, ConfigOrigin>()\n\n\t\t// 1. Start with defaults\n\t\tconst registries: Record<string, RegistryConfig> = {}\n\t\tlet componentPath = LOCAL_CONFIG_DIR\n\t\tlet opencode: Record<string, unknown> = {}\n\n\t\torigins.set(\"componentPath\", { path: \"\", source: \"default\" })\n\n\t\t// 2. Apply global profile if resolved\n\t\tif (this.profile) {\n\t\t\tconst profileOcxPath = `~/.config/opencode/profiles/${this.profileName}/ocx.jsonc`\n\n\t\t\tfor (const [key, value] of Object.entries(this.profile.ocx.registries)) {\n\t\t\t\tregistries[key] = value\n\t\t\t\torigins.set(`registries.${key}`, { path: profileOcxPath, source: \"global-profile\" })\n\t\t\t}\n\n\t\t\tif (this.profile.ocx.componentPath) {\n\t\t\t\tcomponentPath = this.profile.ocx.componentPath\n\t\t\t\torigins.set(\"componentPath\", { path: profileOcxPath, source: \"global-profile\" })\n\t\t\t}\n\n\t\t\tif (this.profile.opencode) {\n\t\t\t\topencode = this.mergeOpencode(opencode, this.profile.opencode)\n\t\t\t\tconst profileOpencodePath = `~/.config/opencode/profiles/${this.profileName}/opencode.jsonc`\n\t\t\t\tfor (const key of Object.keys(this.profile.opencode)) {\n\t\t\t\t\torigins.set(`opencode.${key}`, { path: profileOpencodePath, source: \"global-profile\" })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 3. Check exclude/include patterns (for instruction files and OCX registries only)\n\t\tconst shouldLoadLocalOcx = this.shouldLoadLocalConfig()\n\n\t\t// 4. Apply local OCX registries ONLY when no profile active (isolation)\n\t\tif (!this.profile && shouldLoadLocalOcx && this.localConfigDir) {\n\t\t\tconst localOcxConfig = this.loadLocalOcxConfig()\n\t\t\tif (localOcxConfig) {\n\t\t\t\tconst localOcxPath = join(this.localConfigDir, OCX_CONFIG_FILE)\n\t\t\t\tfor (const [key, value] of Object.entries(localOcxConfig.registries)) {\n\t\t\t\t\tregistries[key] = value\n\t\t\t\t\torigins.set(`registries.${key}`, { path: localOcxPath, source: \"local-config\" })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 5. Apply local OpenCode config (ALWAYS merges with profile)\n\t\t// Local opencode.jsonc always participates in merge regardless of exclude/include\n\t\t// patterns to match OpenCode's layering semantics.\n\t\tif (this.localConfigDir) {\n\t\t\tconst localOpencodeConfig = this.loadLocalOpencodeConfig()\n\t\t\tif (localOpencodeConfig) {\n\t\t\t\topencode = this.mergeOpencode(opencode, localOpencodeConfig)\n\t\t\t\tconst localOpencodePath = join(this.localConfigDir, OPENCODE_CONFIG_FILE)\n\t\t\t\tfor (const key of Object.keys(localOpencodeConfig)) {\n\t\t\t\t\torigins.set(`opencode.${key}`, { path: localOpencodePath, source: \"local-opencode\" })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 6. Discover instruction files\n\t\tconst instructions = this.discoverInstructions()\n\n\t\treturn {\n\t\t\tregistries,\n\t\t\tcomponentPath,\n\t\t\topencode,\n\t\t\tinstructions,\n\t\t\tprofileName: this.profileName,\n\t\t\torigins,\n\t\t}\n\t}\n\n\t/**\n\t * Check if local config should be loaded based on exclude/include patterns.\n\t *\n\t * Returns true if local .opencode/ directory is NOT excluded by profile patterns.\n\t */\n\tprivate shouldLoadLocalConfig(): boolean {\n\t\t// If no profile or no exclude patterns, load local config\n\t\tif (!this.profile?.ocx.exclude) return true\n\t\tif (!this.localConfigDir) return true\n\n\t\t// Get git root for relative path calculation (supports worktrees)\n\t\tconst gitRoot = resolveGitRootSync(this.cwd)\n\t\tconst root = gitRoot\n\n\t\t// Get relative path of local config dir from root\n\t\tconst relativePath = relative(root, this.localConfigDir)\n\n\t\t// Check if .opencode directory matches exclude patterns\n\t\tconst exclude = this.profile.ocx.exclude ?? []\n\t\tconst include = this.profile.ocx.include ?? []\n\n\t\t// Check include first - include overrides exclude\n\t\tfor (const pattern of include) {\n\t\t\tconst glob = new Glob(normalizePattern(pattern))\n\t\t\t// Match the directory path with trailing content\n\t\t\tif (glob.match(`${relativePath}/`) || glob.match(relativePath)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\t// Check exclude\n\t\tfor (const pattern of exclude) {\n\t\t\tconst glob = new Glob(normalizePattern(pattern))\n\t\t\t// Check if pattern matches .opencode directory\n\t\t\tif (glob.match(`${relativePath}/`) || glob.match(`${relativePath}/**`)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t/**\n\t * Load local ocx.jsonc configuration.\n\t * Returns null if file doesn't exist.\n\t * Throws ConfigError if the file exists but is invalid.\n\t */\n\tprivate loadLocalOcxConfig(): { registries: Record<string, RegistryConfig> } | null {\n\t\tif (!this.localConfigDir) return null\n\n\t\tconst configPath = join(this.localConfigDir, OCX_CONFIG_FILE)\n\t\tif (!existsSync(configPath)) return null\n\n\t\tconst parsed = parseLocalOcxConfig(configPath)\n\t\treturn {\n\t\t\tregistries: parsed.registries,\n\t\t}\n\t}\n\n\t/**\n\t * Load local opencode.jsonc configuration.\n\t * Returns null if file doesn't exist.\n\t * Throws ConfigError if the file exists but is invalid.\n\t */\n\tprivate loadLocalOpencodeConfig(): Record<string, unknown> | null {\n\t\tif (!this.localConfigDir) return null\n\n\t\tconst configPath = join(this.localConfigDir, OPENCODE_CONFIG_FILE)\n\t\tif (!existsSync(configPath)) return null\n\n\t\treturn parseLocalOpencodeConfig(configPath)\n\t}\n\n\t/**\n\t * Discover instruction files matching OpenCode's exact behavior.\n\t *\n\t * Discovery order (top to bottom in merged file):\n\t * 1. Global AGENTS.md (or CLAUDE.md fallback for Claude Code compat)\n\t * 2. Global Profile AGENTS.md (when profile active)\n\t * 3. Registry-provided instructions (from installed components - resolved to absolute)\n\t * 4. Local (Project) files - first file type wins (AGENTS.md > CLAUDE.md > CONTEXT.md)\n\t *\n\t * exclude/include patterns apply ONLY to LOCAL (project) files.\n\t *\n\t * References:\n\t * - Global discovery: https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/instruction.ts#L19-L29\n\t * - Project discovery: https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/instruction.ts#L75-L84\n\t */\n\tprivate discoverInstructions(): string[] {\n\t\tconst instructions: string[] = []\n\n\t\t// 1. Global AGENTS.md (always first - lowest priority)\n\t\tconst globalConfigDir = getGlobalConfigPath()\n\t\tconst globalAgents = join(globalConfigDir, \"AGENTS.md\")\n\t\tif (existsSync(globalAgents)) {\n\t\t\tinstructions.push(globalAgents)\n\t\t} else if (!process.env.OPENCODE_DISABLE_CLAUDE_CODE_PROMPT) {\n\t\t\t// Claude Code fallback - check ~/.claude/CLAUDE.md\n\t\t\tconst claudeGlobal = join(homedir(), \".claude\", \"CLAUDE.md\")\n\t\t\tif (existsSync(claudeGlobal)) {\n\t\t\t\tinstructions.push(claudeGlobal)\n\t\t\t}\n\t\t}\n\n\t\t// 2. Global Profile AGENTS.md (when profile active)\n\t\tif (this.profile && this.profileName) {\n\t\t\tconst globalProfileAgents = join(getProfileDir(this.profileName), \"AGENTS.md\")\n\t\t\tif (existsSync(globalProfileAgents)) {\n\t\t\t\tinstructions.push(globalProfileAgents)\n\t\t\t}\n\t\t}\n\n\t\t// 3. Registry-provided instructions (from installed components)\n\t\t// Load from receipt and resolve install-root-relative paths to absolute\n\t\tconst registryInstructions = this.loadRegistryInstructions()\n\t\tinstructions.push(...registryInstructions)\n\n\t\t// 4. Local (Project) files - first file type wins, filtered by exclude/include\n\t\tconst gitRoot = resolveGitRootSync(this.cwd)\n\t\tconst discoveredFiles = discoverInstructionFiles(this.cwd, gitRoot)\n\n\t\t// Apply profile exclude/include patterns to LOCAL files only\n\t\tconst exclude = this.profile?.ocx.exclude ?? []\n\t\tconst include = this.profile?.ocx.include ?? []\n\t\tconst filteredFiles = filterByPatterns(discoveredFiles, exclude, include)\n\n\t\t// Convert to absolute paths\n\t\tconst projectInstructions = filteredFiles.map((f) => join(gitRoot, f))\n\t\tinstructions.push(...projectInstructions)\n\n\t\treturn instructions\n\t}\n\n\t/**\n\t * Load registry-provided instruction paths from installed components.\n\t * Returns cached data loaded during create().\n\t *\n\t * @returns Array of absolute instruction paths from registry components\n\t */\n\tprivate loadRegistryInstructions(): string[] {\n\t\treturn this.registryInstructions\n\t}\n\n\t/**\n\t * Wrapper for OpenCode config merging with type conversions.\n\t *\n\t * Casts between Record<string, unknown> and NormalizedOpencodeConfig.\n\t * Safe because inputs are validated at config loading boundary.\n\t * Uses the shared mergeOpencodeConfig utility which correctly handles:\n\t * - plugin array: concatenate + dedupe by canonical name (last wins)\n\t * - instructions array: concatenate + dedupe by exact string\n\t * - All other arrays: source replaces target (mergeDeep default)\n\t */\n\tprivate mergeOpencode(\n\t\ttarget: Record<string, unknown>,\n\t\tsource: Record<string, unknown>,\n\t): Record<string, unknown> {\n\t\treturn mergeOpencodeConfig(\n\t\t\ttarget as NormalizedOpencodeConfig,\n\t\t\tsource as NormalizedOpencodeConfig,\n\t\t) as Record<string, unknown>\n\t}\n\n\t// =========================================================================\n\t// CONVENIENCE GETTERS (for compatibility with existing code)\n\t// =========================================================================\n\n\t/**\n\t * Get registries from the active scope (profile OR local, not merged).\n\t *\n\t * When a profile is active: returns ONLY profile's registries\n\t * When no profile: returns ONLY local registries\n\t */\n\tgetRegistries(): Record<string, RegistryConfig> {\n\t\treturn this.resolve().registries\n\t}\n\n\t/**\n\t * Get the component installation path.\n\t */\n\tgetComponentPath(): string {\n\t\treturn this.resolve().componentPath\n\t}\n\n\t/**\n\t * Get the resolved profile name, or null if no profile.\n\t */\n\tgetProfileName(): string | null {\n\t\treturn this.profileName\n\t}\n\n\t/**\n\t * Get the working directory this resolver was created for.\n\t */\n\tgetCwd(): string {\n\t\treturn this.cwd\n\t}\n\n\t/**\n\t * Get the resolved profile, or null if no profile.\n\t */\n\tgetProfile(): Profile | null {\n\t\treturn this.profile\n\t}\n}\n",
43
- "import { mkdir, readdir, rename, rm, stat } from \"node:fs/promises\"\nimport { type ParseError, parse as parseJsonc, printParseErrorCode } from \"jsonc-parser\"\nimport type { ProfileOcxConfig } from \"../schemas/ocx\"\nimport { profileOcxConfigSchema } from \"../schemas/ocx\"\nimport {\n\tConfigError,\n\tConflictError,\n\tInvalidProfileNameError,\n\tLocalProfileUnsupportedError,\n\tProfileExistsError,\n\tProfileNotFoundError,\n\tProfilesNotInitializedError,\n} from \"../utils/errors\"\nimport { atomicWrite } from \"./atomic\"\nimport {\n\tgetLocalProfileDir,\n\tgetProfileAgents,\n\tgetProfileDir,\n\tgetProfileOcxConfig,\n\tgetProfileOpencodeConfig,\n\tgetProfilesDir,\n} from \"./paths\"\nimport type { Profile } from \"./schema\"\nimport { profileNameSchema } from \"./schema\"\n\n/**\n * Default ocx.jsonc config for new profiles (programmatic use).\n * Note: AGENTS.md is NOT excluded by default - it's commented out in the template.\n */\nexport const DEFAULT_OCX_CONFIG: ProfileOcxConfig = {\n\t$schema: \"https://ocx.kdco.dev/schemas/profile.json\",\n\tregistries: {},\n\trenameWindow: true,\n\texclude: [\n\t\t\"**/CLAUDE.md\",\n\t\t\"**/CONTEXT.md\",\n\t\t\"**/.opencode/**\",\n\t\t\"**/opencode.jsonc\",\n\t\t\"**/opencode.json\",\n\t],\n\tinclude: [],\n}\n\n/**\n * Default ocx.jsonc JSONC template for new profiles.\n * Includes commented-out AGENTS.md line so users can easily enable exclusion.\n */\nexport const DEFAULT_OCX_CONFIG_TEMPLATE = `{\n \"$schema\": \"https://ocx.kdco.dev/schemas/profile.json\",\n \"registries\": {},\n \"renameWindow\": true,\n \"exclude\": [\n // \"**/AGENTS.md\",\n \"**/CLAUDE.md\",\n \"**/CONTEXT.md\",\n \"**/.opencode/**\",\n \"**/opencode.jsonc\",\n \"**/opencode.json\"\n ],\n \"include\": []\n}\n`\n\nfunction formatJsoncParseError(parseErrors: ParseError[]): string {\n\tif (parseErrors.length === 0) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\tconst firstError = parseErrors[0]\n\tif (!firstError) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\treturn `${printParseErrorCode(firstError.error)} at offset ${firstError.offset}`\n}\n\nfunction parseJsoncOrThrow(content: string, filePath: string): unknown {\n\tconst parseErrors: ParseError[] = []\n\tconst parsed = parseJsonc(content, parseErrors, { allowTrailingComma: true })\n\n\tif (parseErrors.length > 0) {\n\t\tconst errorDetail = formatJsoncParseError(parseErrors)\n\t\tthrow new ConfigError(`Invalid JSONC in ${filePath}: ${errorDetail}`)\n\t}\n\n\treturn parsed\n}\n\nfunction parseProfileOcxConfigOrThrow(\n\trawConfig: unknown,\n\tfilePath: string,\n\tprofileName: string,\n): ProfileOcxConfig {\n\tconst validationResult = profileOcxConfigSchema.safeParse(rawConfig)\n\tif (!validationResult.success) {\n\t\tconst firstIssue = validationResult.error.issues[0]\n\t\tconst issuePath = firstIssue?.path.length ? firstIssue.path.join(\".\") : \"root\"\n\t\tconst issueMessage = firstIssue?.message ?? \"Invalid profile OCX configuration\"\n\t\tthrow new ConfigError(\n\t\t\t`Invalid profile \"${profileName}\" ocx.jsonc at ${filePath}: ${issuePath} ${issueMessage}`,\n\t\t)\n\t}\n\n\treturn validationResult.data\n}\n\nfunction parseProfileOpencodeConfigOrThrow(\n\trawConfig: unknown,\n\tfilePath: string,\n\tprofileName: string,\n): Record<string, unknown> {\n\tif (!rawConfig || typeof rawConfig !== \"object\" || Array.isArray(rawConfig)) {\n\t\tthrow new ConfigError(\n\t\t\t`Invalid profile \"${profileName}\" opencode.jsonc at ${filePath}: root must be an object`,\n\t\t)\n\t}\n\n\treturn rawConfig as Record<string, unknown>\n}\n\nfunction requireNonEmptyProfileName(profileName: string, sourceDescription: string): string {\n\tif (profileName.trim().length === 0) {\n\t\tthrow new ConfigError(\n\t\t\t`Invalid profile from ${sourceDescription}: value cannot be empty or whitespace`,\n\t\t)\n\t}\n\n\treturn profileName\n}\n\n/**\n * Manages OCX profiles (global-only).\n *\n * All profiles are stored in the global config directory (~/.config/opencode/profiles/).\n * Local profiles are unsupported; any local profile directory presence triggers a hard error\n * via getLayered().\n *\n * Uses static factory pattern for consistent construction.\n */\nexport class ProfileManager {\n\tprivate constructor(private readonly cwd: string = process.cwd()) {}\n\n\t/** Returns the profiles directory, reading fresh from environment each access. */\n\tprivate get profilesDir(): string {\n\t\treturn getProfilesDir()\n\t}\n\n\t/**\n\t * Create a ProfileManager instance.\n\t * Does not require profiles to be initialized.\n\t */\n\tstatic create(cwd?: string): ProfileManager {\n\t\treturn new ProfileManager(cwd ?? process.cwd())\n\t}\n\n\t/**\n\t * Get a ProfileManager instance, throwing if OCX is not initialized.\n\t * Use this in commands that require profiles to exist.\n\t *\n\t * @throws ProfilesNotInitializedError if OCX is not initialized\n\t * @returns ProfileManager instance guaranteed to be initialized\n\t */\n\tstatic async requireInitialized(): Promise<ProfileManager> {\n\t\tconst manager = ProfileManager.create()\n\t\tif (!(await manager.isInitialized())) {\n\t\t\tthrow new ProfilesNotInitializedError()\n\t\t}\n\t\treturn manager\n\t}\n\n\t/**\n\t * Check if profiles have been initialized.\n\t */\n\tasync isInitialized(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst stats = await stat(this.profilesDir)\n\t\t\treturn stats.isDirectory()\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Ensure profiles are initialized, throw if not.\n\t */\n\tprivate async ensureInitialized(): Promise<void> {\n\t\tif (!(await this.isInitialized())) {\n\t\t\tthrow new ProfilesNotInitializedError()\n\t\t}\n\t}\n\n\t/**\n\t * List all global profile names.\n\t * @returns Array of profile names, sorted alphabetically\n\t */\n\tasync list(): Promise<string[]> {\n\t\tawait this.ensureInitialized()\n\n\t\tconst entries = await readdir(this.profilesDir, { withFileTypes: true, encoding: \"utf8\" })\n\t\treturn entries\n\t\t\t.filter((e) => e.isDirectory() && !e.name.startsWith(\".\"))\n\t\t\t.map((e) => e.name)\n\t\t\t.sort()\n\t}\n\n\t/**\n\t * Check if a global profile exists.\n\t * @param name - Profile name\n\t */\n\tasync exists(name: string): Promise<boolean> {\n\t\tconst dir = getProfileDir(name)\n\t\ttry {\n\t\t\tconst stats = await stat(dir)\n\t\t\treturn stats.isDirectory()\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Load a global profile by name.\n\t * @param name - Profile name\n\t * @returns Loaded and validated profile\n\t */\n\tasync get(name: string): Promise<Profile> {\n\t\tif (!(await this.exists(name))) {\n\t\t\tthrow new ProfileNotFoundError(name)\n\t\t}\n\n\t\t// Check ocx.jsonc exists with descriptive error\n\t\tconst ocxPath = getProfileOcxConfig(name)\n\t\tconst ocxFile = Bun.file(ocxPath)\n\n\t\tif (!(await ocxFile.exists())) {\n\t\t\tthrow new ConfigError(`Profile \"${name}\" is missing ocx.jsonc. Expected at: ${ocxPath}`)\n\t\t}\n\n\t\tconst ocxContent = await ocxFile.text()\n\t\tconst ocxRaw = parseJsoncOrThrow(ocxContent, ocxPath)\n\t\tconst ocx = parseProfileOcxConfigOrThrow(ocxRaw, ocxPath, name)\n\n\t\t// Load opencode.jsonc (optional)\n\t\tconst opencodePath = getProfileOpencodeConfig(name)\n\t\tconst opencodeFile = Bun.file(opencodePath)\n\t\tlet opencode: Record<string, unknown> | undefined\n\t\tif (await opencodeFile.exists()) {\n\t\t\tconst opencodeContent = await opencodeFile.text()\n\t\t\tconst opencodeRaw = parseJsoncOrThrow(opencodeContent, opencodePath)\n\t\t\topencode = parseProfileOpencodeConfigOrThrow(opencodeRaw, opencodePath, name)\n\t\t}\n\n\t\t// Check for AGENTS.md\n\t\tconst agentsPath = getProfileAgents(name)\n\t\tconst agentsFile = Bun.file(agentsPath)\n\t\tconst hasAgents = await agentsFile.exists()\n\n\t\treturn {\n\t\t\tname,\n\t\t\tocx,\n\t\t\topencode,\n\t\t\thasAgents,\n\t\t}\n\t}\n\n\t/**\n\t * Load a global-only profile. Hard errors if a local profile directory exists.\n\t *\n\t * Local profiles are unsupported. If a local profile directory is detected\n\t * for the active profile, a LocalProfileUnsupportedError is thrown immediately\n\t * (Law 4: Fail Fast, Fail Loud).\n\t *\n\t * @param name - Profile name\n\t * @param cwd - Current working directory (for local profile detection)\n\t * @returns Global profile\n\t * @throws ProfileNotFoundError if global profile doesn't exist\n\t * @throws LocalProfileUnsupportedError if local profile directory exists\n\t */\n\tasync getLayered(name: string, cwd: string): Promise<Profile> {\n\t\t// Guard: Reject local profile directory presence (Law 1: Early Exit)\n\t\tconst localDir = getLocalProfileDir(name, cwd)\n\t\tlet localExists = false\n\t\ttry {\n\t\t\tconst stats = await stat(localDir)\n\t\t\tlocalExists = stats.isDirectory()\n\t\t} catch {\n\t\t\tlocalExists = false\n\t\t}\n\t\tif (localExists) {\n\t\t\tthrow new LocalProfileUnsupportedError(name, localDir)\n\t\t}\n\n\t\t// Load global profile (the only supported source)\n\t\treturn this.get(name)\n\t}\n\n\t/**\n\t * Create a new global profile.\n\t * @param name - Profile name (validated)\n\t */\n\tasync add(name: string): Promise<void> {\n\t\t// Validate name\n\t\tconst result = profileNameSchema.safeParse(name)\n\t\tif (!result.success) {\n\t\t\tthrow new InvalidProfileNameError(name, result.error.errors[0]?.message ?? \"Invalid name\")\n\t\t}\n\n\t\t// Check doesn't exist\n\t\tif (await this.exists(name)) {\n\t\t\tthrow new ProfileExistsError(name)\n\t\t}\n\n\t\t// Create directory with secure permissions\n\t\tconst dir = getProfileDir(name)\n\t\tawait mkdir(dir, { recursive: true, mode: 0o700 })\n\n\t\t// Create ocx.jsonc with create-if-missing (uses JSONC template with commented AGENTS.md)\n\t\tconst ocxPath = getProfileOcxConfig(name)\n\t\tconst ocxFile = Bun.file(ocxPath)\n\t\tif (!(await ocxFile.exists())) {\n\t\t\tawait Bun.write(ocxPath, DEFAULT_OCX_CONFIG_TEMPLATE, { mode: 0o600 })\n\t\t}\n\n\t\t// Create opencode.jsonc with create-if-missing\n\t\tconst opencodePath = getProfileOpencodeConfig(name)\n\t\tconst opencodeFile = Bun.file(opencodePath)\n\t\tif (!(await opencodeFile.exists())) {\n\t\t\tawait atomicWrite(opencodePath, {})\n\t\t}\n\n\t\t// Create AGENTS.md with create-if-missing\n\t\tconst agentsPath = getProfileAgents(name)\n\t\tconst agentsFile = Bun.file(agentsPath)\n\t\tif (!(await agentsFile.exists())) {\n\t\t\tconst agentsContent = `# Profile Instructions\n\n<!-- Add your custom instructions for this profile here -->\n<!-- These will be included when running \\`ocx opencode -p ${name}\\` -->\n`\n\t\t\tawait Bun.write(agentsPath, agentsContent, { mode: 0o600 })\n\t\t}\n\t}\n\n\t/**\n\t * Remove a global profile.\n\t * @param name - Profile name\n\t */\n\tasync remove(name: string): Promise<void> {\n\t\tif (!(await this.exists(name))) {\n\t\t\tthrow new ProfileNotFoundError(name)\n\t\t}\n\n\t\tconst profiles = await this.list()\n\t\tif (profiles.length <= 1) {\n\t\t\tthrow new Error(\"Cannot delete the last profile. At least one profile must exist.\")\n\t\t}\n\n\t\tconst dir = getProfileDir(name)\n\t\tawait rm(dir, { recursive: true })\n\t}\n\n\t/**\n\t * Move (rename) a global profile atomically.\n\t * @param oldName - Current profile name\n\t * @param newName - New profile name\n\t * @returns Object indicating if active profile warning should be shown\n\t */\n\tasync move(oldName: string, newName: string): Promise<{ warnActiveProfile: boolean }> {\n\t\t// 1. Validate oldName format\n\t\tconst oldResult = profileNameSchema.safeParse(oldName)\n\t\tif (!oldResult.success) {\n\t\t\tthrow new InvalidProfileNameError(\n\t\t\t\toldName,\n\t\t\t\toldResult.error.errors[0]?.message ?? \"Invalid name\",\n\t\t\t)\n\t\t}\n\n\t\t// 2. Validate newName format\n\t\tconst newResult = profileNameSchema.safeParse(newName)\n\t\tif (!newResult.success) {\n\t\t\tthrow new InvalidProfileNameError(\n\t\t\t\tnewName,\n\t\t\t\tnewResult.error.errors[0]?.message ?? \"Invalid name\",\n\t\t\t)\n\t\t}\n\n\t\t// 3. Ensure profiles are initialized\n\t\tawait this.ensureInitialized()\n\n\t\t// 4. Check source exists\n\t\tif (!(await this.exists(oldName))) {\n\t\t\tthrow new ProfileNotFoundError(oldName)\n\t\t}\n\n\t\t// 5. Check for self-move (no-op) - safe now that we know source exists\n\t\tif (oldName === newName) {\n\t\t\treturn { warnActiveProfile: false }\n\t\t}\n\n\t\t// 6. Check target doesn't exist\n\t\tif (await this.exists(newName)) {\n\t\t\tthrow new ConflictError(\n\t\t\t\t`Cannot move: profile \"${newName}\" already exists. Remove it first with 'ocx profile rm ${newName} --global'.`,\n\t\t\t)\n\t\t}\n\n\t\t// 7. Check if moving active profile\n\t\tconst warnActiveProfile = process.env.OCX_PROFILE === oldName\n\n\t\t// 8. Atomic rename (with race condition handling)\n\t\tconst oldDir = getProfileDir(oldName)\n\t\tconst newDir = getProfileDir(newName)\n\t\ttry {\n\t\t\tawait rename(oldDir, newDir)\n\t\t} catch (error) {\n\t\t\t// Handle race condition where destination was created between check and rename\n\t\t\tif (error instanceof Error && \"code\" in error) {\n\t\t\t\tconst code = (error as NodeJS.ErrnoException).code\n\t\t\t\tif (code === \"EEXIST\" || code === \"ENOTEMPTY\") {\n\t\t\t\t\tthrow new ConflictError(\n\t\t\t\t\t\t`Cannot move: profile \"${newName}\" already exists. Remove it first with 'ocx profile rm ${newName} --global'.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tif (code === \"ENOENT\") {\n\t\t\t\t\tthrow new ProfileNotFoundError(oldName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\n\t\treturn { warnActiveProfile }\n\t}\n\n\t/**\n\t * Resolve the profile name to use.\n\t * Priority: override (from -p flag) > OCX_PROFILE env > \"default\"\n\t *\n\t * @param override - Optional override from --profile flag\n\t * @returns Resolved profile name (validated to exist)\n\t * @throws ProfileNotFoundError if resolved profile doesn't exist\n\t */\n\tasync resolveProfile(override?: string): Promise<string> {\n\t\t// Priority 1: Explicit override from -p/--profile flag\n\t\tif (override !== undefined) {\n\t\t\tconst profileName = requireNonEmptyProfileName(override, \"CLI option --profile\")\n\t\t\tif (!(await this.exists(profileName))) {\n\t\t\t\tthrow new ProfileNotFoundError(profileName)\n\t\t\t}\n\t\t\treturn profileName\n\t\t}\n\n\t\t// Priority 2: OCX_PROFILE environment variable\n\t\tconst envProfile = process.env.OCX_PROFILE\n\t\tif (envProfile !== undefined) {\n\t\t\tconst profileName = requireNonEmptyProfileName(envProfile, \"environment variable OCX_PROFILE\")\n\t\t\tif (!(await this.exists(profileName))) {\n\t\t\t\tthrow new ProfileNotFoundError(profileName)\n\t\t\t}\n\t\t\treturn profileName\n\t\t}\n\n\t\t// Priority 3: Fall back to \"default\" profile\n\t\tconst defaultProfile = \"default\"\n\t\tif (!(await this.exists(defaultProfile))) {\n\t\t\tthrow new ProfileNotFoundError(defaultProfile)\n\t\t}\n\t\treturn defaultProfile\n\t}\n\n\t/**\n\t * Initialize profiles with a default profile.\n\t * Called by `ocx init --global`.\n\t */\n\tasync initialize(): Promise<void> {\n\t\t// Create profiles directory\n\t\tawait mkdir(this.profilesDir, { recursive: true, mode: 0o700 })\n\n\t\t// Create default profile\n\t\tawait this.add(\"default\")\n\t}\n}\n",
44
- "/**\n * OCX Profile Config Schema\n *\n * V2: Schema for ocx.jsonc (within profiles) - the OCX configuration file\n * stored at ~/.config/opencode/profiles/<name>/ocx.jsonc (XDG-compliant).\n *\n * Profiles layer with local configs of the same name.\n * Visibility is controlled by include/exclude patterns (no isolation flag).\n */\n\nimport { Glob } from \"bun\"\nimport { z } from \"zod\"\nimport { safeRelativePathSchema } from \"./common\"\nimport { registryConfigSchema } from \"./config\"\n\n/**\n * Validates that a string is a valid glob pattern.\n */\nconst globPatternSchema = z.string().refine(\n\t(pattern) => {\n\t\ttry {\n\t\t\tnew Glob(pattern)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t},\n\t{ message: \"Invalid glob pattern\" },\n)\n\n// =============================================================================\n// PROFILE OCX CONFIG SCHEMA (ocx.jsonc in profiles)\n// =============================================================================\n\n/**\n * V2: OCX profile configuration schema\n *\n * Contains OCX-specific settings (registries, componentPath).\n * OpenCode configuration is stored separately in opencode.jsonc.\n * Profiles layer: global base + local overlay of same name (overlay wins).\n */\nexport const profileOcxConfigSchema = z.object({\n\t/** Schema URL for IDE support */\n\t$schema: z.string().optional(),\n\n\t/** Path to OpenCode binary. Falls back to OPENCODE_BIN env var, then \"opencode\". */\n\tbin: z.string().optional(),\n\n\t/**\n\t * Configured registries for OCX profiles\n\t * Same format as ocx.jsonc registries\n\t */\n\tregistries: z.record(registryConfigSchema).default({}),\n\n\t/**\n\t * Optional default component path for installations\n\t * If not set, uses the standard .opencode directory\n\t * Uses safeRelativePathSchema to prevent path traversal attacks\n\t */\n\tcomponentPath: safeRelativePathSchema.optional(),\n\n\t/**\n\t * Whether to set terminal/tmux window name when launching OpenCode.\n\t * Set to false to preserve your existing terminal title.\n\t */\n\trenameWindow: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe(\"Set terminal/tmux window name when launching OpenCode\"),\n\n\t/**\n\t * V2: Glob patterns for project files to exclude from OpenCode discovery.\n\t * Controls visibility of local config files.\n\t * Note: AGENTS.md is NOT excluded by default - uncomment in ocx.jsonc to exclude.\n\t */\n\texclude: z\n\t\t.array(globPatternSchema)\n\t\t.default([\n\t\t\t\"**/CLAUDE.md\",\n\t\t\t\"**/CONTEXT.md\",\n\t\t\t\"**/.opencode/**\",\n\t\t\t\"**/opencode.jsonc\",\n\t\t\t\"**/opencode.json\",\n\t\t])\n\t\t.describe(\"Glob patterns for project files to exclude from OpenCode discovery\"),\n\n\t/**\n\t * V2: Glob patterns for project files to include (overrides exclude).\n\t * Use when you need specific files from otherwise excluded patterns.\n\t */\n\tinclude: z\n\t\t.array(globPatternSchema)\n\t\t.default([])\n\t\t.describe(\"Glob patterns for project files to include (overrides exclude)\"),\n})\n\nexport type ProfileOcxConfig = z.infer<typeof profileOcxConfigSchema>\n",
45
- "/**\n * Common Schemas\n *\n * Reusable Zod schemas for validation across the codebase.\n * Following Law 2: Parse at boundary - validate once, trust internally.\n */\n\nimport { z } from \"zod\"\nimport { isAbsolutePath } from \"../utils/path-helpers\"\n\n/**\n * Schema for a safe relative path that cannot escape the project root.\n * Layer 1 of path traversal protection (schema validation at parse boundary).\n *\n * Rejects:\n * - Null bytes (security - prevents null byte injection attacks)\n * - Path traversal segments (..)\n * - Absolute paths (Unix and Windows, including UNC paths)\n */\nexport const safeRelativePathSchema = z\n\t.string()\n\t.refine((val) => !val.includes(\"\\0\"), \"Path cannot contain null bytes\")\n\t.refine((val) => !val.split(/[/\\\\]/).some((seg) => seg === \"..\"), \"Path cannot contain '..'\")\n\t.refine((val) => !isAbsolutePath(val), \"Path must be relative, not absolute\")\n",
46
- "/**\n * Path Helper Utilities\n *\n * Cross-platform path utilities for consistent behavior across\n * macOS, Linux, and Windows.\n */\n\nimport path from \"node:path\"\n\n/**\n * Cross-platform check for absolute paths.\n *\n * Uses both posix and win32 checks because path.isAbsolute() is platform-specific:\n * - On macOS/Linux: path.isAbsolute('\\\\\\\\server\\\\share') returns FALSE\n * - On Windows: returns TRUE\n *\n * By using path.win32.isAbsolute(), we can detect Windows paths on any platform.\n *\n * @see https://github.com/vitejs/vite (uses this pattern)\n */\nexport function isAbsolutePath(p: string): boolean {\n\treturn path.posix.isAbsolute(p) || path.win32.isAbsolute(p)\n}\n",
47
- "import { rename, symlink, unlink } from \"node:fs/promises\"\n\n/**\n * Atomically write data to a file using temp file + rename pattern.\n * Uses PID in temp filename for concurrent write safety.\n * File is created with 0o600 permissions.\n *\n * Based on CCS profile-registry.ts pattern.\n *\n * @param filePath - Target file path\n * @param data - Data to write (will be JSON stringified)\n */\nexport async function atomicWrite(filePath: string, data: unknown): Promise<void> {\n\tconst tempPath = `${filePath}.tmp.${process.pid}`\n\ttry {\n\t\tawait Bun.write(tempPath, JSON.stringify(data, null, \"\\t\"), { mode: 0o600 })\n\t\tawait rename(tempPath, filePath)\n\t} catch (error) {\n\t\t// Cleanup temp file on failure\n\t\ttry {\n\t\t\tawait unlink(tempPath)\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t\tthrow error\n\t}\n}\n\n/**\n * Atomically copy file bytes from source to target.\n * Uses temp file + rename pattern so readers never observe partial writes.\n * Target file is created with 0o600 permissions.\n *\n * @param sourcePath - Source file path\n * @param targetPath - Target file path\n */\nexport async function atomicCopy(sourcePath: string, targetPath: string): Promise<void> {\n\tconst tempPath = `${targetPath}.tmp.${process.pid}`\n\ttry {\n\t\tconst sourceFile = Bun.file(sourcePath)\n\t\tconst sourceBytes = await sourceFile.arrayBuffer()\n\t\tawait Bun.write(tempPath, sourceBytes, { mode: 0o600 })\n\t\tawait rename(tempPath, targetPath)\n\t} catch (error) {\n\t\t// Cleanup temp file on failure\n\t\ttry {\n\t\t\tawait unlink(tempPath)\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t\tthrow error\n\t}\n}\n\n/**\n * Atomically swap a symlink to point to a new target.\n * Uses temp symlink + rename pattern (POSIX atomic).\n *\n * @param target - New symlink target (relative or absolute path)\n * @param linkPath - Path where symlink should exist\n */\nexport async function atomicSymlink(target: string, linkPath: string): Promise<void> {\n\tconst tempLink = `${linkPath}.tmp.${process.pid}`\n\ttry {\n\t\tawait symlink(target, tempLink)\n\t\tawait rename(tempLink, linkPath)\n\t} catch (error) {\n\t\t// Cleanup temp symlink on failure\n\t\ttry {\n\t\t\tawait unlink(tempLink)\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t\tthrow error\n\t}\n}\n",
48
- "import { existsSync, statSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport path from \"node:path\"\n\n// =============================================================================\n// FILE NAME CONSTANTS\n// =============================================================================\n\n/** OCX configuration file name */\nexport const OCX_CONFIG_FILE = \"ocx.jsonc\"\n\n/** OpenCode configuration file name */\nexport const OPENCODE_CONFIG_FILE = \"opencode.jsonc\"\n\n/** Local config directory name */\nexport const LOCAL_CONFIG_DIR = \".opencode\"\n\n// =============================================================================\n// PROFILE PATH HELPERS\n// =============================================================================\n\n/**\n * Get the global profiles directory path.\n * Respects XDG_CONFIG_HOME if set.\n * @returns Absolute path to ~/.config/opencode/profiles/\n */\nexport function getProfilesDir(): string {\n\tconst base = process.env.XDG_CONFIG_HOME || path.join(homedir(), \".config\")\n\treturn path.join(base, \"opencode\", \"profiles\")\n}\n\n/**\n * Get the local profiles directory path (within project).\n * @param cwd - Working directory (defaults to process.cwd())\n * @returns Absolute path to .opencode/profiles/\n */\nexport function getLocalProfilesDir(cwd = process.cwd()): string {\n\tconst localConfigDir = findLocalConfigDir(cwd)\n\tif (localConfigDir) {\n\t\treturn path.join(localConfigDir, \"profiles\")\n\t}\n\treturn path.join(cwd, LOCAL_CONFIG_DIR, \"profiles\")\n}\n\n/**\n * Get a specific global profile's directory path.\n * @param name - Profile name\n * @returns Absolute path to the global profile directory\n */\nexport function getProfileDir(name: string): string {\n\treturn path.join(getProfilesDir(), name)\n}\n\n/**\n * Get a specific local profile's directory path.\n * Used only for detecting local profile presence (guard in getLayered).\n * @param name - Profile name\n * @param cwd - Working directory (defaults to process.cwd())\n * @returns Absolute path to the local profile directory\n */\nexport function getLocalProfileDir(name: string, cwd = process.cwd()): string {\n\treturn path.join(getLocalProfilesDir(cwd), name)\n}\n\n/**\n * Get the path to a profile's ocx.jsonc file.\n * @param name - Profile name\n * @returns Absolute path to ocx.jsonc\n */\nexport function getProfileOcxConfig(name: string): string {\n\treturn path.join(getProfileDir(name), \"ocx.jsonc\")\n}\n\n/**\n * Get the path to a profile's opencode.jsonc file.\n * @param name - Profile name\n * @returns Absolute path to opencode.jsonc\n */\nexport function getProfileOpencodeConfig(name: string): string {\n\treturn path.join(getProfileDir(name), \"opencode.jsonc\")\n}\n\n/**\n * Get the path to a profile's AGENTS.md file.\n * @param name - Profile name\n * @returns Absolute path to AGENTS.md\n */\nexport function getProfileAgents(name: string): string {\n\treturn path.join(getProfileDir(name), \"AGENTS.md\")\n}\n\n// =============================================================================\n// LOCAL CONFIG DISCOVERY\n// =============================================================================\n\n/**\n * Find the local config directory by walking up from cwd.\n * Stops at first .opencode/ directory or git root.\n * @param cwd - Starting directory\n * @returns Path to .opencode/ directory, or null if not found\n */\nexport function findLocalConfigDir(cwd: string): string | null {\n\tlet currentDir = cwd\n\n\twhile (true) {\n\t\t// Check for .opencode/ directory at this level\n\t\tconst configDir = path.join(currentDir, LOCAL_CONFIG_DIR)\n\t\tif (existsSync(configDir) && statSync(configDir).isDirectory()) {\n\t\t\treturn configDir\n\t\t}\n\n\t\t// Check if we've hit the git root (.git directory)\n\t\tconst gitDir = path.join(currentDir, \".git\")\n\t\tif (existsSync(gitDir)) {\n\t\t\t// At git root, stop searching\n\t\t\treturn null\n\t\t}\n\n\t\t// Move up one directory\n\t\tconst parentDir = path.dirname(currentDir)\n\t\tif (parentDir === currentDir) {\n\t\t\t// Reached filesystem root\n\t\t\treturn null\n\t\t}\n\t\tcurrentDir = parentDir\n\t}\n}\n\n// =============================================================================\n// GLOBAL CONFIG HELPERS\n// =============================================================================\n\n/**\n * Get the global base ocx.jsonc path.\n * @returns Path to ~/.config/opencode/ocx.jsonc\n */\nexport function getGlobalConfig(): string {\n\tconst base = process.env.XDG_CONFIG_HOME || path.join(homedir(), \".config\")\n\treturn path.join(base, \"opencode\", \"ocx.jsonc\")\n}\n",
49
- "import { z } from \"zod\"\nimport { profileOcxConfigSchema } from \"../schemas/ocx\"\n\n/**\n * Profile name validation schema.\n * - Must start with a letter\n * - Can contain alphanumeric, dots, underscores, hyphens\n * - 1-32 characters\n * Based on CCS variant-service.ts pattern.\n */\nexport const profileNameSchema = z\n\t.string()\n\t.min(1, \"Profile name is required\")\n\t.max(32, \"Profile name must be 32 characters or less\")\n\t.regex(\n\t\t/^[a-zA-Z][a-zA-Z0-9._-]*$/,\n\t\t\"Profile name must start with a letter and contain only alphanumeric characters, dots, underscores, or hyphens\",\n\t)\n\nexport type ProfileName = z.infer<typeof profileNameSchema>\n\n/**\n * Represents a loaded profile with all its data.\n */\nexport const profileSchema = z.object({\n\t/** Profile name (directory name) */\n\tname: profileNameSchema,\n\t/** OCX configuration from ocx.jsonc */\n\tocx: profileOcxConfigSchema,\n\t/** OpenCode configuration from opencode.jsonc (optional, passthrough) */\n\topencode: z.record(z.unknown()).optional(),\n\t/** Whether AGENTS.md exists in this profile */\n\thasAgents: z.boolean(),\n})\n\nexport type Profile = z.infer<typeof profileSchema>\n",
50
- "function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}export{e as t};\n//# sourceMappingURL=lazyDataLastImpl-DtF3cihj.js.map",
51
- "import{t as e}from\"./lazyDataLastImpl-DtF3cihj.js\";function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}export{t};\n//# sourceMappingURL=purry-GjwKKIlp.js.map",
52
- "function e(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}export{e as isPlainObject};\n//# sourceMappingURL=isPlainObject.js.map",
53
- "import{t as e}from\"./purry-GjwKKIlp.js\";import{isPlainObject as t}from\"./isPlainObject.js\";function n(...t){return e(r,t)}function r(e,n){let i={...e,...n};for(let a in n){if(!(a in e))continue;let{[a]:o}=e;if(!t(o))continue;let{[a]:s}=n;t(s)&&(i[a]=r(o,s))}return i}export{n as mergeDeep};\n//# sourceMappingURL=mergeDeep.js.map",
54
- "/**\n * OpenCode Config Merge Utilities\n *\n * Matches OpenCode's mergeConfigWithPlugins behavior (ref: anomalyco/opencode 05355a6b):\n * - Deep merge objects using remeda's mergeDeep\n * - Special-case only `plugin` and `instructions` arrays: concatenate + dedupe\n * - All other arrays follow mergeDeep default (source replaces target)\n *\n * Plugin dedupe uses canonical name (package name without version),\n * with later/higher-priority entries winning — matching OpenCode semantics.\n */\n\nimport { mergeDeep } from \"remeda\"\nimport type { NormalizedOpencodeConfig } from \"../schemas/registry\"\n\n/**\n * Extract canonical plugin name by stripping version suffix.\n *\n * Handles npm-style specifiers:\n * \"npm:@scope/pkg@1.0.0\" → \"npm:@scope/pkg\"\n * \"npm:pkg@1.0.0\" → \"npm:pkg\"\n * \"@scope/pkg@1.0.0\" → \"@scope/pkg\"\n * \"pkg@1.0.0\" → \"pkg\"\n * \"pkg\" → \"pkg\"\n *\n * The version delimiter is the LAST \"@\" that is not at position 0\n * and not immediately after \"npm:\" (scoped package prefix).\n */\nexport function extractCanonicalPluginName(specifier: string): string {\n\t// Strip npm: prefix for parsing, re-add later\n\tconst hasNpmPrefix = specifier.startsWith(\"npm:\")\n\tconst remainder = hasNpmPrefix ? specifier.slice(4) : specifier\n\n\tif (!remainder) return specifier\n\n\t// Scoped package: @scope/pkg[@version]\n\tif (remainder.startsWith(\"@\")) {\n\t\tconst slashIndex = remainder.indexOf(\"/\")\n\t\tif (slashIndex === -1) return specifier // malformed, return as-is\n\n\t\t// Find @ after the slash (version delimiter)\n\t\tconst afterSlash = remainder.slice(slashIndex + 1)\n\t\tconst versionAt = afterSlash.indexOf(\"@\")\n\t\tif (versionAt === -1) return specifier // no version\n\n\t\tconst canonicalRemainder = remainder.slice(0, slashIndex + 1 + versionAt)\n\t\treturn hasNpmPrefix ? `npm:${canonicalRemainder}` : canonicalRemainder\n\t}\n\n\t// Unscoped package: pkg[@version]\n\tconst atIndex = remainder.indexOf(\"@\")\n\tif (atIndex === -1) return specifier // no version\n\n\tconst canonicalRemainder = remainder.slice(0, atIndex)\n\treturn hasNpmPrefix ? `npm:${canonicalRemainder}` : canonicalRemainder\n}\n\n/**\n * Deduplicate plugin entries by canonical name, last-wins.\n *\n * When two entries share the same canonical name (e.g., \"npm:pkg@1.0\" and \"npm:pkg@2.0\"),\n * the later entry wins (higher-priority source overwrites lower-priority target).\n * This matches OpenCode's mergeConfigWithPlugins semantics.\n */\nexport function dedupePluginsByCanonicalName(plugins: string[]): string[] {\n\t// Walk backwards: first seen (from end) wins\n\tconst seen = new Map<string, number>()\n\tfor (let i = plugins.length - 1; i >= 0; i--) {\n\t\tconst plugin = plugins[i] as string\n\t\tconst canonical = extractCanonicalPluginName(plugin)\n\t\tif (!seen.has(canonical)) {\n\t\t\tseen.set(canonical, i)\n\t\t}\n\t}\n\n\t// Collect in original order, keeping only the last occurrence per canonical name\n\tconst result: string[] = []\n\tfor (const [i, plugin] of plugins.entries()) {\n\t\tconst canonical = extractCanonicalPluginName(plugin)\n\t\tif (seen.get(canonical) === i) {\n\t\t\tresult.push(plugin)\n\t\t}\n\t}\n\n\treturn result\n}\n\n/**\n * Merge two OpenCode config objects with special array handling.\n *\n * INTERNAL UTILITY - expects pre-validated configs.\n * Validation happens at boundaries (config loading, build step), not here.\n * See: Law 2 (Parse, Don't Validate) - parse at boundary, trust inside.\n *\n * Special-cased arrays (concatenate + dedupe):\n * - `plugin`: concatenated, deduped by canonical plugin name (last wins)\n * - `instructions`: concatenated, deduped by exact string (last wins)\n *\n * All other arrays follow mergeDeep default behavior (source replaces target).\n * This matches OpenCode's internal mergeConfigWithPlugins behavior.\n *\n * @param target - Base config (accumulated so far, pre-validated)\n * @param source - New config to merge in (pre-validated)\n * @returns Merged config with concatenated special arrays\n *\n * @example\n * ```typescript\n * const merged = mergeOpencodeConfig(\n * { plugin: [\"npm:a@1.0\"], mcp: { server1: {...} } },\n * { plugin: [\"npm:a@2.0\", \"npm:b\"], agent: { agent1: {...} } }\n * )\n * // Result: { plugin: [\"npm:a@2.0\", \"npm:b\"], mcp: {...}, agent: {...} }\n * ```\n */\nexport function mergeOpencodeConfig(\n\ttarget: NormalizedOpencodeConfig,\n\tsource: NormalizedOpencodeConfig,\n): NormalizedOpencodeConfig {\n\tconst merged = mergeDeep(target, source) as NormalizedOpencodeConfig\n\n\t// Special-case: Concatenate and deduplicate plugin arrays by canonical name\n\tif (Array.isArray(target.plugin) && Array.isArray(source.plugin)) {\n\t\tmerged.plugin = dedupePluginsByCanonicalName([...target.plugin, ...source.plugin])\n\t} else if (Array.isArray(target.plugin)) {\n\t\tmerged.plugin = target.plugin\n\t} else if (Array.isArray(source.plugin)) {\n\t\tmerged.plugin = source.plugin\n\t}\n\n\t// Special-case: Concatenate and deduplicate instructions arrays (exact string match)\n\tif (Array.isArray(target.instructions) && Array.isArray(source.instructions)) {\n\t\tmerged.instructions = Array.from(new Set([...target.instructions, ...source.instructions]))\n\t} else if (Array.isArray(target.instructions)) {\n\t\tmerged.instructions = target.instructions\n\t} else if (Array.isArray(source.instructions)) {\n\t\tmerged.instructions = source.instructions\n\t}\n\n\treturn merged\n}\n",
55
- "/**\n * Git Repository Root Resolution\n *\n * Provides reliable git root detection with worktree support.\n * Follows the 5 Laws of Elegant Defense:\n * - Law 1: Early exits for non-git directories\n * - Law 2: Parsed git output becomes trusted paths\n * - Law 3: Pure functions with no side effects\n * - Law 4: Fails fast with descriptive errors\n * - Law 5: Intentional naming for clarity\n */\n\nimport { existsSync, readFileSync } from \"node:fs\"\nimport { dirname, isAbsolute, resolve } from \"node:path\"\n\n/**\n * Resolves the git repository root for the given directory.\n * Supports both regular repos and worktrees.\n *\n * Resolution strategy:\n * 1. Try `git rev-parse --show-toplevel` (handles all cases)\n * 2. Fallback to .git file parsing (worktree without git binary)\n * 3. Fallback to .git directory detection\n * 4. Return cwd if not in a git repo\n *\n * @param cwd - Directory to resolve from\n * @returns Absolute path to git root, or cwd if not in git repo\n */\nexport async function resolveGitRoot(cwd: string): Promise<string> {\n\t// Strategy 1: Use git command (most reliable, handles all cases)\n\ttry {\n\t\tconst proc = Bun.spawn([\"git\", \"rev-parse\", \"--show-toplevel\"], {\n\t\t\tcwd,\n\t\t\tstdout: \"pipe\",\n\t\t\tstderr: \"pipe\",\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tGIT_DIR: undefined,\n\t\t\t\tGIT_WORK_TREE: undefined,\n\t\t\t},\n\t\t})\n\n\t\tconst exitCode = await proc.exited\n\n\t\tif (exitCode === 0) {\n\t\t\tconst output = await new Response(proc.stdout).text()\n\t\t\tconst gitRoot = output.trim()\n\t\t\tif (gitRoot && isAbsolute(gitRoot)) {\n\t\t\t\treturn gitRoot\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Git command failed, try fallbacks\n\t}\n\n\t// Strategy 2: Parse .git file (worktree without git binary)\n\tconst gitRoot = findGitRootSync(cwd)\n\tif (gitRoot) {\n\t\treturn gitRoot\n\t}\n\n\t// Strategy 3: Not in a git repo, return cwd\n\treturn cwd\n}\n\n/**\n * Synchronous git root detection using filesystem traversal.\n * Handles .git directories and .git files (worktrees).\n *\n * @param startDir - Directory to start searching from\n * @returns Absolute path to git root, or null if not found\n */\nfunction findGitRootSync(startDir: string): string | null {\n\t// Normalize startDir to absolute at entry (Law 2: Parse, Don't Validate)\n\tlet currentDir = resolve(startDir)\n\n\twhile (true) {\n\t\tconst gitPath = resolve(currentDir, \".git\")\n\n\t\tif (existsSync(gitPath)) {\n\t\t\ttry {\n\t\t\t\tconst stats = require(\"node:fs\").statSync(gitPath)\n\n\t\t\t\t// Case 1: .git is a directory (regular repo)\n\t\t\t\tif (stats.isDirectory()) {\n\t\t\t\t\treturn currentDir\n\t\t\t\t}\n\n\t\t\t\t// Case 2: .git is a file (worktree)\n\t\t\t\tif (stats.isFile()) {\n\t\t\t\t\tconst gitFileContent = readFileSync(gitPath, \"utf8\")\n\t\t\t\t\tconst match = gitFileContent.match(/^gitdir:\\s*(.+)$/m)\n\n\t\t\t\t\tif (match?.[1]) {\n\t\t\t\t\t\t// gitdir points to .git/worktrees/<name>\n\t\t\t\t\t\t// We need to traverse up to find the actual worktree root\n\t\t\t\t\t\t// The .git file is already at the worktree root\n\t\t\t\t\t\treturn currentDir\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Permission denied or other error - continue traversing\n\t\t\t}\n\t\t}\n\n\t\t// Move up one directory\n\t\tconst parentDir = dirname(currentDir)\n\t\tif (parentDir === currentDir) {\n\t\t\t// Reached filesystem root\n\t\t\treturn null\n\t\t}\n\t\tcurrentDir = parentDir\n\t}\n}\n\n/**\n * Synchronous version of resolveGitRoot for use in non-async contexts.\n * Uses only filesystem traversal (no git command).\n *\n * @param cwd - Directory to resolve from\n * @returns Absolute path to git root, or cwd if not in git repo\n */\nexport function resolveGitRootSync(cwd: string): string {\n\t// Normalize cwd to absolute at entry (Law 2: Parse, Don't Validate)\n\tconst absoluteCwd = resolve(cwd)\n\t// Ensure fallback is also absolute\n\treturn findGitRootSync(absoluteCwd) ?? absoluteCwd\n}\n",
56
- "/**\n * Instruction Path Resolution Utilities\n *\n * Handles validation and resolution of registry-provided instruction paths.\n * Registry instruction paths are install-root-relative and resolved to absolute\n * paths at runtime before launching OpenCode.\n *\n * Follows the 5 Laws of Elegant Defense:\n * - Law 1 (Early Exit): Guard clauses validate paths upfront\n * - Law 2 (Parse Don't Validate): Paths validated at boundary, trusted internally\n * - Law 4 (Fail Fast): Invalid paths throw descriptive errors immediately\n * - Law 5 (Intentional Naming): Functions named to describe exact behavior\n */\n\nimport { existsSync } from \"node:fs\"\nimport * as path from \"node:path\"\nimport { Glob } from \"bun\"\nimport { ValidationError } from \"./errors\"\n\n/**\n * Check if a path is a URL (http/https).\n * URLs are allowed and passed through without resolution.\n */\nexport function isUrl(path: string): boolean {\n\treturn path.startsWith(\"http://\") || path.startsWith(\"https://\")\n}\n\n/**\n * Validate a registry instruction path.\n * Registry paths must be:\n * - Relative (not absolute)\n * - No parent directory traversal (..)\n * - URLs (http/https) are allowed\n *\n * @param rawPath - The path to validate\n * @param source - Source description for error messages (e.g., \"registry component kdco/foo\")\n * @throws ValidationError if path is invalid\n */\nexport function validateRegistryInstructionPath(rawPath: string, source: string): void {\n\t// Early exit: URLs are always valid\n\tif (isUrl(rawPath)) {\n\t\treturn\n\t}\n\n\t// Fail fast: No absolute paths in registry instructions (check both POSIX and Windows)\n\tif (path.isAbsolute(rawPath) || path.win32.isAbsolute(rawPath)) {\n\t\tthrow new ValidationError(\n\t\t\t`Absolute path not allowed in registry instructions: \"${rawPath}\" (from ${source})`,\n\t\t)\n\t}\n\n\t// Fail fast: No home directory paths\n\tif (rawPath.startsWith(\"~\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Home directory path not allowed in registry instructions: \"${rawPath}\" (from ${source})`,\n\t\t)\n\t}\n\n\t// Fail fast: No parent directory traversal\n\t// Check BEFORE normalization by splitting on both / and \\\n\tconst segments = rawPath.split(/[/\\\\]/)\n\tif (segments.some((segment) => segment === \"..\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Path traversal (..) not allowed in registry instructions: \"${rawPath}\" (from ${source})`,\n\t\t)\n\t}\n}\n\n/**\n * Resolve a single registry instruction path to absolute.\n * - URLs are passed through unchanged\n * - Glob patterns are expanded and resolved\n * - Simple paths are resolved relative to install root\n *\n * @param instructionPath - The install-root-relative path or URL\n * @param installRoot - The install root directory (absolute)\n * @param source - Source description for error messages\n * @returns Array of absolute paths (multiple if glob expands)\n * @throws ValidationError if path is invalid or doesn't exist\n */\nexport function resolveRegistryInstructionPath(\n\tinstructionPath: string,\n\tinstallRoot: string,\n\tsource: string,\n): string[] {\n\t// Early exit: URLs pass through unchanged\n\tif (isUrl(instructionPath)) {\n\t\treturn [instructionPath]\n\t}\n\n\t// Validate path at boundary (Law 2: Parse Don't Validate)\n\tvalidateRegistryInstructionPath(instructionPath, source)\n\n\t// Check if path contains glob patterns\n\tconst hasGlobPattern =\n\t\tinstructionPath.includes(\"*\") || instructionPath.includes(\"?\") || instructionPath.includes(\"[\")\n\n\tif (hasGlobPattern) {\n\t\t// Expand glob relative to install root\n\t\tconst glob = new Glob(instructionPath)\n\t\tconst matches: string[] = []\n\n\t\t// Scan install root for matches\n\t\tfor (const entry of glob.scanSync(installRoot)) {\n\t\t\tconst absolutePath = path.join(installRoot, entry)\n\t\t\tmatches.push(absolutePath)\n\t\t}\n\n\t\treturn matches // May be empty - caller can decide if that's an error\n\t}\n\n\t// Simple path - resolve to absolute\n\tconst absolutePath = path.join(installRoot, instructionPath)\n\n\t// Fail fast: Path must exist (Law 4: Fail Fast, Fail Loud)\n\tif (!existsSync(absolutePath)) {\n\t\tthrow new ValidationError(\n\t\t\t`Registry instruction file not found: \"${instructionPath}\" (from ${source})\\n` +\n\t\t\t\t`Expected at: ${absolutePath}`,\n\t\t)\n\t}\n\n\treturn [absolutePath]\n}\n\n/**\n * Resolve all registry instruction paths to absolute paths.\n * - Validates each path\n * - Expands globs\n * - Deduplicates results\n * - Preserves order (first occurrence wins)\n *\n * @param paths - Array of install-root-relative paths or URLs\n * @param installRoot - The install root directory (absolute)\n * @param source - Source description for error messages\n * @returns Deduplicated array of absolute paths\n * @throws ValidationError if any path is invalid or doesn't exist\n */\nexport function resolveRegistryInstructionPaths(\n\tpaths: string[],\n\tinstallRoot: string,\n\tsource: string,\n): string[] {\n\tconst resolved: string[] = []\n\tconst seen = new Set<string>()\n\n\tfor (const instructionPath of paths) {\n\t\tconst expandedPaths = resolveRegistryInstructionPath(instructionPath, installRoot, source)\n\n\t\tfor (const absolutePath of expandedPaths) {\n\t\t\t// Deduplicate - first occurrence wins\n\t\t\tif (!seen.has(absolutePath)) {\n\t\t\t\tseen.add(absolutePath)\n\t\t\t\tresolved.push(absolutePath)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resolved\n}\n",
57
- "/**\n * Dependency Resolver with topological sort\n * Based on: https://github.com/shadcn-ui/ui/blob/main/packages/shadcn/src/registry/resolver.ts\n */\n\nimport type { RegistryConfig } from \"../schemas/config\"\nimport {\n\ttype ComponentManifest,\n\tcreateQualifiedComponent,\n\ttype NormalizedComponentManifest,\n\ttype NormalizedOpencodeConfig,\n\tnormalizeComponentManifest,\n\ttype OpencodeConfig,\n\tparseQualifiedComponent,\n} from \"../schemas/registry\"\nimport { NetworkError, NotFoundError, OCXError, ValidationError } from \"../utils/errors\"\nimport { fetchComponent } from \"./fetcher\"\nimport { mergeOpencodeConfig } from \"./merge\"\n\n/**\n * Parse a component reference into registry alias and component name.\n * - \"kdco/researcher\" -> { namespace: \"kdco\", component: \"researcher\" }\n * - \"researcher\" (with defaultNamespace) -> { namespace: defaultNamespace, component: \"researcher\" }\n * - \"researcher\" (without defaultNamespace) -> throws error\n *\n * Note: The `namespace` field is the user-chosen registry alias, NOT a\n * registry-declared namespace. Component refs use `<alias>/<component>`.\n */\nexport function parseComponentRef(\n\tref: string,\n\tdefaultNamespace?: string,\n): { namespace: string; component: string } {\n\t// Check if it's a qualified reference (contains /)\n\tif (ref.includes(\"/\")) {\n\t\treturn parseQualifiedComponent(ref)\n\t}\n\n\t// Bare name - use default alias if provided\n\tif (defaultNamespace) {\n\t\treturn { namespace: defaultNamespace, component: ref }\n\t}\n\n\tthrow new ValidationError(\n\t\t`Component '${ref}' must include a registry alias (e.g., 'kdco/${ref}')`,\n\t)\n}\n\nexport interface ResolvedComponent extends NormalizedComponentManifest {\n\t/** The registry name from ocx.jsonc (configured alias) */\n\tregistryName: string\n\tbaseUrl: string\n\t/** Qualified name (registryName/component) */\n\tqualifiedName: string\n}\n\nexport interface ResolvedDependencies {\n\t/** All components in dependency order (dependencies first) */\n\tcomponents: ResolvedComponent[]\n\t/** Install order (component names) */\n\tinstallOrder: string[]\n\t/** Aggregated npm dependencies from all components */\n\tnpmDependencies: string[]\n\t/** Aggregated npm dev dependencies from all components */\n\tnpmDevDependencies: string[]\n\t/** Merged opencode configuration from all components (deep merged) */\n\topencode: OpencodeConfig\n}\n\n/**\n * Resolve all dependencies for a set of components across multiple registries\n * Returns components in topological order (dependencies first)\n */\nexport async function resolveDependencies(\n\tregistries: Record<string, RegistryConfig>,\n\tcomponentNames: string[],\n): Promise<ResolvedDependencies> {\n\tconst resolved = new Map<string, ResolvedComponent>()\n\tconst visiting = new Set<string>()\n\tconst npmDeps = new Set<string>()\n\tconst npmDevDeps = new Set<string>()\n\tlet opencode: NormalizedOpencodeConfig = {}\n\n\tasync function resolve(\n\t\tcomponentNamespace: string,\n\t\tcomponentName: string,\n\t\tpath: string[] = [],\n\t): Promise<void> {\n\t\tconst qualifiedName = createQualifiedComponent(componentNamespace, componentName)\n\n\t\t// Already resolved\n\t\tif (resolved.has(qualifiedName)) {\n\t\t\treturn\n\t\t}\n\n\t\t// Cycle detection\n\t\tif (visiting.has(qualifiedName)) {\n\t\t\tconst cycle = [...path, qualifiedName].join(\" → \")\n\t\t\tthrow new ValidationError(`Circular dependency detected: ${cycle}`)\n\t\t}\n\n\t\tvisiting.add(qualifiedName)\n\n\t\t// Look up the registry for this alias\n\t\tconst regConfig = registries[componentNamespace]\n\t\tif (!regConfig) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\t`Registry alias '${componentNamespace}' not found. Add it with 'ocx registry add <url> --name ${componentNamespace}'.`,\n\t\t\t)\n\t\t}\n\n\t\t// Fetch component from the specific registry\n\t\tlet component: ComponentManifest\n\t\ttry {\n\t\t\tcomponent = await fetchComponent(regConfig.url, componentName)\n\t\t} catch (err) {\n\t\t\t// Re-throw network errors as-is (preserves exit code 69)\n\t\t\tif (err instanceof NetworkError) {\n\t\t\t\tthrow err\n\t\t\t}\n\t\t\t// Convert NotFoundError to friendly message\n\t\t\tif (err instanceof NotFoundError) {\n\t\t\t\tthrow new NotFoundError(\n\t\t\t\t\t`Component '${componentName}' not found in registry '${componentNamespace}'.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\t// Re-throw other OCXError subclasses as-is\n\t\t\tif (err instanceof OCXError) {\n\t\t\t\tthrow err\n\t\t\t}\n\t\t\t// Wrap unknown errors as NetworkError (likely connectivity issue)\n\t\t\tthrow new NetworkError(\n\t\t\t\t`Failed to fetch component '${componentName}' from registry '${componentNamespace}': ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\t{ url: regConfig.url },\n\t\t\t)\n\t\t}\n\n\t\t// Resolve dependencies first (depth-first)\n\t\tfor (const dep of component.dependencies) {\n\t\t\t// Parse dependency: bare name = same registry alias, \"foo/bar\" = cross-registry\n\t\t\tconst depRef = parseComponentRef(dep, componentNamespace)\n\t\t\tawait resolve(depRef.namespace, depRef.component, [...path, qualifiedName])\n\t\t}\n\n\t\t// Normalize the component (expand Cargo-style shorthands)\n\t\tconst normalizedComponent = normalizeComponentManifest(component)\n\n\t\t// Add to resolved (dependencies are already added)\n\t\tresolved.set(qualifiedName, {\n\t\t\t...normalizedComponent,\n\t\t\tregistryName: componentNamespace,\n\t\t\tbaseUrl: regConfig.url,\n\t\t\tqualifiedName,\n\t\t})\n\t\tvisiting.delete(qualifiedName)\n\n\t\t// Collect npm dependencies\n\t\tif (component.npmDependencies) {\n\t\t\tfor (const dep of component.npmDependencies) {\n\t\t\t\tnpmDeps.add(dep)\n\t\t\t}\n\t\t}\n\t\tif (component.npmDevDependencies) {\n\t\t\tfor (const dep of component.npmDevDependencies) {\n\t\t\t\tnpmDevDeps.add(dep)\n\t\t\t}\n\t\t}\n\n\t\t// Deep merge opencode config (component takes precedence - ShadCN style)\n\t\t// Use normalizedComponent to ensure MCP servers are converted from string URLs to full objects\n\t\tif (normalizedComponent.opencode) {\n\t\t\topencode = mergeOpencodeConfig(\n\t\t\t\topencode,\n\t\t\t\tnormalizedComponent.opencode as NormalizedOpencodeConfig,\n\t\t\t)\n\t\t}\n\t}\n\n\t// Resolve all requested components\n\tfor (const name of componentNames) {\n\t\t// Parse qualified component name (must include registry alias)\n\t\tconst ref = parseComponentRef(name)\n\t\tawait resolve(ref.namespace, ref.component)\n\t}\n\n\t// Convert to array (already in topological order due to depth-first)\n\tconst components = Array.from(resolved.values())\n\tconst installOrder = Array.from(resolved.keys())\n\n\treturn {\n\t\tcomponents,\n\t\tinstallOrder,\n\t\tnpmDependencies: Array.from(npmDeps),\n\t\tnpmDevDependencies: Array.from(npmDevDeps),\n\t\topencode,\n\t}\n}\n",
58
- "/**\n * OpenCode Config Updater\n *\n * ShadCN-style updater for opencode.json configuration.\n * Component takes precedence - just deep merge, user uses git to review/revert.\n *\n * Key features:\n * - Preserves JSONC comments using jsonc-parser's modify/applyEdits\n * - Direct passthrough of component's opencode block\n * - No \"smart\" merging - component wins, git is your safety net\n */\n\nimport { existsSync } from \"node:fs\"\nimport { mkdir } from \"node:fs/promises\"\nimport { homedir } from \"node:os\"\nimport path from \"node:path\"\nimport { applyEdits, type ModificationOptions, modify, parse as parseJsonc } from \"jsonc-parser\"\nimport type { OpencodeConfig } from \"../schemas/registry\"\nimport { isPlainObject } from \"../utils/type-guards\"\n\nconst LOCAL_CONFIG_DIR = \".opencode\"\n\n/**\n * Check if cwd is inside the global config directory (or is the directory itself).\n * When true, configs should be at the root (flattened), not in .opencode/\n *\n * This handles:\n * - ~/.config/opencode/ itself\n * - ~/.config/opencode/profiles/<name>/ (profile directories)\n * - Any other subdirectory under ~/.config/opencode/\n */\nfunction isGlobalConfigPath(cwd: string): boolean {\n\tconst base = process.env.XDG_CONFIG_HOME || path.join(homedir(), \".config\")\n\tconst globalConfigDir = path.resolve(base, \"opencode\")\n\tconst resolvedCwd = path.resolve(cwd)\n\n\t// Check if cwd is the global dir itself, or a subdirectory of it\n\tif (resolvedCwd === globalConfigDir) {\n\t\treturn true\n\t}\n\n\tconst relative = path.relative(globalConfigDir, resolvedCwd)\n\t// Inside if: relative path doesn't start with \"..\" and isn't absolute\n\treturn relative !== \"\" && !relative.startsWith(\"..\") && !path.isAbsolute(relative)\n}\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/**\n * The structure of opencode.json file.\n * Mirrors OpencodeConfig from registry.ts exactly.\n */\nexport interface OpencodeJsonConfig {\n\t$schema?: string\n\tmcp?: Record<string, unknown>\n\ttools?: Record<string, boolean>\n\tagent?: Record<string, unknown>\n\tplugin?: string[]\n\tinstructions?: string[]\n\tpermission?: unknown\n\t[key: string]: unknown\n}\n\nexport interface UpdateOpencodeJsonConfigResult {\n\t/** Path to the config file */\n\tpath: string\n\t/** Whether the file was created (vs updated) */\n\tcreated: boolean\n\t/** Whether any changes were made */\n\tchanged: boolean\n}\n\n// =============================================================================\n// JSONC MODIFICATION OPTIONS\n// =============================================================================\n\nconst JSONC_OPTIONS: ModificationOptions = {\n\tformattingOptions: {\n\t\ttabSize: 2,\n\t\tinsertSpaces: false,\n\t\teol: \"\\n\",\n\t},\n}\n\n// =============================================================================\n// FILE OPERATIONS\n// =============================================================================\n\n// Minimal template for new opencode.jsonc files\nconst OPENCODE_CONFIG_TEMPLATE = `{\n\t\"$schema\": \"https://opencode.ai/config.json\"\n\t// Add MCP servers, tools, plugins here\n}\n`\n\n/**\n * Find opencode config file path.\n * For global config paths (inside ~/.config/opencode/), configs live at root.\n * For local projects, checks .opencode/ first, then root. Defaults to .opencode/\n * @returns Object with path and whether it exists\n */\nexport function findOpencodeConfig(cwd: string): { path: string; exists: boolean } {\n\t// Global config paths use flattened structure (no .opencode/ subdirectory)\n\tif (isGlobalConfigPath(cwd)) {\n\t\tconst rootJsonc = path.join(cwd, \"opencode.jsonc\")\n\t\tconst rootJson = path.join(cwd, \"opencode.json\")\n\n\t\tif (existsSync(rootJsonc)) {\n\t\t\treturn { path: rootJsonc, exists: true }\n\t\t}\n\t\tif (existsSync(rootJson)) {\n\t\t\treturn { path: rootJson, exists: true }\n\t\t}\n\n\t\t// Default to root for global paths\n\t\treturn { path: rootJsonc, exists: false }\n\t}\n\n\t// Local projects: check .opencode/ first (preferred location)\n\tconst dotOpencodeJsonc = path.join(cwd, LOCAL_CONFIG_DIR, \"opencode.jsonc\")\n\tconst dotOpencodeJson = path.join(cwd, LOCAL_CONFIG_DIR, \"opencode.json\")\n\n\tif (existsSync(dotOpencodeJsonc)) {\n\t\treturn { path: dotOpencodeJsonc, exists: true }\n\t}\n\tif (existsSync(dotOpencodeJson)) {\n\t\treturn { path: dotOpencodeJson, exists: true }\n\t}\n\n\t// Check root (legacy location)\n\tconst rootJsonc = path.join(cwd, \"opencode.jsonc\")\n\tconst rootJson = path.join(cwd, \"opencode.json\")\n\n\tif (existsSync(rootJsonc)) {\n\t\treturn { path: rootJsonc, exists: true }\n\t}\n\tif (existsSync(rootJson)) {\n\t\treturn { path: rootJson, exists: true }\n\t}\n\n\t// Neither exists - default to .opencode/ for new files\n\treturn { path: dotOpencodeJsonc, exists: false }\n}\n\n/**\n * Ensure opencode.jsonc exists, creating a minimal template if not.\n * This is an upsert operation - does nothing if file already exists.\n * @param cwd - Directory to create the config in\n * @returns Object with path and whether it was created\n */\nexport async function ensureOpencodeConfig(\n\tcwd: string,\n): Promise<{ path: string; created: boolean }> {\n\tconst { path: configPath, exists } = findOpencodeConfig(cwd)\n\n\t// Early exit: config already exists\n\tif (exists) {\n\t\treturn { path: configPath, created: false }\n\t}\n\n\t// Ensure directory exists\n\tawait mkdir(path.dirname(configPath), { recursive: true })\n\n\t// Create minimal template\n\tawait Bun.write(configPath, OPENCODE_CONFIG_TEMPLATE)\n\treturn { path: configPath, created: true }\n}\n\n/**\n * Read opencode.json or opencode.jsonc from a directory\n * Returns both parsed config and raw content (for comment preservation)\n */\nexport async function readOpencodeJsonConfig(cwd: string): Promise<{\n\tconfig: OpencodeJsonConfig\n\tcontent: string\n\tpath: string\n} | null> {\n\tconst { path: configPath, exists } = findOpencodeConfig(cwd)\n\n\tif (!exists) {\n\t\treturn null\n\t}\n\n\tconst file = Bun.file(configPath)\n\tconst content = await file.text()\n\treturn {\n\t\tconfig: parseJsonc(content, [], { allowTrailingComma: true }) as OpencodeJsonConfig,\n\t\tcontent,\n\t\tpath: configPath,\n\t}\n}\n\n/**\n * Write config content to file\n */\nasync function writeOpencodeJsonConfig(path: string, content: string): Promise<void> {\n\tawait Bun.write(path, content)\n}\n\n// =============================================================================\n// DEEP MERGE HELPER\n// =============================================================================\n\n/**\n * Get the value at a JSON path from content\n */\nfunction getValueAtPath(content: string, path: (string | number)[]): unknown {\n\tconst parsed = parseJsonc(content, [], { allowTrailingComma: true })\n\tlet current: unknown = parsed\n\tfor (const segment of path) {\n\t\tif (current === null || current === undefined) return undefined\n\t\tif (typeof current !== \"object\") return undefined\n\t\tcurrent = (current as Record<string | number, unknown>)[segment]\n\t}\n\treturn current\n}\n\n/**\n * Apply a value at a JSON path using jsonc-parser (preserves comments).\n * Recursively handles objects and arrays.\n */\nfunction applyValueAtPath(content: string, path: (string | number)[], value: unknown): string {\n\tif (value === null || value === undefined) {\n\t\treturn content\n\t}\n\n\t// For objects, check if we can recursively merge or need to replace entirely\n\tif (isPlainObject(value)) {\n\t\tconst existingValue = getValueAtPath(content, path)\n\n\t\t// If existing value is a primitive (string, number, boolean) but new value is an object,\n\t\t// we must replace the entire value - can't add properties to a primitive\n\t\tif (\n\t\t\texistingValue !== undefined &&\n\t\t\t(existingValue === null || typeof existingValue !== \"object\")\n\t\t) {\n\t\t\tconst edits = modify(content, path, value, JSONC_OPTIONS)\n\t\t\treturn applyEdits(content, edits)\n\t\t}\n\n\t\t// Safe to recursively apply each key\n\t\tlet updatedContent = content\n\t\tfor (const [key, val] of Object.entries(value as Record<string, unknown>)) {\n\t\t\tupdatedContent = applyValueAtPath(updatedContent, [...path, key], val)\n\t\t}\n\t\treturn updatedContent\n\t}\n\n\t// For arrays, set the entire array (component wins)\n\tif (Array.isArray(value)) {\n\t\tconst edits = modify(content, path, value, JSONC_OPTIONS)\n\t\treturn applyEdits(content, edits)\n\t}\n\n\t// For primitives, set directly\n\tconst edits = modify(content, path, value, JSONC_OPTIONS)\n\treturn applyEdits(content, edits)\n}\n\n// =============================================================================\n// MAIN UPDATER\n// =============================================================================\n\n/**\n * Update opencode.json with component's opencode configuration.\n *\n * ShadCN-style: Component takes precedence.\n * - Deep merges the component's opencode block into existing config\n * - Component values win on conflicts\n * - User uses git to review/revert changes\n */\nexport async function updateOpencodeJsonConfig(\n\tcwd: string,\n\topencode: OpencodeConfig,\n): Promise<UpdateOpencodeJsonConfigResult> {\n\tconst existing = await readOpencodeJsonConfig(cwd)\n\n\tlet content: string\n\tlet configPath: string\n\tlet created = false\n\n\tif (existing) {\n\t\tcontent = existing.content\n\t\tconfigPath = existing.path\n\t} else {\n\t\t// Create new config with schema\n\t\tconst config: OpencodeJsonConfig = { $schema: \"https://opencode.ai/config.json\" }\n\t\tcontent = JSON.stringify(config, null, \"\\t\")\n\t\t// Global paths use root, local paths use .opencode/\n\t\tconfigPath = isGlobalConfigPath(cwd)\n\t\t\t? path.join(cwd, \"opencode.jsonc\")\n\t\t\t: path.join(cwd, LOCAL_CONFIG_DIR, \"opencode.jsonc\")\n\t\t// Ensure directory exists for new files\n\t\tawait mkdir(path.dirname(configPath), { recursive: true })\n\t\tcreated = true\n\t}\n\n\tconst originalContent = content\n\n\t// Deep merge each field from the component's opencode block\n\tcontent = applyValueAtPath(content, [], opencode)\n\n\tconst changed = content !== originalContent\n\n\t// Only write if there were changes\n\tif (changed) {\n\t\tawait writeOpencodeJsonConfig(configPath, content)\n\t}\n\n\treturn {\n\t\tpath: configPath,\n\t\tcreated,\n\t\tchanged,\n\t}\n}\n",
59
- "/**\n * Content comparison utilities for file overwrite detection.\n */\n\n/**\n * Normalize content for comparison by standardizing line endings and trimming.\n */\nfunction normalizeContent(content: string): string {\n\treturn content.replace(/\\r\\n/g, \"\\n\").trim()\n}\n\n/**\n * Compare file content, normalizing line endings.\n * Returns true if content is identical after normalization.\n */\nexport function isContentIdentical(existing: string, incoming: string): boolean {\n\treturn normalizeContent(existing) === normalizeContent(incoming)\n}\n",
60
- "/**\n * Dependency invalidation utilities for OCX CLI.\n *\n * When `ocx add` writes dependencies into package.json, upstream OpenCode\n * may skip `npm install` if `@opencode-ai/plugin` already matches. This\n * causes missing deps at runtime.\n *\n * Mitigation: after dependency declarations change, invalidate the adjacent\n * `node_modules` directory so the next OpenCode launch triggers a fresh install.\n */\n\nimport { existsSync, lstatSync } from \"node:fs\"\nimport { rm, unlink } from \"node:fs/promises\"\nimport { join } from \"node:path\"\n\nimport type { DryRunAction } from \"./dry-run\"\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface DependencyDeltaEntry {\n\tname: string\n\tfrom: string | null\n\tto: string\n}\n\nexport interface DependencyDelta {\n\tchanged: boolean\n\tentries: DependencyDeltaEntry[]\n}\n\nexport interface DepUpdateResult {\n\tchanged: boolean\n\tpackageDir: string\n\tdelta: DependencyDeltaEntry[]\n}\n\nexport type InvalidationAction = \"removed\" | \"unlinked\" | \"none\" | \"failed\"\n\nexport interface InvalidationResult {\n\tsuccess: boolean\n\taction: InvalidationAction\n\terror?: { code: string; message: string }\n}\n\n/** Injection point for testing: allows overriding the rm implementation. */\nexport interface InvalidationOptions {\n\trmImpl?: (path: string, opts?: { recursive?: boolean; force?: boolean }) => Promise<void>\n}\n\n// =============================================================================\n// Retryable error codes\n// =============================================================================\n\nconst RETRYABLE_CODES = new Set([\"EBUSY\", \"ENOTEMPTY\"])\nconst MAX_RETRIES = 3\nconst BASE_DELAY_MS = 100\n\n// =============================================================================\n// Pure functions\n// =============================================================================\n\n/**\n * Compute the delta between two dependency maps.\n * Pure function: same inputs always produce same output.\n *\n * Intentionally detects only additions and version changes — removals are\n * excluded because `ocx add` only ever appends deps, never removes them.\n * If removal detection is needed (e.g. for `ocx remove`), use a separate\n * function that iterates `before` keys absent in `after`.\n */\nexport function computeDependencyDelta(\n\tbefore: Record<string, string>,\n\tafter: Record<string, string>,\n): DependencyDelta {\n\tconst entries: DependencyDeltaEntry[] = []\n\n\t// Detect added or changed deps\n\tfor (const [name, version] of Object.entries(after)) {\n\t\tconst previousVersion = before[name] ?? null\n\t\tif (previousVersion !== version) {\n\t\t\tentries.push({ name, from: previousVersion, to: version })\n\t\t}\n\t}\n\n\treturn {\n\t\tchanged: entries.length > 0,\n\t\tentries,\n\t}\n}\n\n/**\n * Build a DryRunAction for planned node_modules invalidation.\n * Pure function for dry-run reporting.\n */\nexport function buildInvalidationDryRunAction(\n\tpackageDir: string,\n\tdeltaEntries: DependencyDeltaEntry[],\n): DryRunAction {\n\tconst nodeModulesPath = join(packageDir, \"node_modules\")\n\tconst changedNames = deltaEntries.map((e) => e.name).join(\", \")\n\n\treturn {\n\t\taction: \"delete\",\n\t\ttarget: nodeModulesPath,\n\t\tdetails: {\n\t\t\treason: `dependency declarations changed (${changedNames}); invalidating to force reinstall`,\n\t\t\tpath: nodeModulesPath,\n\t\t},\n\t}\n}\n\n// =============================================================================\n// Side-effectful helpers\n// =============================================================================\n\n/**\n * Extract error code from an unknown error.\n * Guard clause for type safety at the boundary.\n */\nfunction extractErrorCode(error: unknown): string {\n\tif (error && typeof error === \"object\" && \"code\" in error) {\n\t\treturn String((error as { code: unknown }).code)\n\t}\n\treturn \"UNKNOWN\"\n}\n\n/**\n * Extract error message from an unknown error.\n */\nfunction extractErrorMessage(error: unknown): string {\n\tif (error instanceof Error) return error.message\n\treturn String(error)\n}\n\n/**\n * Sleep for the given number of milliseconds.\n */\nfunction sleep(ms: number): Promise<void> {\n\treturn new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * Safely invalidate node_modules in the given packageDir.\n *\n * Behavior:\n * - ENOENT (missing): success/no-op\n * - Symlink: unlink the symlink, leave target intact\n * - Directory: rm -rf with retry on EBUSY/ENOTEMPTY\n * - EPERM/EACCES: immediate failure (non-retryable)\n *\n * Never throws — returns a result object for the caller to inspect.\n */\nexport async function invalidateNodeModules(\n\tpackageDir: string,\n\toptions?: InvalidationOptions,\n): Promise<InvalidationResult> {\n\tconst nodeModulesPath = join(packageDir, \"node_modules\")\n\tconst removeDir =\n\t\toptions?.rmImpl ?? ((p: string, opts?: { recursive?: boolean; force?: boolean }) => rm(p, opts))\n\n\t// Guard: nothing to do\n\tif (!existsSync(nodeModulesPath)) {\n\t\treturn { success: true, action: \"none\" }\n\t}\n\n\t// Handle symlink: unlink without following\n\ttry {\n\t\tconst stat = lstatSync(nodeModulesPath)\n\t\tif (stat.isSymbolicLink()) {\n\t\t\tawait unlink(nodeModulesPath)\n\t\t\treturn { success: true, action: \"unlinked\" }\n\t\t}\n\t} catch (error) {\n\t\tconst code = extractErrorCode(error)\n\t\t// ENOENT: race condition — another concurrent call already removed it\n\t\tif (code === \"ENOENT\") {\n\t\t\treturn { success: true, action: \"none\" }\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\taction: \"failed\",\n\t\t\terror: { code, message: extractErrorMessage(error) },\n\t\t}\n\t}\n\n\t// Remove directory with bounded exponential backoff on retryable errors\n\tfor (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n\t\ttry {\n\t\t\tawait removeDir(nodeModulesPath, { recursive: true, force: true })\n\t\t\treturn { success: true, action: \"removed\" }\n\t\t} catch (error) {\n\t\t\tconst code = extractErrorCode(error)\n\n\t\t\t// ENOENT: race condition — already removed\n\t\t\tif (code === \"ENOENT\") {\n\t\t\t\treturn { success: true, action: \"none\" }\n\t\t\t}\n\n\t\t\t// Non-retryable: fail immediately\n\t\t\tif (!RETRYABLE_CODES.has(code)) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\taction: \"failed\",\n\t\t\t\t\terror: { code, message: extractErrorMessage(error) },\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Retryable: backoff unless we've exhausted retries\n\t\t\tif (attempt < MAX_RETRIES) {\n\t\t\t\tawait sleep(BASE_DELAY_MS * 2 ** attempt)\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\taction: \"failed\",\n\t\t\t\t\terror: { code, message: extractErrorMessage(error) },\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Unreachable, but TypeScript needs it\n\treturn {\n\t\tsuccess: false,\n\t\taction: \"failed\",\n\t\terror: { code: \"UNKNOWN\", message: \"exhausted retries\" },\n\t}\n}\n",
61
- "'use strict';\n\nlet FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;\nif (typeof process !== 'undefined') {\n\t({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});\n\tisTTY = process.stdout && process.stdout.isTTY;\n}\n\nconst $ = {\n\tenabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (\n\t\tFORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY\n\t),\n\n\t// modifiers\n\treset: init(0, 0),\n\tbold: init(1, 22),\n\tdim: init(2, 22),\n\titalic: init(3, 23),\n\tunderline: init(4, 24),\n\tinverse: init(7, 27),\n\thidden: init(8, 28),\n\tstrikethrough: init(9, 29),\n\n\t// colors\n\tblack: init(30, 39),\n\tred: init(31, 39),\n\tgreen: init(32, 39),\n\tyellow: init(33, 39),\n\tblue: init(34, 39),\n\tmagenta: init(35, 39),\n\tcyan: init(36, 39),\n\twhite: init(37, 39),\n\tgray: init(90, 39),\n\tgrey: init(90, 39),\n\n\t// background colors\n\tbgBlack: init(40, 49),\n\tbgRed: init(41, 49),\n\tbgGreen: init(42, 49),\n\tbgYellow: init(43, 49),\n\tbgBlue: init(44, 49),\n\tbgMagenta: init(45, 49),\n\tbgCyan: init(46, 49),\n\tbgWhite: init(47, 49)\n};\n\nfunction run(arr, str) {\n\tlet i=0, tmp, beg='', end='';\n\tfor (; i < arr.length; i++) {\n\t\ttmp = arr[i];\n\t\tbeg += tmp.open;\n\t\tend += tmp.close;\n\t\tif (!!~str.indexOf(tmp.close)) {\n\t\t\tstr = str.replace(tmp.rgx, tmp.close + tmp.open);\n\t\t}\n\t}\n\treturn beg + str + end;\n}\n\nfunction chain(has, keys) {\n\tlet ctx = { has, keys };\n\n\tctx.reset = $.reset.bind(ctx);\n\tctx.bold = $.bold.bind(ctx);\n\tctx.dim = $.dim.bind(ctx);\n\tctx.italic = $.italic.bind(ctx);\n\tctx.underline = $.underline.bind(ctx);\n\tctx.inverse = $.inverse.bind(ctx);\n\tctx.hidden = $.hidden.bind(ctx);\n\tctx.strikethrough = $.strikethrough.bind(ctx);\n\n\tctx.black = $.black.bind(ctx);\n\tctx.red = $.red.bind(ctx);\n\tctx.green = $.green.bind(ctx);\n\tctx.yellow = $.yellow.bind(ctx);\n\tctx.blue = $.blue.bind(ctx);\n\tctx.magenta = $.magenta.bind(ctx);\n\tctx.cyan = $.cyan.bind(ctx);\n\tctx.white = $.white.bind(ctx);\n\tctx.gray = $.gray.bind(ctx);\n\tctx.grey = $.grey.bind(ctx);\n\n\tctx.bgBlack = $.bgBlack.bind(ctx);\n\tctx.bgRed = $.bgRed.bind(ctx);\n\tctx.bgGreen = $.bgGreen.bind(ctx);\n\tctx.bgYellow = $.bgYellow.bind(ctx);\n\tctx.bgBlue = $.bgBlue.bind(ctx);\n\tctx.bgMagenta = $.bgMagenta.bind(ctx);\n\tctx.bgCyan = $.bgCyan.bind(ctx);\n\tctx.bgWhite = $.bgWhite.bind(ctx);\n\n\treturn ctx;\n}\n\nfunction init(open, close) {\n\tlet blk = {\n\t\topen: `\\x1b[${open}m`,\n\t\tclose: `\\x1b[${close}m`,\n\t\trgx: new RegExp(`\\\\x1b\\\\[${close}m`, 'g')\n\t};\n\treturn function (txt) {\n\t\tif (this !== void 0 && this.has !== void 0) {\n\t\t\t!!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));\n\t\t\treturn txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';\n\t\t}\n\t\treturn txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';\n\t};\n}\n\nexport default $;\n",
62
- "/**\n * Environment detection utilities\n * Detects CI, TTY, color support for proper output handling\n */\n\n/** Running in CI environment */\nexport const isCI = Boolean(\n\tprocess.env.CI ||\n\t\tprocess.env.GITHUB_ACTIONS ||\n\t\tprocess.env.GITLAB_CI ||\n\t\tprocess.env.CIRCLECI ||\n\t\tprocess.env.JENKINS_URL ||\n\t\tprocess.env.BUILDKITE,\n)\n\n/** Running in interactive terminal */\nexport const isTTY = Boolean(process.stdout.isTTY && !isCI)\n\n/** Terminal supports colors */\nexport const supportsColor = Boolean(\n\tisTTY && process.env.FORCE_COLOR !== \"0\" && process.env.NO_COLOR === undefined,\n)\n\n/**\n * Parse a boolean environment variable with explicit semantics.\n *\n * Truthy: \"true\", \"1\", \"yes\", \"on\" (case-insensitive)\n * Falsy: \"false\", \"0\", \"no\", \"off\" (case-insensitive)\n *\n * @param value - The environment variable value\n * @param defaultValue - Default if value is empty/undefined/invalid\n * @returns Parsed boolean value\n *\n * @example\n * const noUpdateCheck = parseEnvBool(process.env.OCX_NO_UPDATE_CHECK, false)\n */\nexport function parseEnvBool(value: string | undefined, defaultValue: boolean): boolean {\n\t// Guard: empty or undefined returns default\n\tif (value == null || value === \"\") {\n\t\treturn defaultValue\n\t}\n\n\tconst normalized = value.trim().toLowerCase()\n\n\t// Explicit truthy values\n\tif (normalized === \"true\" || normalized === \"1\" || normalized === \"yes\" || normalized === \"on\") {\n\t\treturn true\n\t}\n\n\t// Explicit falsy values\n\tif (normalized === \"false\" || normalized === \"0\" || normalized === \"no\" || normalized === \"off\") {\n\t\treturn false\n\t}\n\n\t// Unknown value: fall back to default\n\treturn defaultValue\n}\n",
63
- "/**\n * Logger utility with quiet/verbose modes\n * Inspired by ShadCN's logger pattern\n */\n\nimport kleur from \"kleur\"\nimport { supportsColor } from \"./env\"\n\n// Disable colors if not supported\nif (!supportsColor) {\n\tkleur.enabled = false\n}\n\nexport interface LoggerOptions {\n\tquiet?: boolean\n\tverbose?: boolean\n}\n\nlet options: LoggerOptions = {}\n\nexport function setLoggerOptions(opts: LoggerOptions): void {\n\toptions = opts\n}\n\nexport const logger = {\n\tinfo(...args: unknown[]): void {\n\t\tif (options.quiet) return\n\t\tconsole.log(kleur.blue(\"info\"), ...args)\n\t},\n\n\tsuccess(...args: unknown[]): void {\n\t\tif (options.quiet) return\n\t\tconsole.log(kleur.green(\"✓\"), ...args)\n\t},\n\n\twarn(...args: unknown[]): void {\n\t\tif (options.quiet) return\n\t\tconsole.warn(kleur.yellow(\"warn\"), ...args)\n\t},\n\n\terror(...args: unknown[]): void {\n\t\t// Errors are always shown\n\t\tconsole.error(kleur.red(\"error\"), ...args)\n\t},\n\n\tdebug(...args: unknown[]): void {\n\t\tif (!options.verbose) return\n\t\tconsole.log(kleur.gray(\"debug\"), ...args)\n\t},\n\n\tlog(...args: unknown[]): void {\n\t\tif (options.quiet) return\n\t\tconsole.log(...args)\n\t},\n\n\t/** Print a blank line */\n\tbreak(): void {\n\t\tif (options.quiet) return\n\t\tconsole.log(\"\")\n\t},\n}\n\n/** Highlight text with color */\nexport const highlight = {\n\tcomponent: (text: string) => kleur.cyan(text),\n\tpath: (text: string) => kleur.green(text),\n\tcommand: (text: string) => kleur.yellow(text),\n\turl: (text: string) => kleur.blue().underline(text),\n\terror: (text: string) => kleur.red(text),\n\tdim: (text: string) => kleur.gray(text),\n\tbold: (text: string) => kleur.bold(text),\n}\n",
64
- "/**\n * Shared dry-run utilities for consistent --dry-run output across commands\n */\n\nimport { highlight, logger } from \"./logger\"\n\n/** Individual action that would be performed */\nexport interface DryRunAction {\n\taction: \"add\" | \"remove\" | \"update\" | \"create\" | \"delete\" | \"modify\"\n\ttarget: string // e.g., \"shadcn/button\", \"registry:kit\", \"file:button.tsx\"\n\tdetails?: Record<string, unknown>\n}\n\n/** Validation result - REQUIRED, not optional */\nexport interface DryRunValidation {\n\tpassed: boolean\n\terrors?: string[] // Fatal issues that would cause failure\n\twarnings?: string[] // Non-fatal issues (e.g., modified files without --force)\n}\n\n/** Base result that all commands return */\nexport interface DryRunResult {\n\tdryRun: true\n\tcommand: string\n\twouldPerform: DryRunAction[]\n\tvalidation: DryRunValidation // Required, not optional\n\tsummary?: string\n}\n\n/** Output options */\nexport interface DryRunOutputOptions {\n\tjson?: boolean\n\tquiet?: boolean\n\thints?: string[] // Command-specific hints to show after output\n}\n\n/**\n * Output dry-run results with consistent formatting\n * @param result - The dry-run result to display\n * @param options - Output options (json, quiet, hints)\n */\nexport function outputDryRun(result: DryRunResult, options: DryRunOutputOptions = {}): void {\n\t// Guard: JSON output takes priority\n\tif (options.json) {\n\t\tconsole.log(JSON.stringify(result, null, 2))\n\t\treturn\n\t}\n\n\t// Guard: Quiet mode suppresses all output\n\tif (options.quiet) {\n\t\treturn\n\t}\n\n\t// Format text output\n\tlogger.info(highlight.dim(\"🔍 DRY RUN: No changes will be made\"))\n\tlogger.break()\n\n\t// Show what would be performed\n\tconst actionCount = result.wouldPerform.length\n\tif (actionCount === 0) {\n\t\tlogger.info(\"No actions would be performed.\")\n\t} else {\n\t\t// Group actions by type for cleaner output\n\t\tconst grouped = groupActionsByType(result.wouldPerform)\n\n\t\tfor (const [actionType, actions] of Object.entries(grouped)) {\n\t\t\tconst verb = getActionVerb(actionType)\n\t\t\tlogger.info(`Would ${verb} ${actions.length} item(s):`)\n\n\t\t\tfor (const action of actions) {\n\t\t\t\tconst detailsText = formatDetails(action.details)\n\t\t\t\tlogger.info(` • ${highlight.component(action.target)}${detailsText}`)\n\t\t\t}\n\n\t\t\tlogger.break()\n\t\t}\n\t}\n\n\t// Show summary if provided\n\tif (result.summary) {\n\t\tlogger.info(result.summary)\n\t\tlogger.break()\n\t}\n\n\t// Show validation errors\n\tif (result.validation.errors && result.validation.errors.length > 0) {\n\t\tlogger.error(\"Would fail with errors:\")\n\t\tfor (const error of result.validation.errors) {\n\t\t\tlogger.error(` • ${error}`)\n\t\t}\n\t\tlogger.break()\n\t}\n\n\t// Show validation warnings\n\tif (result.validation.warnings && result.validation.warnings.length > 0) {\n\t\tlogger.warn(\"Warnings:\")\n\t\tfor (const warning of result.validation.warnings) {\n\t\t\tlogger.warn(` • ${warning}`)\n\t\t}\n\t\tlogger.break()\n\t}\n\n\t// Show command-specific hints\n\tif (options.hints && options.hints.length > 0) {\n\t\tfor (const hint of options.hints) {\n\t\t\tlogger.info(highlight.dim(hint))\n\t\t}\n\t\tlogger.break()\n\t}\n\n\t// Final instruction\n\tlogger.info(highlight.dim(\"Run without --dry-run to apply changes.\"))\n}\n\n/**\n * Group actions by their type for organized output\n */\nfunction groupActionsByType(actions: DryRunAction[]): Record<string, DryRunAction[]> {\n\tconst grouped: Record<string, DryRunAction[]> = {}\n\n\tfor (const action of actions) {\n\t\tif (!grouped[action.action]) {\n\t\t\tgrouped[action.action] = []\n\t\t}\n\t\tgrouped[action.action]?.push(action)\n\t}\n\n\treturn grouped\n}\n\n/**\n * Convert action type to human-readable verb\n */\nfunction getActionVerb(actionType: string): string {\n\tconst verbs: Record<string, string> = {\n\t\tadd: \"add\",\n\t\tremove: \"remove\",\n\t\tdelete: \"delete\",\n\t\tupdate: \"update\",\n\t\tcreate: \"create\",\n\t\tmodify: \"modify\",\n\t}\n\n\treturn verbs[actionType] ?? actionType\n}\n\n/**\n * Format action details into readable text\n */\nfunction formatDetails(details?: Record<string, unknown>): string {\n\tif (!details || Object.keys(details).length === 0) {\n\t\treturn \"\"\n\t}\n\n\tconst pairs: string[] = []\n\tfor (const [key, value] of Object.entries(details ?? {})) {\n\t\tif (value !== undefined && value !== null) {\n\t\t\tpairs.push(`${key}: ${highlight.dim(String(value))}`)\n\t\t}\n\t}\n\n\treturn pairs.length > 0 ? ` (${pairs.join(\", \")})` : \"\"\n}\n",
65
- "/**\n * Core utilities for OCX CLI\n */\n\nexport * from \"./content\"\nexport * from \"./env\"\nexport * from \"./errors\"\nexport * from \"./git-context\"\nexport * from \"./handle-error\"\nexport * from \"./instruction-paths\"\nexport * from \"./json-output\"\nexport * from \"./logger\"\nexport * from \"./path-helpers\"\nexport * from \"./shared-options\"\nexport * from \"./spinner\"\nexport * from \"./url\"\nexport * from \"./version-compat\"\n",
66
- "/**\n * Git repository context detection utilities.\n *\n * Provides typed detection of git repository context while avoiding\n * pollution from inherited GIT_DIR/GIT_WORK_TREE environment variables.\n */\n\nimport { basename, resolve } from \"node:path\"\n\n/**\n * Creates a clean environment without inherited git directory overrides.\n * Prevents git commands from using wrong repository context.\n * @returns A copy of process.env without GIT_DIR and GIT_WORK_TREE\n */\nexport function getGitEnv(): NodeJS.ProcessEnv {\n\tconst { GIT_DIR: _, GIT_WORK_TREE: __, ...cleanEnv } = process.env\n\treturn cleanEnv\n}\n\n/**\n * Represents a valid git repository context with resolved paths.\n */\nexport interface GitContext {\n\t/** Absolute path to the .git directory */\n\tgitDir: string\n\t/** Absolute path to the working tree root */\n\tworkTree: string\n}\n\n/**\n * Detects if cwd is inside a git repository.\n * Clears inherited GIT_DIR/GIT_WORK_TREE to avoid pollution from parent processes.\n *\n * @param cwd - Directory to check for git repository\n * @returns GitContext if in a repo, null otherwise\n *\n * @example\n * ```ts\n * const gitContext = await detectGitRepo(process.cwd())\n * if (!gitContext) {\n * console.log(\"Not in a git repository\")\n * return\n * }\n * console.log(`Git dir: ${gitContext.gitDir}`)\n * ```\n */\nexport async function detectGitRepo(cwd: string): Promise<GitContext | null> {\n\t// Detect git directory\n\tconst gitDirProc = Bun.spawn([\"git\", \"rev-parse\", \"--git-dir\"], {\n\t\tcwd,\n\t\tenv: getGitEnv(),\n\t\tstdout: \"pipe\",\n\t\tstderr: \"pipe\",\n\t})\n\n\tconst gitDirExitCode = await gitDirProc.exited\n\n\t// Early exit: not a git repository\n\tif (gitDirExitCode !== 0) {\n\t\treturn null\n\t}\n\n\tconst gitDirOutput = await new Response(gitDirProc.stdout).text()\n\tconst gitDirRaw = gitDirOutput.trim()\n\n\t// Early exit: empty output means something went wrong\n\tif (!gitDirRaw) {\n\t\treturn null\n\t}\n\n\t// Detect work tree root\n\tconst workTreeProc = Bun.spawn([\"git\", \"rev-parse\", \"--show-toplevel\"], {\n\t\tcwd,\n\t\tenv: getGitEnv(),\n\t\tstdout: \"pipe\",\n\t\tstderr: \"pipe\",\n\t})\n\n\tconst workTreeExitCode = await workTreeProc.exited\n\n\t// Early exit: could not determine work tree (bare repo or error)\n\tif (workTreeExitCode !== 0) {\n\t\treturn null\n\t}\n\n\tconst workTreeOutput = await new Response(workTreeProc.stdout).text()\n\tconst workTree = workTreeOutput.trim()\n\n\t// Early exit: empty work tree\n\tif (!workTree) {\n\t\treturn null\n\t}\n\n\t// Resolve gitDir to absolute path (it may be relative like \".git\")\n\tconst gitDir = resolve(cwd, gitDirRaw)\n\n\treturn { gitDir, workTree }\n}\n\n/**\n * Gets the current git branch name.\n *\n * Resolution order:\n * 1. symbolic-ref (normal branch)\n * 2. describe --tags --exact-match (tagged commit)\n * 3. rev-parse --short (detached HEAD - short commit hash)\n *\n * @param cwd - Directory to check\n * @returns Branch name, tag, or short commit hash; null if not a git repo\n *\n * @example\n * ```ts\n * const branch = await getBranch(process.cwd())\n * if (branch) {\n * console.log(`Current branch: ${branch}`)\n * }\n * ```\n */\nexport async function getBranch(cwd: string): Promise<string | null> {\n\t// Try symbolic-ref first (normal branch)\n\tconst symbolicProc = Bun.spawn([\"git\", \"symbolic-ref\", \"--short\", \"HEAD\"], {\n\t\tcwd,\n\t\tenv: getGitEnv(),\n\t\tstdout: \"pipe\",\n\t\tstderr: \"pipe\",\n\t})\n\n\tconst symbolicExitCode = await symbolicProc.exited\n\n\tif (symbolicExitCode === 0) {\n\t\tconst output = await new Response(symbolicProc.stdout).text()\n\t\tconst branch = output.trim()\n\t\tif (branch) {\n\t\t\treturn branch\n\t\t}\n\t}\n\n\t// Fallback: try exact tag match\n\tconst tagProc = Bun.spawn([\"git\", \"describe\", \"--tags\", \"--exact-match\", \"HEAD\"], {\n\t\tcwd,\n\t\tenv: getGitEnv(),\n\t\tstdout: \"pipe\",\n\t\tstderr: \"pipe\",\n\t})\n\n\tconst tagExitCode = await tagProc.exited\n\n\tif (tagExitCode === 0) {\n\t\tconst output = await new Response(tagProc.stdout).text()\n\t\tconst tag = output.trim()\n\t\tif (tag) {\n\t\t\treturn tag\n\t\t}\n\t}\n\n\t// Fallback: short commit hash (detached HEAD)\n\tconst hashProc = Bun.spawn([\"git\", \"rev-parse\", \"--short\", \"HEAD\"], {\n\t\tcwd,\n\t\tenv: getGitEnv(),\n\t\tstdout: \"pipe\",\n\t\tstderr: \"pipe\",\n\t})\n\n\tconst hashExitCode = await hashProc.exited\n\n\tif (hashExitCode === 0) {\n\t\tconst output = await new Response(hashProc.stdout).text()\n\t\tconst hash = output.trim()\n\t\tif (hash) {\n\t\t\treturn hash\n\t\t}\n\t}\n\n\t// Not a git repo or all methods failed\n\treturn null\n}\n\n/**\n * Gets the repository name from the git root directory.\n *\n * @param cwd - Directory to check\n * @returns Repository name (basename of root), null if not a git repo\n *\n * @example\n * ```ts\n * const repoName = await getRepoName(process.cwd())\n * if (repoName) {\n * console.log(`Repository: ${repoName}`)\n * }\n * ```\n */\nexport async function getRepoName(cwd: string): Promise<string | null> {\n\tconst proc = Bun.spawn([\"git\", \"rev-parse\", \"--show-toplevel\"], {\n\t\tcwd,\n\t\tenv: getGitEnv(),\n\t\tstdout: \"pipe\",\n\t\tstderr: \"pipe\",\n\t})\n\n\tconst exitCode = await proc.exited\n\n\t// Early exit: not a git repository\n\tif (exitCode !== 0) {\n\t\treturn null\n\t}\n\n\tconst output = await new Response(proc.stdout).text()\n\tconst rootPath = output.trim()\n\n\t// Early exit: empty output\n\tif (!rootPath) {\n\t\treturn null\n\t}\n\n\treturn basename(rootPath)\n}\n\n/**\n * Combined git information for repository context.\n */\nexport interface GitInfo {\n\t/** Repository name (basename of git root) */\n\trepoName: string | null\n\t/** Current branch, tag, or short commit hash */\n\tbranch: string | null\n}\n\n/**\n * Gets combined git repository information.\n *\n * @param cwd - Directory to check\n * @returns Object with repoName and branch (both null if not a git repo)\n *\n * @example\n * ```ts\n * const info = await getGitInfo(process.cwd())\n * console.log(`${info.repoName}@${info.branch}`)\n * ```\n */\nexport async function getGitInfo(cwd: string): Promise<GitInfo> {\n\tconst [repoName, branch] = await Promise.all([getRepoName(cwd), getBranch(cwd)])\n\n\treturn { repoName, branch }\n}\n",
67
- "/**\n * Error handler for CLI commands\n * Converts errors to user-friendly output with proper exit codes\n */\n\nimport { ZodError } from \"zod\"\n\nimport { BuildRegistryError } from \"../lib/build-registry\"\nimport {\n\tEXIT_CODES,\n\tIntegrityError,\n\tInvalidProfileNameError,\n\tNetworkError,\n\tOCXError,\n\tProfileExistsError,\n\tProfileNotFoundError,\n\tRegistryCompatibilityError,\n\tRegistryExistsError,\n\tValidationFailedError,\n} from \"./errors\"\nimport { logger } from \"./logger\"\n\nexport interface HandleErrorOptions {\n\tjson?: boolean\n}\n\n/**\n * Handle errors consistently across all commands\n * Fail-fast: exit immediately with appropriate code\n */\nexport function handleError(error: unknown, options: HandleErrorOptions = {}): never {\n\t// JSON mode: structured output\n\tif (options.json) {\n\t\tconst output = formatErrorAsJson(error)\n\t\tconsole.log(JSON.stringify(output, null, 2))\n\t\tprocess.exit(output.exitCode)\n\t}\n\n\t// OCX errors: known errors with codes\n\tif (error instanceof OCXError) {\n\t\tlogger.error(error.message)\n\t\tprocess.exit(error.exitCode)\n\t}\n\n\t// Zod validation errors: format nicely\n\tif (error instanceof ZodError) {\n\t\tlogger.error(\"Validation failed:\")\n\t\tfor (const issue of error.issues) {\n\t\t\tconst path = issue.path.join(\".\")\n\t\t\tlogger.error(` ${path}: ${issue.message}`)\n\t\t}\n\t\tprocess.exit(EXIT_CODES.CONFIG)\n\t}\n\n\t// Unknown errors\n\tif (error instanceof Error) {\n\t\tlogger.error(error.message)\n\t\tif (process.env.DEBUG) {\n\t\t\tconsole.error(error.stack)\n\t\t}\n\t} else {\n\t\tlogger.error(\"An unknown error occurred\")\n\t}\n\n\tprocess.exit(EXIT_CODES.GENERAL)\n}\n\ninterface JsonErrorOutput {\n\tsuccess: false\n\terror: {\n\t\tcode: string\n\t\tmessage: string\n\t\tdetails?: Record<string, unknown>\n\t}\n\texitCode: number\n\tmeta: {\n\t\ttimestamp: string\n\t}\n}\n\n/**\n * Wraps a command action with consistent error handling.\n * Use this to wrap async command handlers in Commander actions.\n *\n * @example\n * program\n * .command(\"add\")\n * .action(wrapAction(async (options) => {\n * // command implementation\n * }))\n */\nexport function wrapAction<T extends unknown[]>(\n\taction: (...args: T) => void | Promise<void>,\n): (...args: T) => Promise<void> {\n\treturn async (...args: T) => {\n\t\ttry {\n\t\t\tawait action(...args)\n\t\t} catch (error) {\n\t\t\thandleError(error)\n\t\t}\n\t}\n}\n\nfunction formatErrorAsJson(error: unknown): JsonErrorOutput {\n\tif (error instanceof RegistryExistsError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: {\n\t\t\t\t\tconflictType: error.conflictType,\n\t\t\t\t\tregistryName: error.registryName,\n\t\t\t\t\texistingUrl: error.existingUrl,\n\t\t\t\t\tnewUrl: error.newUrl,\n\t\t\t\t\t...(error.targetLabel && { targetLabel: error.targetLabel }),\n\t\t\t\t\t...(error.existingName && { existingName: error.existingName }),\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof IntegrityError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: {\n\t\t\t\t\tcomponent: error.component,\n\t\t\t\t\texpected: error.expected,\n\t\t\t\t\tfound: error.found,\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof NetworkError) {\n\t\tconst details: Record<string, unknown> = {}\n\t\tif (error.url) details.url = error.url\n\t\tif (error.status !== undefined) details.status = error.status\n\t\tif (error.statusText) details.statusText = error.statusText\n\t\tif (error.phase) details.phase = error.phase\n\t\tif (error.qualifiedName) details.qualifiedName = error.qualifiedName\n\t\tif (error.registryContext) details.registryContext = error.registryContext\n\t\tif (error.registryName) details.registryName = error.registryName\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\t...(Object.keys(details).length > 0 && { details }),\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof ProfileNotFoundError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: {\n\t\t\t\t\tprofile: error.profile,\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof ProfileExistsError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: {\n\t\t\t\t\tprofile: error.profile,\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof InvalidProfileNameError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: {\n\t\t\t\t\tprofile: error.profile,\n\t\t\t\t\treason: error.reason,\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof BuildRegistryError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"BUILD_ERROR\",\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: {\n\t\t\t\t\terrors: error.errors,\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: EXIT_CODES.GENERAL,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof RegistryCompatibilityError) {\n\t\tconst details: Record<string, unknown> = {\n\t\t\turl: error.url,\n\t\t\tissue: error.issue,\n\t\t\tremediation: error.remediation,\n\t\t}\n\t\tif (error.schemaUrl !== undefined) details.schemaUrl = error.schemaUrl\n\t\tif (error.supportedMajor !== undefined) details.supportedMajor = error.supportedMajor\n\t\tif (error.detectedMajor !== undefined) details.detectedMajor = error.detectedMajor\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails,\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof ValidationFailedError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t\tdetails: error.details as unknown as Record<string, unknown>,\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof OCXError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: error.code,\n\t\t\t\tmessage: error.message,\n\t\t\t},\n\t\t\texitCode: error.exitCode,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\tif (error instanceof ZodError) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tmessage: error.issues.map((i) => `${i.path.join(\".\")}: ${i.message}`).join(\"; \"),\n\t\t\t\tdetails: {\n\t\t\t\t\tissues: error.issues.map((i) => ({\n\t\t\t\t\t\tpath: i.path.join(\".\"),\n\t\t\t\t\t\tmessage: i.message,\n\t\t\t\t\t\tcode: i.code,\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t},\n\t\t\texitCode: EXIT_CODES.CONFIG,\n\t\t\tmeta: {\n\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t},\n\t\t}\n\t}\n\n\treturn {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode: \"UNKNOWN_ERROR\",\n\t\t\tmessage: error instanceof Error ? error.message : \"An unknown error occurred\",\n\t\t},\n\t\texitCode: EXIT_CODES.GENERAL,\n\t\tmeta: {\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t},\n\t}\n}\n",
68
- "/**\n * Build Registry Library Function\n *\n * Pure function to build a registry from source.\n * No CLI concerns - just input/output.\n */\n\nimport { mkdir } from \"node:fs/promises\"\nimport { dirname, join } from \"node:path\"\nimport { parse as parseJsonc } from \"jsonc-parser\"\nimport { classifyRegistrySchemaIssue, normalizeFile, registrySchema } from \"../schemas/registry\"\nimport type { DryRunResult } from \"../utils/dry-run\"\n\nexport interface BuildRegistryOptions {\n\t/** Source directory containing registry.jsonc (or registry.json) and files/ */\n\tsource: string\n\t/** Output directory for built registry */\n\tout: string\n\t/** Dry-run mode: validate and show what would be built */\n\tdryRun?: boolean\n}\n\nexport interface BuildRegistryResult {\n\t/** Number of components built */\n\tcomponentsCount: number\n\t/** Absolute path to output directory */\n\toutputPath: string\n}\n\nexport class BuildRegistryError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly errors: string[] = [],\n\t) {\n\t\tsuper(message)\n\t\tthis.name = \"BuildRegistryError\"\n\t}\n}\n\n/**\n * Build a registry from source.\n *\n * @param options - Build options\n * @returns Build result with metadata or DryRunResult\n * @throws {BuildRegistryError} If validation fails or files are missing\n */\nexport async function buildRegistry(\n\toptions: BuildRegistryOptions,\n): Promise<BuildRegistryResult | DryRunResult> {\n\tconst { source: sourcePath, out: outPath } = options\n\n\t// Read registry file from source (prefer .jsonc over .json)\n\tconst jsoncFile = Bun.file(join(sourcePath, \"registry.jsonc\"))\n\tconst jsonFile = Bun.file(join(sourcePath, \"registry.json\"))\n\tconst jsoncExists = await jsoncFile.exists()\n\tconst jsonExists = await jsonFile.exists()\n\n\tif (!jsoncExists && !jsonExists) {\n\t\tthrow new BuildRegistryError(\"No registry.jsonc or registry.json found in source directory\")\n\t}\n\n\tconst registryFile = jsoncExists ? jsoncFile : jsonFile\n\tconst content = await registryFile.text()\n\tconst registryData = parseJsonc(content, [], { allowTrailingComma: true })\n\tconst schemaIssue = classifyRegistrySchemaIssue(registryData)\n\tif (schemaIssue) {\n\t\tthrow new BuildRegistryError(`Registry schema compatibility failed (${schemaIssue.issue})`, [\n\t\t\tschemaIssue.remediation,\n\t\t\t...(schemaIssue.schemaUrl !== undefined ? [`Invalid $schema: ${schemaIssue.schemaUrl}`] : []),\n\t\t])\n\t}\n\n\t// Validate registry schema\n\tconst parseResult = registrySchema.safeParse(registryData)\n\tif (!parseResult.success) {\n\t\tconst errors = parseResult.error.errors.map((e) => `${e.path.join(\".\")}: ${e.message}`)\n\t\tthrow new BuildRegistryError(\"Registry validation failed\", errors)\n\t}\n\n\tconst registry = parseResult.data\n\tconst validationErrors: string[] = []\n\n\t// Dry-run: Calculate what would be built without creating files\n\tif (options.dryRun) {\n\t\tconst actions = []\n\n\t\t// Check for missing source files\n\t\tfor (const component of registry.components) {\n\t\t\t// Would create packument file\n\t\t\tactions.push({\n\t\t\t\taction: \"create\" as const,\n\t\t\t\ttarget: `file:components/${component.name}.json`,\n\t\t\t\tdetails: { type: \"packument\" },\n\t\t\t})\n\n\t\t\t// Check source files exist\n\t\t\tfor (const rawFile of component.files) {\n\t\t\t\tconst file = normalizeFile(rawFile, component.type)\n\t\t\t\tconst sourceFilePath = join(sourcePath, \"files\", file.path)\n\n\t\t\t\tif (!(await Bun.file(sourceFilePath).exists())) {\n\t\t\t\t\tvalidationErrors.push(`${component.name}: Source file not found at ${sourceFilePath}`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Would copy file\n\t\t\t\tactions.push({\n\t\t\t\t\taction: \"create\" as const,\n\t\t\t\t\ttarget: `file:components/${component.name}/${file.path}`,\n\t\t\t\t\tdetails: { source: sourceFilePath },\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Would create index.json\n\t\tactions.push({\n\t\t\taction: \"create\" as const,\n\t\t\ttarget: \"file:index.json\",\n\t\t\tdetails: { type: \"registry index\" },\n\t\t})\n\n\t\t// Would create .well-known/ocx.json\n\t\tactions.push({\n\t\t\taction: \"create\" as const,\n\t\t\ttarget: \"file:.well-known/ocx.json\",\n\t\t\tdetails: { type: \"discovery file\" },\n\t\t})\n\n\t\t// Calculate total files\n\t\tconst totalFiles = actions.filter((a) => a.action === \"create\").length\n\n\t\treturn {\n\t\t\tdryRun: true,\n\t\t\tcommand: \"build\",\n\t\t\twouldPerform: actions,\n\t\t\tvalidation: {\n\t\t\t\tpassed: validationErrors.length === 0,\n\t\t\t\terrors: validationErrors.length > 0 ? validationErrors : undefined,\n\t\t\t},\n\t\t\tsummary: `Would build ${registry.components.length} components, ${totalFiles} files to ${outPath}`,\n\t\t}\n\t}\n\n\t// Normal mode: Create output directory structure\n\tconst componentsDir = join(outPath, \"components\")\n\tawait mkdir(componentsDir, { recursive: true })\n\n\t// V2: Generate packument and copy files for each component\n\t// Use component-level versioning (default to 1.0.0)\n\tconst DEFAULT_COMPONENT_VERSION = \"1.0.0\"\n\n\tfor (const component of registry.components) {\n\t\tconst packument = {\n\t\t\tname: component.name,\n\t\t\tversions: {\n\t\t\t\t[DEFAULT_COMPONENT_VERSION]: component,\n\t\t\t},\n\t\t\t\"dist-tags\": {\n\t\t\t\tlatest: DEFAULT_COMPONENT_VERSION,\n\t\t\t},\n\t\t}\n\n\t\t// Write manifest to components/[name].json\n\t\tconst packumentPath = join(componentsDir, `${component.name}.json`)\n\t\tawait Bun.write(packumentPath, JSON.stringify(packument, null, 2))\n\n\t\t// Copy files (if any - bundles may have no files, only dependencies)\n\t\tfor (const rawFile of component.files) {\n\t\t\tconst file = normalizeFile(rawFile, component.type)\n\t\t\tconst sourceFilePath = join(sourcePath, \"files\", file.path)\n\t\t\tconst destFilePath = join(componentsDir, component.name, file.path)\n\t\t\tconst destFileDir = dirname(destFilePath)\n\n\t\t\tif (!(await Bun.file(sourceFilePath).exists())) {\n\t\t\t\tvalidationErrors.push(`${component.name}: Source file not found at ${sourceFilePath}`)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tawait mkdir(destFileDir, { recursive: true })\n\t\t\tconst sourceFile = Bun.file(sourceFilePath)\n\t\t\tawait Bun.write(destFilePath, sourceFile)\n\t\t}\n\t}\n\n\t// Fail fast if source files were missing during copy\n\tif (validationErrors.length > 0) {\n\t\tthrow new BuildRegistryError(\n\t\t\t`Build failed with ${validationErrors.length} errors`,\n\t\t\tvalidationErrors,\n\t\t)\n\t}\n\n\t// V2: Generate index.json at the root (no registry version field)\n\tconst index = {\n\t\t$schema: registry.$schema,\n\t\tname: registry.name,\n\t\tversion: registry.version,\n\t\tauthor: registry.author,\n\t\t// Include version requirements for compatibility checking\n\t\t...(registry.opencode && { opencode: registry.opencode }),\n\t\t...(registry.ocx && { ocx: registry.ocx }),\n\t\tcomponents: registry.components.map((c) => ({\n\t\t\tname: c.name,\n\t\t\ttype: c.type,\n\t\t\tdescription: c.description,\n\t\t})),\n\t}\n\n\tawait Bun.write(join(outPath, \"index.json\"), JSON.stringify(index, null, 2))\n\n\t// Generate .well-known/ocx.json for registry discovery\n\tconst wellKnownDir = join(outPath, \".well-known\")\n\tawait mkdir(wellKnownDir, { recursive: true })\n\tconst discovery = { registry: \"/index.json\" }\n\tawait Bun.write(join(wellKnownDir, \"ocx.json\"), JSON.stringify(discovery, null, 2))\n\n\treturn {\n\t\tcomponentsCount: registry.components.length,\n\t\toutputPath: outPath,\n\t}\n}\n",
69
- "/**\n * JSON output utilities for CI/CD integration\n * Following GitHub CLI patterns for consistent --json flag handling\n */\n\nimport type { ErrorCode } from \"./errors\"\n\n// JSON response envelope\nexport interface JsonResponse<T = unknown> {\n\tsuccess: boolean\n\tdata?: T\n\terror?: {\n\t\tcode: ErrorCode\n\t\tmessage: string\n\t}\n\tmeta?: {\n\t\ttimestamp: string\n\t\tversion: string\n\t}\n}\n\n/**\n * Output data as JSON\n */\nexport function outputJson(data: unknown): void {\n\tconsole.log(JSON.stringify(data, null, 2))\n}\n",
70
- "/**\n * Shared CLI Options Factory\n *\n * Reusable option definitions for consistent command interfaces.\n * Use these factories instead of defining options inline to ensure\n * consistency across commands.\n */\n\nimport { Option } from \"commander\"\nimport { InvalidProfileNameError } from \"./errors\"\n\n// =============================================================================\n// OPTION FACTORIES\n// =============================================================================\n\n/**\n * Shared CLI option factories for consistent command interfaces.\n * Use these instead of defining options inline to ensure consistency.\n */\nexport const sharedOptions = {\n\t/** Working directory option */\n\tcwd: () => new Option(\"--cwd <path>\", \"Working directory\").default(process.cwd()),\n\n\t/** Suppress non-essential output */\n\tquiet: () => new Option(\"-q, --quiet\", \"Suppress output\"),\n\n\t/** Output as JSON */\n\tjson: () => new Option(\"--json\", \"Output as JSON\"),\n\n\t/** Target a specific profile's config */\n\tprofile: () => new Option(\"-p, --profile <name>\", \"Target a specific profile's config\"),\n\n\t/** Verbose output */\n\tverbose: () => new Option(\"-v, --verbose\", \"Verbose output\"),\n\n\t/** Install to global OpenCode config */\n\tglobal: new Option(\"-g, --global\", \"Install to global OpenCode config (~/.config/opencode)\"),\n}\n\n// =============================================================================\n// HELPER FUNCTIONS\n// =============================================================================\n\n/**\n * Add common options (cwd, quiet, json) to a command.\n *\n * @example\n * ```typescript\n * const cmd = program.command(\"my-command\")\n * addCommonOptions(cmd)\n * .option(\"--custom\", \"Custom option\")\n * .action(handler)\n * ```\n */\nexport function addCommonOptions<T extends { addOption: (opt: Option) => T }>(cmd: T): T {\n\treturn cmd\n\t\t.addOption(sharedOptions.cwd())\n\t\t.addOption(sharedOptions.quiet())\n\t\t.addOption(sharedOptions.json())\n}\n\n/**\n * Add verbose option to a command.\n *\n * @example\n * ```typescript\n * const cmd = program.command(\"debug\")\n * addVerboseOption(cmd)\n * .action(handler)\n * ```\n */\nexport function addVerboseOption<T extends { addOption: (opt: Option) => T }>(cmd: T): T {\n\treturn cmd.addOption(sharedOptions.verbose())\n}\n\n/**\n * Adds the --global option to a command.\n */\nexport function addGlobalOption<T extends { addOption: (opt: Option) => T }>(cmd: T): T {\n\treturn cmd.addOption(sharedOptions.global)\n}\n\n/**\n * Adds the --profile option to a command.\n */\nexport function addProfileOption<T extends { addOption: (opt: Option) => T }>(cmd: T): T {\n\treturn cmd.addOption(sharedOptions.profile())\n}\n\n// =============================================================================\n// VALIDATION HELPERS\n// =============================================================================\n\n/**\n * Validates a profile name and throws if invalid.\n * Profile names must:\n * - Be non-empty\n * - Be 32 characters or less\n * - Start with a letter\n * - Contain only letters, numbers, dots, underscores, or hyphens\n *\n * @throws InvalidProfileNameError if validation fails\n */\nexport function validateProfileName(name: string): void {\n\tif (!name || name.length === 0) {\n\t\tthrow new InvalidProfileNameError(name, \"cannot be empty\")\n\t}\n\tif (name.length > 32) {\n\t\tthrow new InvalidProfileNameError(name, \"must be 32 characters or less\")\n\t}\n\tif (!/^[a-zA-Z][a-zA-Z0-9._-]*$/.test(name)) {\n\t\tthrow new InvalidProfileNameError(\n\t\t\tname,\n\t\t\t\"must start with a letter and contain only alphanumeric characters, dots, underscores, or hyphens\",\n\t\t)\n\t}\n}\n",
71
- "import process from 'node:process';\nimport chalk from 'chalk';\nimport cliCursor from 'cli-cursor';\nimport cliSpinners from 'cli-spinners';\nimport logSymbols from 'log-symbols';\nimport stripAnsi from 'strip-ansi';\nimport stringWidth from 'string-width';\nimport isInteractive from 'is-interactive';\nimport isUnicodeSupported from 'is-unicode-supported';\nimport stdinDiscarder from 'stdin-discarder';\n\nclass Ora {\n\t#linesToClear = 0;\n\t#isDiscardingStdin = false;\n\t#lineCount = 0;\n\t#frameIndex = -1;\n\t#lastSpinnerFrameTime = 0;\n\t#options;\n\t#spinner;\n\t#stream;\n\t#id;\n\t#initialInterval;\n\t#isEnabled;\n\t#isSilent;\n\t#indent;\n\t#text;\n\t#prefixText;\n\t#suffixText;\n\tcolor;\n\n\tconstructor(options) {\n\t\tif (typeof options === 'string') {\n\t\t\toptions = {\n\t\t\t\ttext: options,\n\t\t\t};\n\t\t}\n\n\t\tthis.#options = {\n\t\t\tcolor: 'cyan',\n\t\t\tstream: process.stderr,\n\t\t\tdiscardStdin: true,\n\t\t\thideCursor: true,\n\t\t\t...options,\n\t\t};\n\n\t\t// Public\n\t\tthis.color = this.#options.color;\n\n\t\t// It's important that these use the public setters.\n\t\tthis.spinner = this.#options.spinner;\n\n\t\tthis.#initialInterval = this.#options.interval;\n\t\tthis.#stream = this.#options.stream;\n\t\tthis.#isEnabled = typeof this.#options.isEnabled === 'boolean' ? this.#options.isEnabled : isInteractive({stream: this.#stream});\n\t\tthis.#isSilent = typeof this.#options.isSilent === 'boolean' ? this.#options.isSilent : false;\n\n\t\t// Set *after* `this.#stream`.\n\t\t// It's important that these use the public setters.\n\t\tthis.text = this.#options.text;\n\t\tthis.prefixText = this.#options.prefixText;\n\t\tthis.suffixText = this.#options.suffixText;\n\t\tthis.indent = this.#options.indent;\n\n\t\tif (process.env.NODE_ENV === 'test') {\n\t\t\tthis._stream = this.#stream;\n\t\t\tthis._isEnabled = this.#isEnabled;\n\n\t\t\tObject.defineProperty(this, '_linesToClear', {\n\t\t\t\tget() {\n\t\t\t\t\treturn this.#linesToClear;\n\t\t\t\t},\n\t\t\t\tset(newValue) {\n\t\t\t\t\tthis.#linesToClear = newValue;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tObject.defineProperty(this, '_frameIndex', {\n\t\t\t\tget() {\n\t\t\t\t\treturn this.#frameIndex;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tObject.defineProperty(this, '_lineCount', {\n\t\t\t\tget() {\n\t\t\t\t\treturn this.#lineCount;\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\tget indent() {\n\t\treturn this.#indent;\n\t}\n\n\tset indent(indent = 0) {\n\t\tif (!(indent >= 0 && Number.isInteger(indent))) {\n\t\t\tthrow new Error('The `indent` option must be an integer from 0 and up');\n\t\t}\n\n\t\tthis.#indent = indent;\n\t\tthis.#updateLineCount();\n\t}\n\n\tget interval() {\n\t\treturn this.#initialInterval ?? this.#spinner.interval ?? 100;\n\t}\n\n\tget spinner() {\n\t\treturn this.#spinner;\n\t}\n\n\tset spinner(spinner) {\n\t\tthis.#frameIndex = -1;\n\t\tthis.#initialInterval = undefined;\n\n\t\tif (typeof spinner === 'object') {\n\t\t\tif (spinner.frames === undefined) {\n\t\t\t\tthrow new Error('The given spinner must have a `frames` property');\n\t\t\t}\n\n\t\t\tthis.#spinner = spinner;\n\t\t} else if (!isUnicodeSupported()) {\n\t\t\tthis.#spinner = cliSpinners.line;\n\t\t} else if (spinner === undefined) {\n\t\t\t// Set default spinner\n\t\t\tthis.#spinner = cliSpinners.dots;\n\t\t} else if (spinner !== 'default' && cliSpinners[spinner]) {\n\t\t\tthis.#spinner = cliSpinners[spinner];\n\t\t} else {\n\t\t\tthrow new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);\n\t\t}\n\t}\n\n\tget text() {\n\t\treturn this.#text;\n\t}\n\n\tset text(value = '') {\n\t\tthis.#text = value;\n\t\tthis.#updateLineCount();\n\t}\n\n\tget prefixText() {\n\t\treturn this.#prefixText;\n\t}\n\n\tset prefixText(value = '') {\n\t\tthis.#prefixText = value;\n\t\tthis.#updateLineCount();\n\t}\n\n\tget suffixText() {\n\t\treturn this.#suffixText;\n\t}\n\n\tset suffixText(value = '') {\n\t\tthis.#suffixText = value;\n\t\tthis.#updateLineCount();\n\t}\n\n\tget isSpinning() {\n\t\treturn this.#id !== undefined;\n\t}\n\n\t#getFullPrefixText(prefixText = this.#prefixText, postfix = ' ') {\n\t\tif (typeof prefixText === 'string' && prefixText !== '') {\n\t\t\treturn prefixText + postfix;\n\t\t}\n\n\t\tif (typeof prefixText === 'function') {\n\t\t\treturn prefixText() + postfix;\n\t\t}\n\n\t\treturn '';\n\t}\n\n\t#getFullSuffixText(suffixText = this.#suffixText, prefix = ' ') {\n\t\tif (typeof suffixText === 'string' && suffixText !== '') {\n\t\t\treturn prefix + suffixText;\n\t\t}\n\n\t\tif (typeof suffixText === 'function') {\n\t\t\treturn prefix + suffixText();\n\t\t}\n\n\t\treturn '';\n\t}\n\n\t#updateLineCount() {\n\t\tconst columns = this.#stream.columns ?? 80;\n\t\tconst fullPrefixText = this.#getFullPrefixText(this.#prefixText, '-');\n\t\tconst fullSuffixText = this.#getFullSuffixText(this.#suffixText, '-');\n\t\tconst fullText = ' '.repeat(this.#indent) + fullPrefixText + '--' + this.#text + '--' + fullSuffixText;\n\n\t\tthis.#lineCount = 0;\n\t\tfor (const line of stripAnsi(fullText).split('\\n')) {\n\t\t\tthis.#lineCount += Math.max(1, Math.ceil(stringWidth(line, {countAnsiEscapeCodes: true}) / columns));\n\t\t}\n\t}\n\n\tget isEnabled() {\n\t\treturn this.#isEnabled && !this.#isSilent;\n\t}\n\n\tset isEnabled(value) {\n\t\tif (typeof value !== 'boolean') {\n\t\t\tthrow new TypeError('The `isEnabled` option must be a boolean');\n\t\t}\n\n\t\tthis.#isEnabled = value;\n\t}\n\n\tget isSilent() {\n\t\treturn this.#isSilent;\n\t}\n\n\tset isSilent(value) {\n\t\tif (typeof value !== 'boolean') {\n\t\t\tthrow new TypeError('The `isSilent` option must be a boolean');\n\t\t}\n\n\t\tthis.#isSilent = value;\n\t}\n\n\tframe() {\n\t\t// Ensure we only update the spinner frame at the wanted interval,\n\t\t// even if the render method is called more often.\n\t\tconst now = Date.now();\n\t\tif (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {\n\t\t\tthis.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;\n\t\t\tthis.#lastSpinnerFrameTime = now;\n\t\t}\n\n\t\tconst {frames} = this.#spinner;\n\t\tlet frame = frames[this.#frameIndex];\n\n\t\tif (this.color) {\n\t\t\tframe = chalk[this.color](frame);\n\t\t}\n\n\t\tconst fullPrefixText = (typeof this.#prefixText === 'string' && this.#prefixText !== '') ? this.#prefixText + ' ' : '';\n\t\tconst fullText = typeof this.text === 'string' ? ' ' + this.text : '';\n\t\tconst fullSuffixText = (typeof this.#suffixText === 'string' && this.#suffixText !== '') ? ' ' + this.#suffixText : '';\n\n\t\treturn fullPrefixText + frame + fullText + fullSuffixText;\n\t}\n\n\tclear() {\n\t\tif (!this.#isEnabled || !this.#stream.isTTY) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.#stream.cursorTo(0);\n\n\t\tfor (let index = 0; index < this.#linesToClear; index++) {\n\t\t\tif (index > 0) {\n\t\t\t\tthis.#stream.moveCursor(0, -1);\n\t\t\t}\n\n\t\t\tthis.#stream.clearLine(1);\n\t\t}\n\n\t\tif (this.#indent || this.lastIndent !== this.#indent) {\n\t\t\tthis.#stream.cursorTo(this.#indent);\n\t\t}\n\n\t\tthis.lastIndent = this.#indent;\n\t\tthis.#linesToClear = 0;\n\n\t\treturn this;\n\t}\n\n\trender() {\n\t\tif (this.#isSilent) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.clear();\n\t\tthis.#stream.write(this.frame());\n\t\tthis.#linesToClear = this.#lineCount;\n\n\t\treturn this;\n\t}\n\n\tstart(text) {\n\t\tif (text) {\n\t\t\tthis.text = text;\n\t\t}\n\n\t\tif (this.#isSilent) {\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!this.#isEnabled) {\n\t\t\tif (this.text) {\n\t\t\t\tthis.#stream.write(`- ${this.text}\\n`);\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (this.isSpinning) {\n\t\t\treturn this;\n\t\t}\n\n\t\tif (this.#options.hideCursor) {\n\t\t\tcliCursor.hide(this.#stream);\n\t\t}\n\n\t\tif (this.#options.discardStdin && process.stdin.isTTY) {\n\t\t\tthis.#isDiscardingStdin = true;\n\t\t\tstdinDiscarder.start();\n\t\t}\n\n\t\tthis.render();\n\t\tthis.#id = setInterval(this.render.bind(this), this.interval);\n\n\t\treturn this;\n\t}\n\n\tstop() {\n\t\tif (!this.#isEnabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tclearInterval(this.#id);\n\t\tthis.#id = undefined;\n\t\tthis.#frameIndex = 0;\n\t\tthis.clear();\n\t\tif (this.#options.hideCursor) {\n\t\t\tcliCursor.show(this.#stream);\n\t\t}\n\n\t\tif (this.#options.discardStdin && process.stdin.isTTY && this.#isDiscardingStdin) {\n\t\t\tstdinDiscarder.stop();\n\t\t\tthis.#isDiscardingStdin = false;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tsucceed(text) {\n\t\treturn this.stopAndPersist({symbol: logSymbols.success, text});\n\t}\n\n\tfail(text) {\n\t\treturn this.stopAndPersist({symbol: logSymbols.error, text});\n\t}\n\n\twarn(text) {\n\t\treturn this.stopAndPersist({symbol: logSymbols.warning, text});\n\t}\n\n\tinfo(text) {\n\t\treturn this.stopAndPersist({symbol: logSymbols.info, text});\n\t}\n\n\tstopAndPersist(options = {}) {\n\t\tif (this.#isSilent) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst prefixText = options.prefixText ?? this.#prefixText;\n\t\tconst fullPrefixText = this.#getFullPrefixText(prefixText, ' ');\n\n\t\tconst symbolText = options.symbol ?? ' ';\n\n\t\tconst text = options.text ?? this.text;\n\t\tconst separatorText = symbolText ? ' ' : '';\n\t\tconst fullText = (typeof text === 'string') ? separatorText + text : '';\n\n\t\tconst suffixText = options.suffixText ?? this.#suffixText;\n\t\tconst fullSuffixText = this.#getFullSuffixText(suffixText, ' ');\n\n\t\tconst textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + '\\n';\n\n\t\tthis.stop();\n\t\tthis.#stream.write(textToWrite);\n\n\t\treturn this;\n\t}\n}\n\nexport default function ora(options) {\n\treturn new Ora(options);\n}\n\nexport async function oraPromise(action, options) {\n\tconst actionIsFunction = typeof action === 'function';\n\tconst actionIsPromise = typeof action.then === 'function';\n\n\tif (!actionIsFunction && !actionIsPromise) {\n\t\tthrow new TypeError('Parameter `action` must be a Function or a Promise');\n\t}\n\n\tconst {successText, failText} = typeof options === 'object'\n\t\t? options\n\t\t: {successText: undefined, failText: undefined};\n\n\tconst spinner = ora(options).start();\n\n\ttry {\n\t\tconst promise = actionIsFunction ? action(spinner) : action;\n\t\tconst result = await promise;\n\n\t\tspinner.succeed(\n\t\t\tsuccessText === undefined\n\t\t\t\t? undefined\n\t\t\t\t: (typeof successText === 'string' ? successText : successText(result)),\n\t\t);\n\n\t\treturn result;\n\t} catch (error) {\n\t\tspinner.fail(\n\t\t\tfailText === undefined\n\t\t\t\t? undefined\n\t\t\t\t: (typeof failText === 'string' ? failText : failText(error)),\n\t\t);\n\n\t\tthrow error;\n\t}\n}\n\nexport {default as spinners} from 'cli-spinners';\n",
72
- "const ANSI_BACKGROUND_OFFSET = 10;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u001B[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u001B[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u001B[${38 + offset};2;${red};${green};${blue}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n",
73
- "import process from 'node:process';\nimport os from 'node:os';\nimport tty from 'node:tty';\n\n// From: https://github.com/sindresorhus/has-flag/blob/main/index.js\n/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {\nfunction hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n}\n\nconst {env} = process;\n\nlet flagForceColor;\nif (\n\thasFlag('no-color')\n\t|| hasFlag('no-colors')\n\t|| hasFlag('color=false')\n\t|| hasFlag('color=never')\n) {\n\tflagForceColor = 0;\n} else if (\n\thasFlag('color')\n\t|| hasFlag('colors')\n\t|| hasFlag('color=true')\n\t|| hasFlag('color=always')\n) {\n\tflagForceColor = 1;\n}\n\nfunction envForceColor() {\n\tif ('FORCE_COLOR' in env) {\n\t\tif (env.FORCE_COLOR === 'true') {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (env.FORCE_COLOR === 'false') {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3,\n\t};\n}\n\nfunction _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {\n\tconst noFlagForceColor = envForceColor();\n\tif (noFlagForceColor !== undefined) {\n\t\tflagForceColor = noFlagForceColor;\n\t}\n\n\tconst forceColor = sniffFlags ? flagForceColor : noFlagForceColor;\n\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (sniffFlags) {\n\t\tif (hasFlag('color=16m')\n\t\t\t|| hasFlag('color=full')\n\t\t\t|| hasFlag('color=truecolor')) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (hasFlag('color=256')) {\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t// Check for Azure DevOps pipelines.\n\t// Has to be above the `!streamIsTTY` check.\n\tif ('TF_BUILD' in env && 'AGENT_NAME' in env) {\n\t\treturn 1;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10\n\t\t\t&& Number(osRelease[2]) >= 10_586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14_931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-kitty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-ghostty') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'wezterm') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app': {\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\t}\n\n\t\t\tcase 'Apple_Terminal': {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nexport function createSupportsColor(stream, options = {}) {\n\tconst level = _supportsColor(stream, {\n\t\tstreamIsTTY: stream && stream.isTTY,\n\t\t...options,\n\t});\n\n\treturn translateLevel(level);\n}\n\nconst supportsColor = {\n\tstdout: createSupportsColor({isTTY: tty.isatty(1)}),\n\tstderr: createSupportsColor({isTTY: tty.isatty(2)}),\n};\n\nexport default supportsColor;\n",
74
- "// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.\nexport function stringReplaceAll(string, substring, replacer) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n",
75
- "import ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\nimport { // eslint-disable-line import/order\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m',\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\nconst getModelAnsi = (model, level, type, ...arguments_) => {\n\tif (model === 'rgb') {\n\t\tif (level === 'ansi16m') {\n\t\t\treturn ansiStyles[type].ansi16m(...arguments_);\n\t\t}\n\n\t\tif (level === 'ansi256') {\n\t\t\treturn ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));\n\t\t}\n\n\t\treturn ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));\n\t}\n\n\tif (model === 'hex') {\n\t\treturn getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));\n\t}\n\n\treturn ansiStyles[type][model](...arguments_);\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this[GENERATOR].level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis[GENERATOR].level = level;\n\t\t},\n\t},\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\t// eslint-disable-next-line no-implicit-coercion\n\tconst builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder[GENERATOR] = self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u001B')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nObject.defineProperties(createChalk.prototype, styles);\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n",
76
- "import process from 'node:process';\nimport restoreCursor from 'restore-cursor';\n\nlet isHidden = false;\n\nconst cliCursor = {};\n\ncliCursor.show = (writableStream = process.stderr) => {\n\tif (!writableStream.isTTY) {\n\t\treturn;\n\t}\n\n\tisHidden = false;\n\twritableStream.write('\\u001B[?25h');\n};\n\ncliCursor.hide = (writableStream = process.stderr) => {\n\tif (!writableStream.isTTY) {\n\t\treturn;\n\t}\n\n\trestoreCursor();\n\tisHidden = true;\n\twritableStream.write('\\u001B[?25l');\n};\n\ncliCursor.toggle = (force, writableStream) => {\n\tif (force !== undefined) {\n\t\tisHidden = force;\n\t}\n\n\tif (isHidden) {\n\t\tcliCursor.show(writableStream);\n\t} else {\n\t\tcliCursor.hide(writableStream);\n\t}\n};\n\nexport default cliCursor;\n",
77
- "import process from 'node:process';\nimport onetime from 'onetime';\nimport {onExit} from 'signal-exit';\n\nconst terminal = process.stderr.isTTY\n\t? process.stderr\n\t: (process.stdout.isTTY ? process.stdout : undefined);\n\nconst restoreCursor = terminal ? onetime(() => {\n\tonExit(() => {\n\t\tterminal.write('\\u001B[?25h');\n\t}, {alwaysLast: true});\n}) : () => {};\n\nexport default restoreCursor;\n",
78
- "const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable\n\t\t&& toDescriptor.enumerable === fromDescriptor.enumerable\n\t\t&& toDescriptor.configurable === fromDescriptor.configurable\n\t\t&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tconst {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.\n\tObject.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n",
79
- "import mimicFunction from 'mimic-function';\n\nconst calledFunctions = new WeakMap();\n\nconst onetime = (function_, options = {}) => {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError('Expected a function');\n\t}\n\n\tlet returnValue;\n\tlet callCount = 0;\n\tconst functionName = function_.displayName || function_.name || '<anonymous>';\n\n\tconst onetime = function (...arguments_) {\n\t\tcalledFunctions.set(onetime, ++callCount);\n\n\t\tif (callCount === 1) {\n\t\t\treturnValue = function_.apply(this, arguments_);\n\t\t\tfunction_ = undefined;\n\t\t} else if (options.throw === true) {\n\t\t\tthrow new Error(`Function \\`${functionName}\\` can only be called once`);\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tmimicFunction(onetime, function_);\n\tcalledFunctions.set(onetime, callCount);\n\n\treturn onetime;\n};\n\nonetime.callCount = function_ => {\n\tif (!calledFunctions.has(function_)) {\n\t\tthrow new Error(`The given function \\`${function_.name}\\` is not wrapped by the \\`onetime\\` package`);\n\t}\n\n\treturn calledFunctions.get(function_);\n};\n\nexport default onetime;\n",
80
- "/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals = [];\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM');\nif (process.platform !== 'win32') {\n signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n );\n}\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');\n}\n//# sourceMappingURL=signals.js.map",
81
- "// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js';\nexport { signals };\nconst processOk = (process) => !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function';\nconst kExitEmitter = Symbol.for('signal-exit emitter');\nconst global = globalThis;\nconst ObjectDefineProperty = Object.defineProperty.bind(Object);\n// teeny special purpose ee\nclass Emitter {\n emitted = {\n afterExit: false,\n exit: false,\n };\n listeners = {\n afterExit: [],\n exit: [],\n };\n count = 0;\n id = Math.random();\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter];\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n }\n on(ev, fn) {\n this.listeners[ev].push(fn);\n }\n removeListener(ev, fn) {\n const list = this.listeners[ev];\n const i = list.indexOf(fn);\n /* c8 ignore start */\n if (i === -1) {\n return;\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0;\n }\n else {\n list.splice(i, 1);\n }\n }\n emit(ev, code, signal) {\n if (this.emitted[ev]) {\n return false;\n }\n this.emitted[ev] = true;\n let ret = false;\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret;\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret;\n }\n return ret;\n }\n}\nclass SignalExitBase {\n}\nconst signalExitWrap = (handler) => {\n return {\n onExit(cb, opts) {\n return handler.onExit(cb, opts);\n },\n load() {\n return handler.load();\n },\n unload() {\n return handler.unload();\n },\n };\n};\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => { };\n }\n load() { }\n unload() { }\n}\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';\n /* c8 ignore stop */\n #emitter = new Emitter();\n #process;\n #originalProcessEmit;\n #originalProcessReallyExit;\n #sigListeners = {};\n #loaded = false;\n constructor(process) {\n super();\n this.#process = process;\n // { <signal>: <listener fn>, ... }\n this.#sigListeners = {};\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig);\n let { count } = this.#emitter;\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process;\n if (typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number') {\n count += p.__signal_exit_emitter__.count;\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload();\n const ret = this.#emitter.emit('exit', null, sig);\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig;\n if (!ret)\n process.kill(process.pid, s);\n /* c8 ignore stop */\n }\n };\n }\n this.#originalProcessReallyExit = process.reallyExit;\n this.#originalProcessEmit = process.emit;\n }\n onExit(cb, opts) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => { };\n }\n /* c8 ignore stop */\n if (this.#loaded === false) {\n this.load();\n }\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit';\n this.#emitter.on(ev, cb);\n return () => {\n this.#emitter.removeListener(ev, cb);\n if (this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0) {\n this.unload();\n }\n };\n }\n load() {\n if (this.#loaded) {\n return;\n }\n this.#loaded = true;\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1;\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig];\n if (fn)\n this.#process.on(sig, fn);\n }\n catch (_) { }\n }\n this.#process.emit = (ev, ...a) => {\n return this.#processEmit(ev, ...a);\n };\n this.#process.reallyExit = (code) => {\n return this.#processReallyExit(code);\n };\n }\n unload() {\n if (!this.#loaded) {\n return;\n }\n this.#loaded = false;\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig];\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig);\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener);\n /* c8 ignore start */\n }\n catch (_) { }\n /* c8 ignore stop */\n });\n this.#process.emit = this.#originalProcessEmit;\n this.#process.reallyExit = this.#originalProcessReallyExit;\n this.#emitter.count -= 1;\n }\n #processReallyExit(code) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0;\n }\n this.#process.exitCode = code || 0;\n /* c8 ignore stop */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);\n }\n #processEmit(ev, ...args) {\n const og = this.#originalProcessEmit;\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0];\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args);\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n /* c8 ignore stop */\n return ret;\n }\n else {\n return og.call(this.#process, ev, ...args);\n }\n }\n}\nconst process = globalThis.process;\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const { \n/**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\nonExit, \n/**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nload, \n/**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nunload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback());\n//# sourceMappingURL=index.js.map",
82
- "import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tif (process.platform !== 'win32') {\n\t\treturn process.env.TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(process.env.CI)\n\t\t|| Boolean(process.env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| process.env.TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| process.env.TERM_PROGRAM === 'vscode'\n\t\t|| process.env.TERM === 'xterm-256color'\n\t\t|| process.env.TERM === 'alacritty'\n\t\t|| process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n",
83
- "import chalk from 'chalk';\nimport isUnicodeSupported from 'is-unicode-supported';\n\nconst main = {\n\tinfo: chalk.blue('ℹ'),\n\tsuccess: chalk.green('✔'),\n\twarning: chalk.yellow('⚠'),\n\terror: chalk.red('✖'),\n};\n\nconst fallback = {\n\tinfo: chalk.blue('i'),\n\tsuccess: chalk.green('√'),\n\twarning: chalk.yellow('‼'),\n\terror: chalk.red('×'),\n};\n\nconst logSymbols = isUnicodeSupported() ? main : fallback;\n\nexport default logSymbols;\n",
84
- "export default function ansiRegex({onlyFirst = false} = {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]';\n\n\tconst pattern = `${osc}|${csi}`;\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n",
85
- "import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n",
86
- "// Generated code.\n\nfunction isAmbiguous(x) {\n\treturn x === 0xA1\n\t\t|| x === 0xA4\n\t\t|| x === 0xA7\n\t\t|| x === 0xA8\n\t\t|| x === 0xAA\n\t\t|| x === 0xAD\n\t\t|| x === 0xAE\n\t\t|| x >= 0xB0 && x <= 0xB4\n\t\t|| x >= 0xB6 && x <= 0xBA\n\t\t|| x >= 0xBC && x <= 0xBF\n\t\t|| x === 0xC6\n\t\t|| x === 0xD0\n\t\t|| x === 0xD7\n\t\t|| x === 0xD8\n\t\t|| x >= 0xDE && x <= 0xE1\n\t\t|| x === 0xE6\n\t\t|| x >= 0xE8 && x <= 0xEA\n\t\t|| x === 0xEC\n\t\t|| x === 0xED\n\t\t|| x === 0xF0\n\t\t|| x === 0xF2\n\t\t|| x === 0xF3\n\t\t|| x >= 0xF7 && x <= 0xFA\n\t\t|| x === 0xFC\n\t\t|| x === 0xFE\n\t\t|| x === 0x101\n\t\t|| x === 0x111\n\t\t|| x === 0x113\n\t\t|| x === 0x11B\n\t\t|| x === 0x126\n\t\t|| x === 0x127\n\t\t|| x === 0x12B\n\t\t|| x >= 0x131 && x <= 0x133\n\t\t|| x === 0x138\n\t\t|| x >= 0x13F && x <= 0x142\n\t\t|| x === 0x144\n\t\t|| x >= 0x148 && x <= 0x14B\n\t\t|| x === 0x14D\n\t\t|| x === 0x152\n\t\t|| x === 0x153\n\t\t|| x === 0x166\n\t\t|| x === 0x167\n\t\t|| x === 0x16B\n\t\t|| x === 0x1CE\n\t\t|| x === 0x1D0\n\t\t|| x === 0x1D2\n\t\t|| x === 0x1D4\n\t\t|| x === 0x1D6\n\t\t|| x === 0x1D8\n\t\t|| x === 0x1DA\n\t\t|| x === 0x1DC\n\t\t|| x === 0x251\n\t\t|| x === 0x261\n\t\t|| x === 0x2C4\n\t\t|| x === 0x2C7\n\t\t|| x >= 0x2C9 && x <= 0x2CB\n\t\t|| x === 0x2CD\n\t\t|| x === 0x2D0\n\t\t|| x >= 0x2D8 && x <= 0x2DB\n\t\t|| x === 0x2DD\n\t\t|| x === 0x2DF\n\t\t|| x >= 0x300 && x <= 0x36F\n\t\t|| x >= 0x391 && x <= 0x3A1\n\t\t|| x >= 0x3A3 && x <= 0x3A9\n\t\t|| x >= 0x3B1 && x <= 0x3C1\n\t\t|| x >= 0x3C3 && x <= 0x3C9\n\t\t|| x === 0x401\n\t\t|| x >= 0x410 && x <= 0x44F\n\t\t|| x === 0x451\n\t\t|| x === 0x2010\n\t\t|| x >= 0x2013 && x <= 0x2016\n\t\t|| x === 0x2018\n\t\t|| x === 0x2019\n\t\t|| x === 0x201C\n\t\t|| x === 0x201D\n\t\t|| x >= 0x2020 && x <= 0x2022\n\t\t|| x >= 0x2024 && x <= 0x2027\n\t\t|| x === 0x2030\n\t\t|| x === 0x2032\n\t\t|| x === 0x2033\n\t\t|| x === 0x2035\n\t\t|| x === 0x203B\n\t\t|| x === 0x203E\n\t\t|| x === 0x2074\n\t\t|| x === 0x207F\n\t\t|| x >= 0x2081 && x <= 0x2084\n\t\t|| x === 0x20AC\n\t\t|| x === 0x2103\n\t\t|| x === 0x2105\n\t\t|| x === 0x2109\n\t\t|| x === 0x2113\n\t\t|| x === 0x2116\n\t\t|| x === 0x2121\n\t\t|| x === 0x2122\n\t\t|| x === 0x2126\n\t\t|| x === 0x212B\n\t\t|| x === 0x2153\n\t\t|| x === 0x2154\n\t\t|| x >= 0x215B && x <= 0x215E\n\t\t|| x >= 0x2160 && x <= 0x216B\n\t\t|| x >= 0x2170 && x <= 0x2179\n\t\t|| x === 0x2189\n\t\t|| x >= 0x2190 && x <= 0x2199\n\t\t|| x === 0x21B8\n\t\t|| x === 0x21B9\n\t\t|| x === 0x21D2\n\t\t|| x === 0x21D4\n\t\t|| x === 0x21E7\n\t\t|| x === 0x2200\n\t\t|| x === 0x2202\n\t\t|| x === 0x2203\n\t\t|| x === 0x2207\n\t\t|| x === 0x2208\n\t\t|| x === 0x220B\n\t\t|| x === 0x220F\n\t\t|| x === 0x2211\n\t\t|| x === 0x2215\n\t\t|| x === 0x221A\n\t\t|| x >= 0x221D && x <= 0x2220\n\t\t|| x === 0x2223\n\t\t|| x === 0x2225\n\t\t|| x >= 0x2227 && x <= 0x222C\n\t\t|| x === 0x222E\n\t\t|| x >= 0x2234 && x <= 0x2237\n\t\t|| x === 0x223C\n\t\t|| x === 0x223D\n\t\t|| x === 0x2248\n\t\t|| x === 0x224C\n\t\t|| x === 0x2252\n\t\t|| x === 0x2260\n\t\t|| x === 0x2261\n\t\t|| x >= 0x2264 && x <= 0x2267\n\t\t|| x === 0x226A\n\t\t|| x === 0x226B\n\t\t|| x === 0x226E\n\t\t|| x === 0x226F\n\t\t|| x === 0x2282\n\t\t|| x === 0x2283\n\t\t|| x === 0x2286\n\t\t|| x === 0x2287\n\t\t|| x === 0x2295\n\t\t|| x === 0x2299\n\t\t|| x === 0x22A5\n\t\t|| x === 0x22BF\n\t\t|| x === 0x2312\n\t\t|| x >= 0x2460 && x <= 0x24E9\n\t\t|| x >= 0x24EB && x <= 0x254B\n\t\t|| x >= 0x2550 && x <= 0x2573\n\t\t|| x >= 0x2580 && x <= 0x258F\n\t\t|| x >= 0x2592 && x <= 0x2595\n\t\t|| x === 0x25A0\n\t\t|| x === 0x25A1\n\t\t|| x >= 0x25A3 && x <= 0x25A9\n\t\t|| x === 0x25B2\n\t\t|| x === 0x25B3\n\t\t|| x === 0x25B6\n\t\t|| x === 0x25B7\n\t\t|| x === 0x25BC\n\t\t|| x === 0x25BD\n\t\t|| x === 0x25C0\n\t\t|| x === 0x25C1\n\t\t|| x >= 0x25C6 && x <= 0x25C8\n\t\t|| x === 0x25CB\n\t\t|| x >= 0x25CE && x <= 0x25D1\n\t\t|| x >= 0x25E2 && x <= 0x25E5\n\t\t|| x === 0x25EF\n\t\t|| x === 0x2605\n\t\t|| x === 0x2606\n\t\t|| x === 0x2609\n\t\t|| x === 0x260E\n\t\t|| x === 0x260F\n\t\t|| x === 0x261C\n\t\t|| x === 0x261E\n\t\t|| x === 0x2640\n\t\t|| x === 0x2642\n\t\t|| x === 0x2660\n\t\t|| x === 0x2661\n\t\t|| x >= 0x2663 && x <= 0x2665\n\t\t|| x >= 0x2667 && x <= 0x266A\n\t\t|| x === 0x266C\n\t\t|| x === 0x266D\n\t\t|| x === 0x266F\n\t\t|| x === 0x269E\n\t\t|| x === 0x269F\n\t\t|| x === 0x26BF\n\t\t|| x >= 0x26C6 && x <= 0x26CD\n\t\t|| x >= 0x26CF && x <= 0x26D3\n\t\t|| x >= 0x26D5 && x <= 0x26E1\n\t\t|| x === 0x26E3\n\t\t|| x === 0x26E8\n\t\t|| x === 0x26E9\n\t\t|| x >= 0x26EB && x <= 0x26F1\n\t\t|| x === 0x26F4\n\t\t|| x >= 0x26F6 && x <= 0x26F9\n\t\t|| x === 0x26FB\n\t\t|| x === 0x26FC\n\t\t|| x === 0x26FE\n\t\t|| x === 0x26FF\n\t\t|| x === 0x273D\n\t\t|| x >= 0x2776 && x <= 0x277F\n\t\t|| x >= 0x2B56 && x <= 0x2B59\n\t\t|| x >= 0x3248 && x <= 0x324F\n\t\t|| x >= 0xE000 && x <= 0xF8FF\n\t\t|| x >= 0xFE00 && x <= 0xFE0F\n\t\t|| x === 0xFFFD\n\t\t|| x >= 0x1F100 && x <= 0x1F10A\n\t\t|| x >= 0x1F110 && x <= 0x1F12D\n\t\t|| x >= 0x1F130 && x <= 0x1F169\n\t\t|| x >= 0x1F170 && x <= 0x1F18D\n\t\t|| x === 0x1F18F\n\t\t|| x === 0x1F190\n\t\t|| x >= 0x1F19B && x <= 0x1F1AC\n\t\t|| x >= 0xE0100 && x <= 0xE01EF\n\t\t|| x >= 0xF0000 && x <= 0xFFFFD\n\t\t|| x >= 0x100000 && x <= 0x10FFFD;\n}\n\nfunction isFullWidth(x) {\n\treturn x === 0x3000\n\t\t|| x >= 0xFF01 && x <= 0xFF60\n\t\t|| x >= 0xFFE0 && x <= 0xFFE6;\n}\n\nfunction isWide(x) {\n\treturn x >= 0x1100 && x <= 0x115F\n\t\t|| x === 0x231A\n\t\t|| x === 0x231B\n\t\t|| x === 0x2329\n\t\t|| x === 0x232A\n\t\t|| x >= 0x23E9 && x <= 0x23EC\n\t\t|| x === 0x23F0\n\t\t|| x === 0x23F3\n\t\t|| x === 0x25FD\n\t\t|| x === 0x25FE\n\t\t|| x === 0x2614\n\t\t|| x === 0x2615\n\t\t|| x >= 0x2630 && x <= 0x2637\n\t\t|| x >= 0x2648 && x <= 0x2653\n\t\t|| x === 0x267F\n\t\t|| x >= 0x268A && x <= 0x268F\n\t\t|| x === 0x2693\n\t\t|| x === 0x26A1\n\t\t|| x === 0x26AA\n\t\t|| x === 0x26AB\n\t\t|| x === 0x26BD\n\t\t|| x === 0x26BE\n\t\t|| x === 0x26C4\n\t\t|| x === 0x26C5\n\t\t|| x === 0x26CE\n\t\t|| x === 0x26D4\n\t\t|| x === 0x26EA\n\t\t|| x === 0x26F2\n\t\t|| x === 0x26F3\n\t\t|| x === 0x26F5\n\t\t|| x === 0x26FA\n\t\t|| x === 0x26FD\n\t\t|| x === 0x2705\n\t\t|| x === 0x270A\n\t\t|| x === 0x270B\n\t\t|| x === 0x2728\n\t\t|| x === 0x274C\n\t\t|| x === 0x274E\n\t\t|| x >= 0x2753 && x <= 0x2755\n\t\t|| x === 0x2757\n\t\t|| x >= 0x2795 && x <= 0x2797\n\t\t|| x === 0x27B0\n\t\t|| x === 0x27BF\n\t\t|| x === 0x2B1B\n\t\t|| x === 0x2B1C\n\t\t|| x === 0x2B50\n\t\t|| x === 0x2B55\n\t\t|| x >= 0x2E80 && x <= 0x2E99\n\t\t|| x >= 0x2E9B && x <= 0x2EF3\n\t\t|| x >= 0x2F00 && x <= 0x2FD5\n\t\t|| x >= 0x2FF0 && x <= 0x2FFF\n\t\t|| x >= 0x3001 && x <= 0x303E\n\t\t|| x >= 0x3041 && x <= 0x3096\n\t\t|| x >= 0x3099 && x <= 0x30FF\n\t\t|| x >= 0x3105 && x <= 0x312F\n\t\t|| x >= 0x3131 && x <= 0x318E\n\t\t|| x >= 0x3190 && x <= 0x31E5\n\t\t|| x >= 0x31EF && x <= 0x321E\n\t\t|| x >= 0x3220 && x <= 0x3247\n\t\t|| x >= 0x3250 && x <= 0xA48C\n\t\t|| x >= 0xA490 && x <= 0xA4C6\n\t\t|| x >= 0xA960 && x <= 0xA97C\n\t\t|| x >= 0xAC00 && x <= 0xD7A3\n\t\t|| x >= 0xF900 && x <= 0xFAFF\n\t\t|| x >= 0xFE10 && x <= 0xFE19\n\t\t|| x >= 0xFE30 && x <= 0xFE52\n\t\t|| x >= 0xFE54 && x <= 0xFE66\n\t\t|| x >= 0xFE68 && x <= 0xFE6B\n\t\t|| x >= 0x16FE0 && x <= 0x16FE4\n\t\t|| x >= 0x16FF0 && x <= 0x16FF6\n\t\t|| x >= 0x17000 && x <= 0x18CD5\n\t\t|| x >= 0x18CFF && x <= 0x18D1E\n\t\t|| x >= 0x18D80 && x <= 0x18DF2\n\t\t|| x >= 0x1AFF0 && x <= 0x1AFF3\n\t\t|| x >= 0x1AFF5 && x <= 0x1AFFB\n\t\t|| x === 0x1AFFD\n\t\t|| x === 0x1AFFE\n\t\t|| x >= 0x1B000 && x <= 0x1B122\n\t\t|| x === 0x1B132\n\t\t|| x >= 0x1B150 && x <= 0x1B152\n\t\t|| x === 0x1B155\n\t\t|| x >= 0x1B164 && x <= 0x1B167\n\t\t|| x >= 0x1B170 && x <= 0x1B2FB\n\t\t|| x >= 0x1D300 && x <= 0x1D356\n\t\t|| x >= 0x1D360 && x <= 0x1D376\n\t\t|| x === 0x1F004\n\t\t|| x === 0x1F0CF\n\t\t|| x === 0x1F18E\n\t\t|| x >= 0x1F191 && x <= 0x1F19A\n\t\t|| x >= 0x1F200 && x <= 0x1F202\n\t\t|| x >= 0x1F210 && x <= 0x1F23B\n\t\t|| x >= 0x1F240 && x <= 0x1F248\n\t\t|| x === 0x1F250\n\t\t|| x === 0x1F251\n\t\t|| x >= 0x1F260 && x <= 0x1F265\n\t\t|| x >= 0x1F300 && x <= 0x1F320\n\t\t|| x >= 0x1F32D && x <= 0x1F335\n\t\t|| x >= 0x1F337 && x <= 0x1F37C\n\t\t|| x >= 0x1F37E && x <= 0x1F393\n\t\t|| x >= 0x1F3A0 && x <= 0x1F3CA\n\t\t|| x >= 0x1F3CF && x <= 0x1F3D3\n\t\t|| x >= 0x1F3E0 && x <= 0x1F3F0\n\t\t|| x === 0x1F3F4\n\t\t|| x >= 0x1F3F8 && x <= 0x1F43E\n\t\t|| x === 0x1F440\n\t\t|| x >= 0x1F442 && x <= 0x1F4FC\n\t\t|| x >= 0x1F4FF && x <= 0x1F53D\n\t\t|| x >= 0x1F54B && x <= 0x1F54E\n\t\t|| x >= 0x1F550 && x <= 0x1F567\n\t\t|| x === 0x1F57A\n\t\t|| x === 0x1F595\n\t\t|| x === 0x1F596\n\t\t|| x === 0x1F5A4\n\t\t|| x >= 0x1F5FB && x <= 0x1F64F\n\t\t|| x >= 0x1F680 && x <= 0x1F6C5\n\t\t|| x === 0x1F6CC\n\t\t|| x >= 0x1F6D0 && x <= 0x1F6D2\n\t\t|| x >= 0x1F6D5 && x <= 0x1F6D8\n\t\t|| x >= 0x1F6DC && x <= 0x1F6DF\n\t\t|| x === 0x1F6EB\n\t\t|| x === 0x1F6EC\n\t\t|| x >= 0x1F6F4 && x <= 0x1F6FC\n\t\t|| x >= 0x1F7E0 && x <= 0x1F7EB\n\t\t|| x === 0x1F7F0\n\t\t|| x >= 0x1F90C && x <= 0x1F93A\n\t\t|| x >= 0x1F93C && x <= 0x1F945\n\t\t|| x >= 0x1F947 && x <= 0x1F9FF\n\t\t|| x >= 0x1FA70 && x <= 0x1FA7C\n\t\t|| x >= 0x1FA80 && x <= 0x1FA8A\n\t\t|| x >= 0x1FA8E && x <= 0x1FAC6\n\t\t|| x === 0x1FAC8\n\t\t|| x >= 0x1FACD && x <= 0x1FADC\n\t\t|| x >= 0x1FADF && x <= 0x1FAEA\n\t\t|| x >= 0x1FAEF && x <= 0x1FAF8\n\t\t|| x >= 0x20000 && x <= 0x2FFFD\n\t\t|| x >= 0x30000 && x <= 0x3FFFD;\n}\n\nfunction getCategory(x) {\n\tif (isAmbiguous(x)) return 'ambiguous';\n\n\tif (isFullWidth(x)) return 'fullwidth';\n\n\tif (\n\t\tx === 0x20A9\n\t\t|| x >= 0xFF61 && x <= 0xFFBE\n\t\t|| x >= 0xFFC2 && x <= 0xFFC7\n\t\t|| x >= 0xFFCA && x <= 0xFFCF\n\t\t|| x >= 0xFFD2 && x <= 0xFFD7\n\t\t|| x >= 0xFFDA && x <= 0xFFDC\n\t\t|| x >= 0xFFE8 && x <= 0xFFEE\n\t) {\n\t\treturn 'halfwidth';\n\t}\n\n\tif (\n\t\tx >= 0x20 && x <= 0x7E\n\t\t|| x === 0xA2\n\t\t|| x === 0xA3\n\t\t|| x === 0xA5\n\t\t|| x === 0xA6\n\t\t|| x === 0xAC\n\t\t|| x === 0xAF\n\t\t|| x >= 0x27E6 && x <= 0x27ED\n\t\t|| x === 0x2985\n\t\t|| x === 0x2986\n\t) {\n\t\treturn 'narrow';\n\t}\n\n\tif (isWide(x)) return 'wide';\n\n\treturn 'neutral';\n}\n\nexport {isAmbiguous, isFullWidth, isWide, getCategory};\n",
87
- "import {getCategory, isAmbiguous, isFullWidth, isWide} from './lookup.js';\n\nfunction validate(codePoint) {\n\tif (!Number.isSafeInteger(codePoint)) {\n\t\tthrow new TypeError(`Expected a code point, got \\`${typeof codePoint}\\`.`);\n\t}\n}\n\nexport function eastAsianWidthType(codePoint) {\n\tvalidate(codePoint);\n\n\treturn getCategory(codePoint);\n}\n\nexport function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {\n\tvalidate(codePoint);\n\n\tif (\n\t\tisFullWidth(codePoint)\n\t\t|| isWide(codePoint)\n\t\t|| (ambiguousAsWide && isAmbiguous(codePoint))\n\t) {\n\t\treturn 2;\n\t}\n\n\treturn 1;\n}\n\n// Private exports for https://github.com/sindresorhus/is-fullwidth-code-point\nexport {isFullWidth as _isFullWidth, isWide as _isWide} from './lookup.js';\n",
88
- "export default () => {\n\t// https://mths.be/emoji\n\treturn /[#*0-9]\\uFE0F?\\u20E3|[\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u23CF\\u23ED-\\u23EF\\u23F1\\u23F2\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB\\u25FC\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u265F\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267E\\u267F\\u2692\\u2694-\\u2697\\u2699\\u269B\\u269C\\u26A0\\u26A7\\u26AA\\u26B0\\u26B1\\u26BD\\u26BE\\u26C4\\u26C8\\u26CF\\u26D1\\u26E9\\u26F0-\\u26F5\\u26F7\\u26F8\\u26FA\\u2702\\u2708\\u2709\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u27A1\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B55\\u3030\\u303D\\u3297\\u3299]\\uFE0F?|[\\u261D\\u270C\\u270D](?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|[\\u270A\\u270B](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\u23E9-\\u23EC\\u23F0\\u23F3\\u25FD\\u2693\\u26A1\\u26AB\\u26C5\\u26CE\\u26D4\\u26EA\\u26FD\\u2705\\u2728\\u274C\\u274E\\u2753-\\u2755\\u2795-\\u2797\\u27B0\\u27BF\\u2B50]|\\u26D3\\uFE0F?(?:\\u200D\\uD83D\\uDCA5)?|\\u26F9(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\u2764\\uFE0F?(?:\\u200D(?:\\uD83D\\uDD25|\\uD83E\\uDE79))?|\\uD83C(?:[\\uDC04\\uDD70\\uDD71\\uDD7E\\uDD7F\\uDE02\\uDE37\\uDF21\\uDF24-\\uDF2C\\uDF36\\uDF7D\\uDF96\\uDF97\\uDF99-\\uDF9B\\uDF9E\\uDF9F\\uDFCD\\uDFCE\\uDFD4-\\uDFDF\\uDFF5\\uDFF7]\\uFE0F?|[\\uDF85\\uDFC2\\uDFC7](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDFC4\\uDFCA](?:\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDFCB\\uDFCC](?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDCCF\\uDD8E\\uDD91-\\uDD9A\\uDE01\\uDE1A\\uDE2F\\uDE32-\\uDE36\\uDE38-\\uDE3A\\uDE50\\uDE51\\uDF00-\\uDF20\\uDF2D-\\uDF35\\uDF37-\\uDF43\\uDF45-\\uDF4A\\uDF4C-\\uDF7C\\uDF7E-\\uDF84\\uDF86-\\uDF93\\uDFA0-\\uDFC1\\uDFC5\\uDFC6\\uDFC8\\uDFC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DEA4-\\uDEB3\\uDEB7-\\uDEBF\\uDEC1-\\uDEC5\\uDED0-\\uDED2\\uDED5-\\uDED8\\uDEDC-\\uDEDF\\uDEEB\\uDEEC\\uDEF4-\\uDEFC\\uDFE0-\\uDFEB\\uDFF0]|\\uDC08(?:\\u200D\\u2B1B)?|\\uDC15(?:\\u200D\\uD83E\\uDDBA)?|\\uDC26(?:\\u200D(?:\\u2B1B|\\uD83D\\uDD25))?|\\uDC3B(?:\\u200D\\u2744\\uFE0F?)?|\\uDC41\\uFE0F?(?:\\u200D\\uD83D\\uDDE8\\uFE0F?)?|\\uDC68(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDC68\\uDC69]\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFC-\\uDFFF])|\\uD83E(?:[\\uDD1D\\uDEEF]\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFC-\\uDFFF]|[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])|\\uD83E(?:[\\uDD1D\\uDEEF]\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])|\\uD83E(?:[\\uDD1D\\uDEEF]\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])|\\uD83E(?:[\\uDD1D\\uDEEF]\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFE])|\\uD83E(?:[\\uDD1D\\uDEEF]\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFE]|[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3])))?))?|\\uDC69(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?[\\uDC68\\uDC69]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|\\uDC69\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?))|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFC-\\uDFFF])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFC-\\uDFFF]|\\uDEEF\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFC-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|\\uDEEF\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|\\uDEEF\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|\\uDEEF\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB-\\uDFFE])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFE]|\\uDEEF\\u200D\\uD83D\\uDC69\\uD83C[\\uDFFB-\\uDFFE])))?))?|\\uDD75(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uDE2E(?:\\u200D\\uD83D\\uDCA8)?|\\uDE35(?:\\u200D\\uD83D\\uDCAB)?|\\uDE36(?:\\u200D\\uD83C\\uDF2B\\uFE0F?)?|\\uDE42(?:\\u200D[\\u2194\\u2195]\\uFE0F?)?|\\uDEB6(?:\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D(?:[\\u2640\\u2642]\\uFE0F?(?:\\u200D\\u27A1\\uFE0F?)?|\\u27A1\\uFE0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200D\\uD83E\\uDDD2)?|\\uDDD2(?:\\u200D\\uD83E\\uDDD2)?))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3\\uDE70]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|\\uDEEF\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3\\uDE70]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|\\uDEEF\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])))?|\\uDFF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2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFE]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC30\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFE])|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3\\uDE70]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|\\uDEEF\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFE])))?))?|\\uDEF1(?:\\uD83C(?:\\uDFFB(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFC-\\uDFFF])?|\\uDFFC(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])?|\\uDFFD(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])?|\\uDFFE(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])?|\\uDFFF(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB-\\uDFFE])?))?)/g;\n};\n",
89
- "import stripAnsi from 'strip-ansi';\nimport {eastAsianWidth} from 'get-east-asian-width';\nimport emojiRegex from 'emoji-regex';\n\nconst segmenter = new Intl.Segmenter();\n\nconst defaultIgnorableCodePointRegex = /^\\p{Default_Ignorable_Code_Point}$/u;\n\nexport default function stringWidth(string, options = {}) {\n\tif (typeof string !== 'string' || string.length === 0) {\n\t\treturn 0;\n\t}\n\n\tconst {\n\t\tambiguousIsNarrow = true,\n\t\tcountAnsiEscapeCodes = false,\n\t} = options;\n\n\tif (!countAnsiEscapeCodes) {\n\t\tstring = stripAnsi(string);\n\t}\n\n\tif (string.length === 0) {\n\t\treturn 0;\n\t}\n\n\tlet width = 0;\n\tconst eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};\n\n\tfor (const {segment: character} of segmenter.segment(string)) {\n\t\tconst codePoint = character.codePointAt(0);\n\n\t\t// Ignore control characters\n\t\tif (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Ignore zero-width characters\n\t\tif (\n\t\t\t(codePoint >= 0x20_0B && codePoint <= 0x20_0F) // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark\n\t\t\t|| codePoint === 0xFE_FF // Zero-width no-break space\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Ignore combining characters\n\t\tif (\n\t\t\t(codePoint >= 0x3_00 && codePoint <= 0x3_6F) // Combining diacritical marks\n\t\t\t|| (codePoint >= 0x1A_B0 && codePoint <= 0x1A_FF) // Combining diacritical marks extended\n\t\t\t|| (codePoint >= 0x1D_C0 && codePoint <= 0x1D_FF) // Combining diacritical marks supplement\n\t\t\t|| (codePoint >= 0x20_D0 && codePoint <= 0x20_FF) // Combining diacritical marks for symbols\n\t\t\t|| (codePoint >= 0xFE_20 && codePoint <= 0xFE_2F) // Combining half marks\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Ignore surrogate pairs\n\t\tif (codePoint >= 0xD8_00 && codePoint <= 0xDF_FF) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Ignore variation selectors\n\t\tif (codePoint >= 0xFE_00 && codePoint <= 0xFE_0F) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// This covers some of the above cases, but we still keep them for performance reasons.\n\t\tif (defaultIgnorableCodePointRegex.test(character)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// TODO: Use `/\\p{RGI_Emoji}/v` when targeting Node.js 20.\n\t\tif (emojiRegex().test(character)) {\n\t\t\twidth += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\twidth += eastAsianWidth(codePoint, eastAsianWidthOptions);\n\t}\n\n\treturn width;\n}\n",
90
- "export default function isInteractive({stream = process.stdout} = {}) {\n\treturn Boolean(\n\t\tstream && stream.isTTY &&\n\t\tprocess.env.TERM !== 'dumb' &&\n\t\t!('CI' in process.env)\n\t);\n}\n",
91
- "import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tconst {env} = process;\n\tconst {TERM, TERM_PROGRAM} = env;\n\n\tif (process.platform !== 'win32') {\n\t\treturn TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| TERM_PROGRAM === 'vscode'\n\t\t|| TERM === 'xterm-256color'\n\t\t|| TERM === 'alacritty'\n\t\t|| TERM === 'rxvt-unicode'\n\t\t|| TERM === 'rxvt-unicode-256color'\n\t\t|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n",
92
- "import process from 'node:process';\n\nconst ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code\n\nclass StdinDiscarder {\n\t#activeCount = 0;\n\n\tstart() {\n\t\tthis.#activeCount++;\n\n\t\tif (this.#activeCount === 1) {\n\t\t\tthis.#realStart();\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this.#activeCount <= 0) {\n\t\t\tthrow new Error('`stop` called more times than `start`');\n\t\t}\n\n\t\tthis.#activeCount--;\n\n\t\tif (this.#activeCount === 0) {\n\t\t\tthis.#realStop();\n\t\t}\n\t}\n\n\t#realStart() {\n\t\t// No known way to make it work reliably on Windows.\n\t\tif (process.platform === 'win32' || !process.stdin.isTTY) {\n\t\t\treturn;\n\t\t}\n\n\t\tprocess.stdin.setRawMode(true);\n\t\tprocess.stdin.on('data', this.#handleInput);\n\t\tprocess.stdin.resume();\n\t}\n\n\t#realStop() {\n\t\tif (!process.stdin.isTTY) {\n\t\t\treturn;\n\t\t}\n\n\t\tprocess.stdin.off('data', this.#handleInput);\n\t\tprocess.stdin.pause();\n\t\tprocess.stdin.setRawMode(false);\n\t}\n\n\t#handleInput(chunk) {\n\t\t// Allow Ctrl+C to gracefully exit.\n\t\tif (chunk[0] === ASCII_ETX_CODE) {\n\t\t\tprocess.emit('SIGINT');\n\t\t}\n\t}\n}\n\nconst stdinDiscarder = new StdinDiscarder();\n\nexport default stdinDiscarder;\n",
93
- "/**\n * Spinner utility for async operations\n * Uses ora, disabled in CI/non-TTY environments\n */\n\nimport ora, { type Ora } from \"ora\"\nimport { isTTY } from \"./env\"\n\nexport interface SpinnerOptions {\n\ttext: string\n\tquiet?: boolean\n}\n\n/**\n * Create a spinner that works in TTY, falls back gracefully in CI\n */\nexport function createSpinner(options: SpinnerOptions): Ora {\n\tconst shouldSpin = isTTY && !options.quiet\n\n\tconst spinner = ora({\n\t\ttext: options.text,\n\t\tisSilent: !shouldSpin,\n\t})\n\n\treturn spinner\n}\n\n/**\n * Run an async function with a spinner\n */\nexport async function withSpinner<T>(\n\toptions: SpinnerOptions,\n\tfn: (spinner: Ora) => Promise<T>,\n): Promise<T> {\n\tconst spinner = createSpinner(options)\n\tspinner.start()\n\n\ttry {\n\t\tconst result = await fn(spinner)\n\t\tspinner.succeed()\n\t\treturn result\n\t} catch (error) {\n\t\tspinner.fail()\n\t\tthrow error\n\t}\n}\n",
94
- "/**\n * Version Compatibility Utilities\n *\n * Pure functions for checking version compatibility following the 5 Laws:\n * - Law 1 (Early Exit): Check at top of fetch flow\n * - Law 2 (Parse, Don't Validate): Work with typed results\n * - Law 3 (Atomic Predictability): Pure functions, same input = same output\n * - Law 4 (Fail Fast, Fail Loud): Clear warning messages\n * - Law 5 (Intentional Naming): Self-documenting function names\n */\n\nimport kleur from \"kleur\"\nimport { logger } from \"./logger\"\n\n/**\n * Result of a version compatibility check\n */\nexport type CompatResult =\n\t| { compatible: true }\n\t| { compatible: false; required: string; installed: string; type: \"opencode\" | \"ocx\" }\n\n/** Incompatible result from version check */\nexport type IncompatibleResult = Extract<CompatResult, { compatible: false }>\n\n/**\n * Options for collecting compatibility issues\n */\nexport interface CompatCheckOptions {\n\tregistry: { opencode?: string; ocx?: string }\n\tocxVersion: string\n\topencodeVersion?: string\n}\n\n/**\n * Parse a semver string into components.\n * Returns null if invalid (Law 4: explicit failure state).\n *\n * @param v - Version string (e.g., \"1.2.3\" or \"1.2.3-beta.1\")\n * @returns Parsed version or null if invalid\n */\nfunction parseVersion(v: string): { major: number; minor: number; patch: number } | null {\n\tconst [main = \"\"] = v.split(\"-\") // Ignore prerelease for comparison\n\tconst parts = main.split(\".\")\n\tconst major = parseInt(parts[0] ?? \"\", 10)\n\tconst minor = parseInt(parts[1] ?? \"\", 10)\n\tconst patch = parseInt(parts[2] ?? \"\", 10)\n\n\t// Early exit: invalid version components\n\tif (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) {\n\t\treturn null\n\t}\n\n\treturn { major, minor, patch }\n}\n\n/**\n * Compare two semver versions.\n * Returns null if either version is invalid (cannot compare).\n *\n * @param a - First version string (e.g., \"1.2.3\")\n * @param b - Second version string (e.g., \"1.0.0\")\n * @returns Negative if a < b, 0 if equal, positive if a > b, null if invalid\n */\nfunction compareSemver(a: string, b: string): number | null {\n\tconst vA = parseVersion(a)\n\tconst vB = parseVersion(b)\n\n\t// Early exit: can't compare invalid versions\n\tif (!vA || !vB) {\n\t\treturn null\n\t}\n\n\tif (vA.major !== vB.major) return vA.major - vB.major\n\tif (vA.minor !== vB.minor) return vA.minor - vB.minor\n\treturn vA.patch - vB.patch\n}\n\n/**\n * Check if installed version meets minimum requirement.\n * Pure function: same input = same output.\n */\nexport function checkCompatibility(\n\trequiredVersion: string | undefined,\n\tinstalledVersion: string,\n\ttype: \"opencode\" | \"ocx\",\n): CompatResult {\n\t// Early exit: no requirement means compatible\n\tif (!requiredVersion) {\n\t\treturn { compatible: true }\n\t}\n\n\t// Compare versions\n\tconst cmp = compareSemver(installedVersion, requiredVersion)\n\n\t// Early exit: can't compare invalid versions, assume compatible (permissive)\n\tif (cmp === null) {\n\t\treturn { compatible: true }\n\t}\n\n\tif (cmp >= 0) {\n\t\treturn { compatible: true }\n\t}\n\n\treturn {\n\t\tcompatible: false,\n\t\trequired: requiredVersion,\n\t\tinstalled: installedVersion,\n\t\ttype,\n\t}\n}\n\n/**\n * Format a compatibility warning message (pnpm-inspired).\n * WHAT happened, WHY, IMPACT, HOW TO FIX.\n */\nexport function formatCompatWarning(\n\tregistryName: string,\n\tresult: Extract<CompatResult, { compatible: false }>,\n): string {\n\tconst typeLabel = result.type === \"opencode\" ? \"OpenCode\" : \"OCX CLI\"\n\tconst updateCmd =\n\t\tresult.type === \"opencode\" ? \"Update OpenCode to the latest version\" : \"bun update -g ocx\"\n\n\treturn `\n${kleur.yellow().bold(\"⚠ WARN\")} ${kleur.yellow(\"Version compatibility notice\")}\n\n Registry ${kleur.cyan(`\"${registryName}\"`)} requires ${typeLabel} ${kleur.green(result.required)}\n You are running ${typeLabel} ${kleur.red(result.installed)}\n\n This may work fine, but if you encounter issues,\n consider updating: ${kleur.dim(updateCmd)}\n\n To silence: ${kleur.dim(\"--skip-compat-check\")} or set ${kleur.dim('\"skipCompatCheck\": true')} in ocx.jsonc\n`\n}\n\n/**\n * Collect compatibility issues for a registry (PURE).\n * Returns array of incompatible results - empty array means all compatible.\n *\n * @param options - Check options with registry requirements and installed versions\n * @returns Array of incompatible results (empty if all compatible)\n */\nexport function collectCompatIssues(options: CompatCheckOptions): IncompatibleResult[] {\n\tconst { registry, ocxVersion, opencodeVersion } = options\n\tconst issues: IncompatibleResult[] = []\n\n\t// Check OCX CLI version\n\tconst ocxResult = checkCompatibility(registry.ocx, ocxVersion, \"ocx\")\n\tif (!ocxResult.compatible) {\n\t\tissues.push(ocxResult)\n\t}\n\n\t// Check OpenCode version (only if we know it)\n\tif (opencodeVersion) {\n\t\tconst opencodeResult = checkCompatibility(registry.opencode, opencodeVersion, \"opencode\")\n\t\tif (!opencodeResult.compatible) {\n\t\t\tissues.push(opencodeResult)\n\t\t}\n\t}\n\n\treturn issues\n}\n\n/**\n * Print compatibility warnings for collected issues (IMPURE - side effect).\n * Separated from pure collectCompatIssues() following Law 3.\n *\n * @param registryName - Name of the registry for display\n * @param issues - Array of compatibility issues to warn about\n */\nexport function warnCompatIssues(registryName: string, issues: IncompatibleResult[]): void {\n\tfor (const issue of issues) {\n\t\tlogger.log(formatCompatWarning(registryName, issue))\n\t}\n}\n",
95
- "/**\n * npm Registry Utilities\n *\n * Validates and fetches npm package metadata for OpenCode plugin installation.\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Guard clauses at top\n * - Parse Don't Validate: Parse specifiers at boundary into typed structures\n * - Fail Fast: Throw immediately on invalid input\n */\n\nimport { NetworkError, NotFoundError, ValidationError } from \"./errors\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/**\n * Parsed npm specifier from \"npm:package@version\" syntax.\n * Discriminated union type for type-safe handling.\n */\nexport interface NpmSpecifier {\n\ttype: \"npm\"\n\tname: string\n\tversion?: string\n}\n\n/**\n * Minimal npm package metadata from registry.\n * Only includes fields we need.\n */\nexport interface NpmPackageMetadata {\n\tname: string\n\t\"dist-tags\": {\n\t\tlatest: string\n\t}\n\tversions: Record<string, unknown>\n}\n\n/**\n * Version-specific package.json fields from npm registry.\n * Used for plugin validation.\n */\nexport interface NpmPackageVersion {\n\tname: string\n\tversion: string\n\ttype?: string\n\tmain?: string\n\texports?: unknown\n}\n\n/**\n * Result of plugin validation.\n * Contains warnings for soft checks that passed but may indicate issues.\n */\nexport interface PluginValidationResult {\n\tvalid: true\n\twarnings: string[]\n}\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\nconst NPM_REGISTRY_BASE = \"https://registry.npmjs.org\"\nconst NPM_FETCH_TIMEOUT_MS = 30_000\n\n/**\n * npm package name validation rules:\n * - 1-214 characters\n * - Lowercase only\n * - No spaces\n * - Cannot start with . or _\n * - No path traversal sequences\n */\nconst NPM_NAME_REGEX = /^(?:@[a-z0-9][\\w.-]*\\/)?[a-z0-9][\\w.-]*$/\nconst MAX_NAME_LENGTH = 214\n\n// =============================================================================\n// PARSING\n// =============================================================================\n\n/**\n * Sanitize and validate npm package name.\n * @throws ValidationError for invalid names\n */\nfunction validateNpmPackageName(name: string): void {\n\t// Guard: empty name\n\tif (!name) {\n\t\tthrow new ValidationError(\"npm package name cannot be empty\")\n\t}\n\n\t// Guard: too long\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\tthrow new ValidationError(\n\t\t\t`npm package name exceeds maximum length of ${MAX_NAME_LENGTH} characters: \\`${name}\\``,\n\t\t)\n\t}\n\n\t// Guard: path traversal\n\tif (name.includes(\"..\") || name.includes(\"/./\") || name.startsWith(\"./\")) {\n\t\tthrow new ValidationError(`Invalid npm package name - path traversal detected: \\`${name}\\``)\n\t}\n\n\t// Guard: invalid characters (allows scoped packages like @scope/pkg)\n\tif (!NPM_NAME_REGEX.test(name)) {\n\t\tthrow new ValidationError(\n\t\t\t`Invalid npm package name: \\`${name}\\`. ` +\n\t\t\t\t\"Must be lowercase, start with alphanumeric, and contain only letters, numbers, hyphens, dots, or underscores.\",\n\t\t)\n\t}\n}\n\n/**\n * Parse an npm specifier string into a typed structure.\n *\n * Supported formats:\n * - \"npm:lodash\" -> { type: \"npm\", name: \"lodash\" }\n * - \"npm:lodash@4.0.0\" -> { type: \"npm\", name: \"lodash\", version: \"4.0.0\" }\n * - \"npm:@scope/pkg\" -> { type: \"npm\", name: \"@scope/pkg\" }\n * - \"npm:@scope/pkg@1.0.0\" -> { type: \"npm\", name: \"@scope/pkg\", version: \"1.0.0\" }\n *\n * @throws ValidationError if specifier format is invalid\n */\nexport function parseNpmSpecifier(specifier: string): NpmSpecifier {\n\t// Guard: empty input\n\tif (!specifier?.trim()) {\n\t\tthrow new ValidationError(\"npm specifier cannot be empty\")\n\t}\n\n\tconst trimmed = specifier.trim()\n\n\t// Guard: must have npm: prefix\n\tif (!trimmed.startsWith(\"npm:\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Invalid npm specifier: \\`${specifier}\\`. Must start with \\`npm:\\` prefix.`,\n\t\t)\n\t}\n\n\t// Strip npm: prefix\n\tconst remainder = trimmed.slice(4)\n\n\t// Guard: empty after prefix\n\tif (!remainder) {\n\t\tthrow new ValidationError(`Invalid npm specifier: \\`${specifier}\\`. Package name is required.`)\n\t}\n\n\t// Parse package@version using same logic as parseNpmDependency in add.ts\n\tconst lastAt = remainder.lastIndexOf(\"@\")\n\n\t// Handle scoped packages: @scope/pkg or @scope/pkg@version\n\t// If lastAt is 0, it's just @scope/pkg (no version)\n\t// If lastAt > 0 and there's a / before it, need to check if it's the scope @ or version @\n\tlet name: string\n\tlet version: string | undefined\n\n\tif (lastAt > 0) {\n\t\t// Check if @ is part of version or scope\n\t\tconst beforeAt = remainder.slice(0, lastAt)\n\t\tconst afterAt = remainder.slice(lastAt + 1)\n\n\t\t// If beforeAt contains a /, it means we have @scope/pkg@version\n\t\t// If beforeAt doesn't start with @, it's just pkg@version\n\t\tif (beforeAt.includes(\"/\") || !beforeAt.startsWith(\"@\")) {\n\t\t\tname = beforeAt\n\t\t\tversion = afterAt || undefined\n\t\t} else {\n\t\t\t// This is @scope@version which is invalid (missing package name)\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Invalid npm specifier: \\`${specifier}\\`. Scoped packages must have format @scope/pkg.`,\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// No version specified, or it's just @scope/pkg\n\t\tname = remainder\n\t}\n\n\t// Validate the extracted package name\n\tvalidateNpmPackageName(name)\n\n\treturn { type: \"npm\", name, version }\n}\n\n/**\n * Check if a string looks like an npm specifier (starts with \"npm:\")\n */\nexport function isNpmSpecifier(input: string): boolean {\n\treturn input.trim().startsWith(\"npm:\")\n}\n\n// =============================================================================\n// REGISTRY INTERACTION\n// =============================================================================\n\n/**\n * Validate that an npm package exists on the registry.\n *\n * @param packageName - The npm package name (may be scoped like @scope/pkg)\n * @param signal - Optional AbortSignal for request cancellation\n * @returns Package metadata from npm registry\n * @throws NotFoundError if package doesn't exist (404)\n * @throws NetworkError for other fetch failures\n */\nexport async function validateNpmPackage(\n\tpackageName: string,\n\tsignal?: AbortSignal,\n): Promise<NpmPackageMetadata> {\n\t// Guard: validate package name first\n\tvalidateNpmPackageName(packageName)\n\n\t// URL encode scoped packages: @scope/pkg -> @scope%2Fpkg\n\tconst encodedName = packageName.startsWith(\"@\")\n\t\t? `@${encodeURIComponent(packageName.slice(1))}`\n\t\t: encodeURIComponent(packageName)\n\n\tconst url = `${NPM_REGISTRY_BASE}/${encodedName}`\n\n\ttry {\n\t\t// Use provided signal or create a timeout signal\n\t\tconst fetchSignal = signal ?? AbortSignal.timeout(NPM_FETCH_TIMEOUT_MS)\n\n\t\tconst response = await fetch(url, {\n\t\t\tsignal: fetchSignal,\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/json\",\n\t\t\t},\n\t\t})\n\n\t\t// Handle 404 specifically\n\t\tif (response.status === 404) {\n\t\t\tthrow new NotFoundError(`npm package \\`${packageName}\\` not found on registry`)\n\t\t}\n\n\t\t// Handle other errors\n\t\tif (!response.ok) {\n\t\t\tthrow new NetworkError(\n\t\t\t\t`Failed to fetch npm package \\`${packageName}\\`: HTTP ${response.status} ${response.statusText}`,\n\t\t\t)\n\t\t}\n\n\t\tconst data = (await response.json()) as NpmPackageMetadata\n\t\treturn data\n\t} catch (error) {\n\t\t// Re-throw our custom errors\n\t\tif (error instanceof NotFoundError || error instanceof NetworkError) {\n\t\t\tthrow error\n\t\t}\n\n\t\t// Handle abort/timeout\n\t\tif (error instanceof Error && (error.name === \"AbortError\" || error.name === \"TimeoutError\")) {\n\t\t\tthrow new NetworkError(`Request to npm registry timed out for package \\`${packageName}\\``)\n\t\t}\n\n\t\t// Wrap other errors\n\t\tconst message = error instanceof Error ? error.message : String(error)\n\t\tthrow new NetworkError(`Failed to fetch npm package \\`${packageName}\\`: ${message}`)\n\t}\n}\n\n/**\n * Format a plugin entry for opencode.json.\n * Returns the typed format: \"package\" or \"package@version\"\n */\nexport function formatPluginEntry(name: string, version?: string): string {\n\treturn version ? `${name}@${version}` : name\n}\n\n// =============================================================================\n// PLUGIN VALIDATION\n// =============================================================================\n\n/**\n * Validate that a package looks like a valid OpenCode plugin.\n *\n * Required checks (throws ValidationError if not met):\n * - ESM module: package.json must have \"type\": \"module\"\n * - Entry point: must have \"main\" or \"exports\" field\n *\n * Soft checks (returns warnings):\n * - Naming convention: warn if package name doesn't contain \"opencode\"\n *\n * @param packageJson - The package.json data from npm registry (version-specific)\n * @returns Validation result with any warnings\n * @throws ValidationError for hard failures\n */\nexport function validateOpenCodePlugin(packageJson: NpmPackageVersion): PluginValidationResult {\n\tconst warnings: string[] = []\n\n\t// Guard: ESM module check - OpenCode uses Bun ESM imports\n\tif (packageJson.type !== \"module\") {\n\t\tthrow new ValidationError(\n\t\t\t`Package \\`${packageJson.name}\\` is not an ESM module (missing \"type\": \"module\" in package.json)`,\n\t\t)\n\t}\n\n\t// Guard: Entry point check - needs to be importable\n\tconst hasMain = Boolean(packageJson.main)\n\tconst hasExports = packageJson.exports !== undefined\n\tif (!hasMain && !hasExports) {\n\t\tthrow new ValidationError(\n\t\t\t`Package \\`${packageJson.name}\\` has no entry point (missing \"main\" or \"exports\")`,\n\t\t)\n\t}\n\n\t// Soft check: Naming convention hint\n\tif (!packageJson.name.includes(\"opencode\")) {\n\t\twarnings.push(\n\t\t\t`Package name \\`${packageJson.name}\\` doesn't contain \"opencode\" - this may not be an OpenCode plugin`,\n\t\t)\n\t}\n\n\treturn { valid: true, warnings }\n}\n\n/**\n * Fetch version-specific package.json from npm registry.\n *\n * @param packageName - The npm package name\n * @param version - The specific version (or \"latest\" to use dist-tags.latest)\n * @param signal - Optional AbortSignal for request cancellation\n * @returns Version-specific package.json fields\n * @throws NotFoundError if package/version doesn't exist\n * @throws NetworkError for fetch failures\n */\nexport async function fetchPackageVersion(\n\tpackageName: string,\n\tversion?: string,\n\tsignal?: AbortSignal,\n): Promise<NpmPackageVersion> {\n\t// First get package metadata to resolve version\n\tconst metadata = await validateNpmPackage(packageName, signal)\n\n\t// Resolve version: use specified or latest\n\tconst resolvedVersion = version ?? metadata[\"dist-tags\"].latest\n\n\t// Get version-specific data\n\tconst versionData = metadata.versions[resolvedVersion] as NpmPackageVersion | undefined\n\tif (!versionData) {\n\t\tthrow new NotFoundError(\n\t\t\t`Version \\`${resolvedVersion}\\` not found for npm package \\`${packageName}\\``,\n\t\t)\n\t}\n\n\treturn versionData\n}\n\n/**\n * Extract package name from a plugin entry string.\n * Handles: \"lodash\", \"lodash@4.0.0\", \"@scope/pkg\", \"@scope/pkg@1.0.0\"\n */\nexport function extractPackageName(pluginEntry: string): string {\n\tconst trimmed = pluginEntry.trim()\n\tconst lastAt = trimmed.lastIndexOf(\"@\")\n\n\t// If @ is at position 0, it's a scoped package without version\n\tif (lastAt <= 0) {\n\t\treturn trimmed\n\t}\n\n\t// Check if this @ is the version separator or part of scope\n\tconst beforeAt = trimmed.slice(0, lastAt)\n\n\t// If beforeAt contains /, it's @scope/pkg@version\n\t// If beforeAt doesn't start with @, it's pkg@version\n\tif (beforeAt.includes(\"/\") || !beforeAt.startsWith(\"@\")) {\n\t\treturn beforeAt\n\t}\n\n\t// Otherwise it's just @scope/pkg with weird format - return as-is\n\treturn trimmed\n}\n",
96
- "import { ConflictError } from \"./errors\"\n\nexport interface PlannedWrite {\n\tabsolutePath: string\n\trelativePath: string\n\tcontent: Buffer\n\tsource: string\n}\n\n/**\n * Registers an in-flight write target and fails loud on duplicates.\n * Policy: duplicate targets are always rejected, even for identical content.\n */\nexport function registerPlannedWriteOrThrow(\n\tplannedWrites: Map<string, PlannedWrite>,\n\tcandidate: PlannedWrite,\n): void {\n\tconst existing = plannedWrites.get(candidate.absolutePath)\n\tif (!existing) {\n\t\tplannedWrites.set(candidate.absolutePath, candidate)\n\t\treturn\n\t}\n\n\tconst contentRelation = existing.content.equals(candidate.content)\n\t\t? \"identical content\"\n\t\t: \"different content\"\n\n\tthrow new ConflictError(\n\t\t`Intra-batch target collision at \"${candidate.relativePath}\". ` +\n\t\t\t`Both \"${existing.source}\" and \"${candidate.source}\" resolve to this path with ${contentRelation}. ` +\n\t\t\t\"Rename one manifest target so each component writes to a unique path.\",\n\t)\n}\n",
97
- "/**\n * Receipt utilities for V2 component tracking\n *\n * Handles file integrity checking, manual edit detection, and receipt operations.\n */\n\nimport { createHash } from \"node:crypto\"\nimport { existsSync } from \"node:fs\"\nimport { join } from \"node:path\"\nimport type { InstalledComponent } from \"../schemas/config\"\nimport { createCanonicalId, parseCanonicalId } from \"../schemas/config\"\n\n/**\n * Hash file content using SHA-256.\n * Reuses existing hash infrastructure from add.ts and update.ts.\n *\n * @param content - Buffer or string to hash\n * @returns Lowercase hex-encoded SHA256 hash\n */\nexport function hashContent(content: string | Buffer): string {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\")\n}\n\n/**\n * Hash a bundle of files deterministically.\n * Files are sorted by path for consistent hashing.\n *\n * @param files - Array of file objects with path and content\n * @returns SHA-256 hash of the entire bundle\n */\nexport async function hashBundle(files: { path: string; content: Buffer }[]): Promise<string> {\n\t// Sort files for deterministic hashing\n\tconst sorted = [...files].sort((a, b) => a.path.localeCompare(b.path))\n\n\t// Create a manifest of file hashes\n\tconst manifestParts: string[] = []\n\tfor (const file of sorted) {\n\t\tconst hash = hashContent(file.content)\n\t\tmanifestParts.push(`${file.path}:${hash}`)\n\t}\n\n\t// Hash the manifest itself\n\treturn hashContent(manifestParts.join(\"\\n\"))\n}\n\n/**\n * Check if files in a component have been manually edited.\n * Compares current file hashes against receipt baselines.\n *\n * @param installRoot - Install root directory\n * @param entry - Installed component entry from receipt\n * @returns Object with overall status and per-file details\n */\nexport async function checkFileIntegrity(\n\tinstallRoot: string,\n\tentry: InstalledComponent,\n): Promise<{\n\tintact: boolean\n\tmodified: string[]\n\tmissing: string[]\n\tdetails: Array<{ path: string; status: \"intact\" | \"modified\" | \"missing\" }>\n}> {\n\tconst modified: string[] = []\n\tconst missing: string[] = []\n\tconst details: Array<{ path: string; status: \"intact\" | \"modified\" | \"missing\" }> = []\n\n\tfor (const fileEntry of entry.files) {\n\t\tconst filePath = join(installRoot, fileEntry.path)\n\n\t\tif (!existsSync(filePath)) {\n\t\t\tmissing.push(fileEntry.path)\n\t\t\tdetails.push({ path: fileEntry.path, status: \"missing\" })\n\t\t\tcontinue\n\t\t}\n\n\t\tconst currentContent = await Bun.file(filePath).text()\n\t\tconst currentHash = hashContent(currentContent)\n\n\t\tif (currentHash !== fileEntry.hash) {\n\t\t\tmodified.push(fileEntry.path)\n\t\t\tdetails.push({ path: fileEntry.path, status: \"modified\" })\n\t\t} else {\n\t\t\tdetails.push({ path: fileEntry.path, status: \"intact\" })\n\t\t}\n\t}\n\n\treturn {\n\t\tintact: modified.length === 0 && missing.length === 0,\n\t\tmodified,\n\t\tmissing,\n\t\tdetails,\n\t}\n}\n\nexport { createCanonicalId, parseCanonicalId }\n",
98
- "/**\n * Build Command (for Registry Authors)\n *\n * CLI wrapper around the buildRegistry library function.\n */\n\nimport { relative, resolve } from \"node:path\"\nimport type { Command } from \"commander\"\nimport kleur from \"kleur\"\nimport { BuildRegistryError, type BuildRegistryResult, buildRegistry } from \"../lib/build-registry\"\nimport { runCompleteValidation } from \"../lib/validation-runner\"\nimport type { LoadRegistryErrorKind } from \"../lib/validators\"\nimport { outputDryRun } from \"../utils/dry-run\"\nimport {\n\tEXIT_CODES,\n\tNotFoundError,\n\tOCXError,\n\tValidationFailedError,\n\ttype ValidationFailureDetails,\n} from \"../utils/errors\"\nimport { createSpinner, handleError, logger, outputJson } from \"../utils/index\"\nimport { categorizeValidationErrors, summarizeValidationErrors } from \"../utils/validation-errors\"\n\ninterface BuildOptions {\n\tcwd: string\n\tout: string\n\tjson: boolean\n\tquiet: boolean\n\tdryRun?: boolean\n\tshowValidation: boolean\n}\n\nfunction createLoadValidationError(message: string, errorKind?: LoadRegistryErrorKind): Error {\n\tif (errorKind === \"not_found\") {\n\t\treturn new NotFoundError(message)\n\t}\n\n\tif (errorKind === \"parse_error\") {\n\t\treturn new OCXError(message, \"CONFIG_ERROR\", EXIT_CODES.CONFIG)\n\t}\n\n\treturn new OCXError(message, \"CONFIG_ERROR\", EXIT_CODES.CONFIG)\n}\n\nfunction createValidationFailureError(\n\terrors: string[],\n\tfailureType: \"schema\" | \"rules\",\n): ValidationFailedError {\n\tconst summary = summarizeValidationErrors(errors, {\n\t\tschemaErrors: failureType === \"schema\" ? errors.length : 0,\n\t})\n\n\tconst details: ValidationFailureDetails = {\n\t\tvalid: false,\n\t\terrors,\n\t\tsummary: {\n\t\t\tvalid: false,\n\t\t\ttotalErrors: summary.totalErrors,\n\t\t\tschemaErrors: summary.schemaErrors,\n\t\t\tsourceFileErrors: summary.sourceFileErrors,\n\t\t\tcircularDependencyErrors: summary.circularDependencyErrors,\n\t\t\tduplicateTargetErrors: summary.duplicateTargetErrors,\n\t\t\totherErrors: summary.otherErrors,\n\t\t},\n\t}\n\n\treturn new ValidationFailedError(details)\n}\n\nfunction outputValidationFailures(errors: string[], failureType: \"schema\" | \"rules\"): void {\n\tif (failureType === \"schema\") {\n\t\tlogger.error(\"✗ Registry schema\")\n\t\tfor (const error of errors) {\n\t\t\tconsole.log(kleur.red(` ${error}`))\n\t\t}\n\t\treturn\n\t}\n\n\tconst categorized = categorizeValidationErrors(errors)\n\n\tif (categorized.file.length > 0) {\n\t\tlogger.error(\"✗ Source files\")\n\t\tfor (const error of categorized.file) {\n\t\t\tconsole.log(kleur.red(` ${error}`))\n\t\t}\n\t}\n\n\tif (categorized.circular.length > 0) {\n\t\tlogger.error(\"✗ Circular dependencies\")\n\t\tfor (const error of categorized.circular) {\n\t\t\tconsole.log(kleur.red(` ${error}`))\n\t\t}\n\t}\n\n\tif (categorized.duplicate.length > 0) {\n\t\tlogger.error(\"✗ Duplicate targets\")\n\t\tfor (const error of categorized.duplicate) {\n\t\t\tconsole.log(kleur.red(` ${error}`))\n\t\t}\n\t}\n}\n\nexport function registerBuildCommand(program: Command): void {\n\tprogram\n\t\t.command(\"build\")\n\t\t.description(\"Build a registry from source (for registry authors)\")\n\t\t.argument(\"[path]\", \"Registry source directory\", \".\")\n\t\t.option(\"--out <dir>\", \"Output directory\", \"./dist\")\n\t\t.option(\"--cwd <path>\", \"Working directory\", process.cwd())\n\t\t.option(\"--json\", \"Output as JSON\", false)\n\t\t.option(\"-q, --quiet\", \"Suppress output\", false)\n\t\t.option(\"--dry-run\", \"Validate and show what would be built\")\n\t\t.option(\"--show-validation\", \"Display validation results before building\", false)\n\t\t.action(async (path: string, options: BuildOptions) => {\n\t\t\ttry {\n\t\t\t\tconst sourcePath = resolve(options.cwd, path)\n\t\t\t\tconst outPath = resolve(options.cwd, options.out)\n\n\t\t\t\tif (options.showValidation) {\n\t\t\t\t\tconst shouldDisplayValidation = !options.json && !options.quiet\n\t\t\t\t\tif (shouldDisplayValidation) {\n\t\t\t\t\t\tlogger.info(\"Running validation checks...\")\n\t\t\t\t\t}\n\n\t\t\t\t\tconst validationResult = await runCompleteValidation(sourcePath, {\n\t\t\t\t\t\tskipDuplicateTargets: false,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (!validationResult.success) {\n\t\t\t\t\t\tconst [firstError = \"Registry validation failed\"] = validationResult.errors\n\n\t\t\t\t\t\tif (validationResult.failureType === \"load\") {\n\t\t\t\t\t\t\tthrow createLoadValidationError(firstError, validationResult.loadErrorKind)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst failureType = validationResult.failureType === \"schema\" ? \"schema\" : \"rules\"\n\t\t\t\t\t\tconst validationError = createValidationFailureError(\n\t\t\t\t\t\t\tvalidationResult.errors,\n\t\t\t\t\t\t\tfailureType,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\tif (options.json) {\n\t\t\t\t\t\t\tthrow validationError\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!options.quiet) {\n\t\t\t\t\t\t\toutputValidationFailures(validationResult.errors, failureType)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprocess.exit(validationError.exitCode)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldDisplayValidation) {\n\t\t\t\t\t\tlogger.success(\"✓ Schema compatibility and structure\")\n\t\t\t\t\t\tlogger.success(\"✓ Source files\")\n\t\t\t\t\t\tlogger.success(\"✓ No circular dependencies\")\n\t\t\t\t\t\tlogger.success(\"✓ No duplicate targets\")\n\t\t\t\t\t\tconsole.log(\"\")\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst spinner = createSpinner({\n\t\t\t\t\ttext: \"Building registry...\",\n\t\t\t\t\tquiet: options.quiet || options.json,\n\t\t\t\t})\n\t\t\t\tif (!options.json) spinner.start()\n\n\t\t\t\tconst result = await buildRegistry({\n\t\t\t\t\tsource: sourcePath,\n\t\t\t\t\tout: outPath,\n\t\t\t\t\tdryRun: options.dryRun,\n\t\t\t\t})\n\n\t\t\t\t// Handle dry-run result\n\t\t\t\tif (\"dryRun\" in result && result.dryRun) {\n\t\t\t\t\tif (!options.json) spinner.stop()\n\t\t\t\t\toutputDryRun(result, { json: options.json, quiet: options.quiet })\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Type narrowing: result is now BuildRegistryResult\n\t\t\t\tconst buildResult = result as BuildRegistryResult\n\n\t\t\t\tif (!options.json) {\n\t\t\t\t\tconst msg = `Built ${buildResult.componentsCount} components to ${relative(options.cwd, outPath)}`\n\t\t\t\t\tspinner.succeed(msg)\n\t\t\t\t\tif (process.env.NODE_ENV === \"test\" || !process.stdout.isTTY) {\n\t\t\t\t\t\tlogger.success(`Built ${buildResult.componentsCount} components`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (options.json) {\n\t\t\t\t\toutputJson({\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tcomponents: buildResult.componentsCount,\n\t\t\t\t\t\t\toutput: buildResult.outputPath,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof BuildRegistryError) {\n\t\t\t\t\tif (options.json) {\n\t\t\t\t\t\thandleError(error, { json: true })\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.quiet) {\n\t\t\t\t\t\tlogger.error(error.message)\n\t\t\t\t\t\tfor (const err of error.errors) {\n\t\t\t\t\t\t\tconsole.log(kleur.red(` ${err}`))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tprocess.exit(1)\n\t\t\t\t}\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n",
99
- "/**\n * Registry Validation Library\n *\n * Pure validation functions for registry source validation.\n * Shared by both validate command and build command.\n */\n\nimport { join, posix } from \"node:path\"\nimport { type ParseError, parse as parseJsonc, printParseErrorCode } from \"jsonc-parser\"\nimport type { Registry } from \"../schemas/registry\"\nimport { classifyRegistrySchemaIssue, normalizeFile, registrySchema } from \"../schemas/registry\"\n\nexport interface ValidationResult<T = unknown> {\n\tvalid: boolean\n\terrors: string[]\n\twarnings?: string[]\n\tdata?: T\n}\n\nexport type LoadRegistryErrorKind = \"not_found\" | \"parse_error\"\n\nexport interface LoadRegistryResult {\n\tsuccess: boolean\n\tdata?: unknown\n\terror?: string\n\terrorKind?: LoadRegistryErrorKind\n}\n\n/**\n * Format JSONC parse errors into a readable error message.\n */\nfunction formatJsoncParseError(parseErrors: ParseError[]): string {\n\tif (parseErrors.length === 0) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\tconst firstError = parseErrors[0]\n\tif (!firstError) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\treturn `${printParseErrorCode(firstError.error)} at offset ${firstError.offset}`\n}\n\n/**\n * Load and parse a registry source file from a directory.\n *\n * Looks for registry.jsonc first, then registry.json.\n * Supports JSONC format with comments and trailing commas.\n *\n * @param sourcePath - Path to the directory containing the registry file\n * @returns Result with parsed data or error message\n */\nexport async function loadRegistrySource(sourcePath: string): Promise<LoadRegistryResult> {\n\tconst jsoncFile = Bun.file(`${sourcePath}/registry.jsonc`)\n\tconst jsonFile = Bun.file(`${sourcePath}/registry.json`)\n\tconst jsoncExists = await jsoncFile.exists()\n\tconst jsonExists = await jsonFile.exists()\n\n\tif (!jsoncExists && !jsonExists) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: \"No registry.jsonc or registry.json found in source directory\",\n\t\t\terrorKind: \"not_found\",\n\t\t}\n\t}\n\n\tconst registryFile = jsoncExists ? jsoncFile : jsonFile\n\tconst fileName = jsoncExists ? \"registry.jsonc\" : \"registry.json\"\n\tconst content = await registryFile.text()\n\n\tconst parseErrors: ParseError[] = []\n\tconst data = parseJsonc(content, parseErrors, { allowTrailingComma: true })\n\n\tif (parseErrors.length > 0) {\n\t\tconst errorDetail = formatJsoncParseError(parseErrors)\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: `Invalid JSONC in ${fileName}: ${errorDetail}`,\n\t\t\terrorKind: \"parse_error\",\n\t\t}\n\t}\n\n\treturn {\n\t\tsuccess: true,\n\t\tdata,\n\t}\n}\n\n/**\n * Validate a registry's schema compatibility and structure.\n *\n * This combines schema compatibility check (v1 vs v2) with schema validation.\n * It's a higher-level function that includes both checks.\n *\n * @param registryData - The parsed registry object\n * @param sourcePath - Path to the registry source (for error messages)\n * @returns Validation result with parsed data\n */\nexport function validateRegistrySchema(\n\tregistryData: unknown,\n\tsourcePath: string,\n): ValidationResult<Registry> {\n\t// Check schema compatibility first\n\tconst schemaIssue = classifyRegistrySchemaIssue(registryData)\n\tif (schemaIssue) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [`Schema compatibility issue: ${schemaIssue.issue} - ${schemaIssue.remediation}`],\n\t\t}\n\t}\n\n\t// Then validate against the schema\n\treturn validateRegistrySource(registryData, sourcePath)\n}\n\n/**\n * Validate a registry source object against the schema.\n *\n * @param registryData - The parsed registry object\n * @param sourcePath - Path to the registry source (for error messages)\n * @returns Validation result with parsed data\n */\nexport function validateRegistrySource(\n\tregistryData: unknown,\n\t_sourcePath: string,\n): ValidationResult<Registry> {\n\tconst parseResult = registrySchema.safeParse(registryData)\n\n\tif (!parseResult.success) {\n\t\tconst errors = parseResult.error.errors.map((e) => `${e.path.join(\".\")}: ${e.message}`)\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors,\n\t\t}\n\t}\n\n\treturn {\n\t\tvalid: true,\n\t\terrors: [],\n\t\tdata: parseResult.data,\n\t}\n}\n\n/**\n * Validate that all source files referenced in the registry exist.\n *\n * @param registry - The validated registry object\n * @param sourcePath - Path to the registry source directory\n * @returns Validation result with file existence errors\n */\nexport async function validateSourceFiles(\n\tregistry: Registry,\n\tsourcePath: string,\n): Promise<ValidationResult> {\n\tconst errors: string[] = []\n\n\tfor (const component of registry.components) {\n\t\tfor (const rawFile of component.files) {\n\t\t\tconst file = normalizeFile(rawFile, component.type)\n\t\t\tconst sourceFilePath = join(sourcePath, \"files\", file.path)\n\n\t\t\tif (!(await Bun.file(sourceFilePath).exists())) {\n\t\t\t\terrors.push(`${component.name}: Source file not found at ${file.path}`)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tvalid: errors.length === 0,\n\t\terrors,\n\t}\n}\n\n/**\n * Validate that there are no circular dependencies in the registry.\n *\n * Uses depth-first search to detect cycles in the component dependency graph.\n * Only validates same-registry dependencies (bare names without \"/\").\n *\n * @param registry - The validated registry object\n * @returns Validation result with circular dependency errors\n */\nexport function validateCircularDependencies(registry: Registry): ValidationResult {\n\tconst errors: string[] = []\n\tconst componentMap = new Map(registry.components.map((c) => [c.name, c]))\n\n\tfunction detectCycle(\n\t\tcomponentName: string,\n\t\tvisiting: Set<string>,\n\t\tvisited: Set<string>,\n\t\tpath: string[],\n\t): string | null {\n\t\t// If we're currently visiting this node, we found a cycle\n\t\tif (visiting.has(componentName)) {\n\t\t\treturn [...path, componentName].join(\" -> \")\n\t\t}\n\n\t\t// If already fully visited, no cycle from this path\n\t\tif (visited.has(componentName)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst component = componentMap.get(componentName)\n\t\tif (!component) {\n\t\t\treturn null\n\t\t}\n\n\t\t// Mark as currently visiting\n\t\tvisiting.add(componentName)\n\t\tpath.push(componentName)\n\n\t\t// Check all dependencies\n\t\tfor (const dep of component.dependencies) {\n\t\t\t// Only check same-registry deps (bare names without \"/\")\n\t\t\tif (dep.includes(\"/\")) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst cycle = detectCycle(dep, visiting, visited, path)\n\t\t\tif (cycle) {\n\t\t\t\treturn cycle\n\t\t\t}\n\t\t}\n\n\t\t// Done visiting this node\n\t\tvisiting.delete(componentName)\n\t\tvisited.add(componentName)\n\t\tpath.pop()\n\n\t\treturn null\n\t}\n\n\tconst globalVisited = new Set<string>()\n\n\tfor (const component of registry.components) {\n\t\tif (globalVisited.has(component.name)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst cycle = detectCycle(component.name, new Set(), globalVisited, [])\n\t\tif (cycle) {\n\t\t\terrors.push(`Circular dependency detected: ${cycle}`)\n\t\t\t// Only report the first cycle found\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn {\n\t\tvalid: errors.length === 0,\n\t\terrors,\n\t}\n}\n\n/**\n * Validate that there are no duplicate target paths across components.\n *\n * @param registry - The validated registry object\n * @returns Validation result with duplicate target errors\n */\nexport function validateDuplicateTargets(registry: Registry): ValidationResult {\n\tconst errors: string[] = []\n\tconst targetMap = new Map<string, { componentName: string }>()\n\n\tconst canonicalizeTargetForComparison = (target: string): string => {\n\t\tconst normalizedUnicode = target.normalize(\"NFC\")\n\t\tconst unifiedSeparators = normalizedUnicode.replace(/\\\\/g, \"/\")\n\t\tconst normalizedTarget = posix.normalize(unifiedSeparators)\n\t\treturn normalizedTarget.replace(/^\\.\\//, \"\")\n\t}\n\n\tfor (const component of registry.components) {\n\t\tfor (const rawFile of component.files) {\n\t\t\tconst file = normalizeFile(rawFile, component.type)\n\t\t\tconst canonicalTarget = canonicalizeTargetForComparison(file.target)\n\t\t\tconst existing = targetMap.get(canonicalTarget)\n\n\t\t\tif (existing) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`Duplicate target \"${canonicalTarget}\" in components \"${existing.componentName}\" and \"${component.name}\"`,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\ttargetMap.set(canonicalTarget, {\n\t\t\t\t\tcomponentName: component.name,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tvalid: errors.length === 0,\n\t\terrors,\n\t}\n}\n\nexport interface ValidateRegistryOptions {\n\tskipDuplicateTargets?: boolean\n}\n\n/**\n * Validate a registry's structure using a generator that yields errors.\n *\n * This generator runs all validators in order and yields each error as it's found.\n * This eliminates duplication of calling all validators in the correct order.\n *\n * @param registry - The validated registry object\n * @param sourcePath - Path to the registry source directory\n * @param options - Validation options\n * @yields Individual validation error messages\n */\nexport async function* validateRegistryWithOptions(\n\tregistry: Registry,\n\tsourcePath: string,\n\toptions: ValidateRegistryOptions = {},\n): AsyncGenerator<string, void, undefined> {\n\t// Validate source files exist\n\tconst filesResult = await validateSourceFiles(registry, sourcePath)\n\tfor (const error of filesResult.errors) {\n\t\tyield error\n\t}\n\n\t// Validate no circular dependencies\n\tconst circularResult = validateCircularDependencies(registry)\n\tfor (const error of circularResult.errors) {\n\t\tyield error\n\t}\n\n\t// Validate no duplicate targets (unless skipped)\n\tif (!options.skipDuplicateTargets) {\n\t\tconst duplicateTargetsResult = validateDuplicateTargets(registry)\n\t\tfor (const error of duplicateTargetsResult.errors) {\n\t\t\tyield error\n\t\t}\n\t}\n}\n",
100
- "/**\n * Validation Runner\n *\n * Shared validation workflow for both build and validate commands.\n */\n\nimport type { Registry } from \"../schemas/registry\"\nimport {\n\ttype LoadRegistryErrorKind,\n\tloadRegistrySource,\n\ttype ValidateRegistryOptions,\n\tvalidateRegistrySchema,\n\tvalidateRegistryWithOptions,\n} from \"./validators\"\n\nexport type ValidationFailureType = \"load\" | \"schema\" | \"rules\"\n\nexport interface CompleteValidationResult {\n\tsuccess: boolean\n\terrors: string[]\n\tregistry?: Registry\n\tfailureType?: ValidationFailureType\n\tloadErrorKind?: LoadRegistryErrorKind\n}\n\n/**\n * Run complete validation workflow: load, validate schema, and run all validators.\n *\n * @param sourcePath - Path to the registry source directory\n * @param options - Validation options\n * @returns Validation result with registry data if successful\n */\nexport async function runCompleteValidation(\n\tsourcePath: string,\n\toptions: ValidateRegistryOptions = {},\n): Promise<CompleteValidationResult> {\n\t// Load registry file\n\tconst loadResult = await loadRegistrySource(sourcePath)\n\tif (!loadResult.success) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terrors: [loadResult.error || \"Failed to load registry\"],\n\t\t\tfailureType: \"load\",\n\t\t\tloadErrorKind: loadResult.errorKind,\n\t\t}\n\t}\n\n\t// Validate schema (compatibility + structure)\n\tconst schemaResult = validateRegistrySchema(loadResult.data, sourcePath)\n\tif (!schemaResult.valid) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terrors: schemaResult.errors,\n\t\t\tfailureType: \"schema\",\n\t\t}\n\t}\n\n\t// Use the parsed and validated registry data\n\tconst registry = schemaResult.data\n\tif (!registry) {\n\t\tthrow new Error(\"Registry validation succeeded but returned no parsed data\")\n\t}\n\n\t// Collect all validation errors\n\tconst validationErrors: string[] = []\n\tfor await (const error of validateRegistryWithOptions(registry, sourcePath, options)) {\n\t\tvalidationErrors.push(error)\n\t}\n\n\tif (validationErrors.length > 0) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terrors: validationErrors,\n\t\t\tfailureType: \"rules\",\n\t\t}\n\t}\n\n\treturn {\n\t\tsuccess: true,\n\t\terrors: [],\n\t\tregistry,\n\t}\n}\n",
101
- "/**\n * Validation Error Utilities\n *\n * Shared utilities for categorizing and displaying validation errors.\n */\n\nexport interface CategorizedErrors {\n\tfile: string[]\n\tcircular: string[]\n\tduplicate: string[]\n}\n\nexport interface ValidationErrorSummary {\n\tvalid: boolean\n\ttotalErrors: number\n\tschemaErrors: number\n\tsourceFileErrors: number\n\tcircularDependencyErrors: number\n\tduplicateTargetErrors: number\n\totherErrors: number\n}\n\n/**\n * Categorize validation errors by type.\n *\n * @param errors - Array of validation error messages\n * @returns Object with categorized errors\n */\nexport function categorizeValidationErrors(errors: string[]): CategorizedErrors {\n\treturn {\n\t\tfile: errors.filter((e) => e.includes(\"Source file not found\")),\n\t\tcircular: errors.filter((e) => e.includes(\"Circular dependency\")),\n\t\tduplicate: errors.filter((e) => e.includes(\"Duplicate target\")),\n\t}\n}\n\n/**\n * Display categorized validation errors with headings.\n *\n * @param categorized - Categorized errors object\n * @param logFn - Function to output messages (defaults to console.log)\n */\nexport function displayCategorizedErrors(\n\tcategorized: CategorizedErrors,\n\tlogFn: (msg: string) => void = console.log,\n): void {\n\tif (categorized.file.length > 0) {\n\t\tlogFn(\"✗ Source files\")\n\t\tfor (const error of categorized.file) {\n\t\t\tlogFn(` ${error}`)\n\t\t}\n\t}\n\n\tif (categorized.circular.length > 0) {\n\t\tlogFn(\"✗ Circular dependencies\")\n\t\tfor (const error of categorized.circular) {\n\t\t\tlogFn(` ${error}`)\n\t\t}\n\t}\n\n\tif (categorized.duplicate.length > 0) {\n\t\tlogFn(\"✗ Duplicate targets\")\n\t\tfor (const error of categorized.duplicate) {\n\t\t\tlogFn(` ${error}`)\n\t\t}\n\t}\n}\n\n/**\n * Build a stable summary object for validation results.\n *\n * @param errors - Validation error messages\n * @param options - Optional overrides for explicit schema errors\n */\nexport function summarizeValidationErrors(\n\terrors: string[],\n\toptions: { schemaErrors?: number } = {},\n): ValidationErrorSummary {\n\tconst categorized = categorizeValidationErrors(errors)\n\tconst schemaErrors = options.schemaErrors ?? 0\n\tconst totalErrors = errors.length\n\tconst otherErrors = Math.max(\n\t\t0,\n\t\ttotalErrors -\n\t\t\tschemaErrors -\n\t\t\tcategorized.file.length -\n\t\t\tcategorized.circular.length -\n\t\t\tcategorized.duplicate.length,\n\t)\n\n\treturn {\n\t\tvalid: totalErrors === 0,\n\t\ttotalErrors,\n\t\tschemaErrors,\n\t\tsourceFileErrors: categorized.file.length,\n\t\tcircularDependencyErrors: categorized.circular.length,\n\t\tduplicateTargetErrors: categorized.duplicate.length,\n\t\totherErrors,\n\t}\n}\n",
102
- "/**\n * Config Edit Command\n *\n * Open configuration file in the user's preferred editor.\n * --global: edit global ocx.jsonc\n * default: edit local .opencode/ocx.jsonc\n */\n\nimport { existsSync } from \"node:fs\"\nimport { mkdir } from \"node:fs/promises\"\nimport { join } from \"node:path\"\nimport type { Command } from \"commander\"\nimport { ProfileManager } from \"../../profile/manager\"\nimport {\n\tfindLocalConfigDir,\n\tgetGlobalConfig,\n\tgetProfileOcxConfig,\n\tLOCAL_CONFIG_DIR,\n\tOCX_CONFIG_FILE,\n} from \"../../profile/paths\"\nimport { profileNameSchema } from \"../../profile/schema\"\nimport { ConfigError, ProfileNotFoundError, ValidationError } from \"../../utils/errors\"\nimport { handleError, logger } from \"../../utils/index\"\n\ninterface ConfigEditOptions {\n\tglobal?: boolean\n\tprofile?: string\n}\n\nexport function registerConfigEditCommand(parent: Command): void {\n\tparent\n\t\t.command(\"edit\")\n\t\t.description(\"Open configuration file in editor\")\n\t\t.option(\"-g, --global\", \"Edit global ocx.jsonc\")\n\t\t.option(\"-p, --profile <name>\", \"Edit specific profile's config\")\n\t\t.action(async (options: ConfigEditOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runConfigEdit(options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error)\n\t\t\t}\n\t\t})\n}\n\nasync function runConfigEdit(options: ConfigEditOptions): Promise<void> {\n\t// Guard: mutual exclusivity\n\tif (options.global && options.profile) {\n\t\tthrow new ValidationError(\"Cannot use both --global and --profile flags\")\n\t}\n\n\tlet configPath: string\n\n\tif (options.profile) {\n\t\t// Validate profile name first (prevents path traversal)\n\t\tconst parseResult = profileNameSchema.safeParse(options.profile)\n\t\tif (!parseResult.success) {\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Invalid profile name \"${options.profile}\": ${parseResult.error.errors[0]?.message ?? \"Invalid name\"}`,\n\t\t\t)\n\t\t}\n\n\t\t// Check profiles are initialized\n\t\tawait ProfileManager.requireInitialized()\n\n\t\t// Edit profile config\n\t\tconst manager = ProfileManager.create()\n\t\tif (!(await manager.exists(options.profile))) {\n\t\t\tthrow new ProfileNotFoundError(options.profile)\n\t\t}\n\t\tconfigPath = getProfileOcxConfig(options.profile)\n\t} else if (options.global) {\n\t\t// Edit global config\n\t\tconfigPath = getGlobalConfig()\n\t\tif (!existsSync(configPath)) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t`Global config not found at ${configPath}.\\nRun 'ocx init --global' first.`,\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Edit local config\n\t\tconst localConfigDir = findLocalConfigDir(process.cwd())\n\t\tif (localConfigDir) {\n\t\t\tconfigPath = join(localConfigDir, OCX_CONFIG_FILE)\n\t\t} else {\n\t\t\t// Create .opencode directory if it doesn't exist\n\t\t\tconst newConfigDir = join(process.cwd(), LOCAL_CONFIG_DIR)\n\t\t\tawait mkdir(newConfigDir, { recursive: true })\n\t\t\tconfigPath = join(newConfigDir, OCX_CONFIG_FILE)\n\n\t\t\t// Create empty config file if it doesn't exist\n\t\t\tif (!existsSync(configPath)) {\n\t\t\t\tconst defaultConfig = {\n\t\t\t\t\t$schema: \"https://ocx.kdco.dev/schemas/ocx.json\",\n\t\t\t\t\tregistries: {},\n\t\t\t\t}\n\t\t\t\tawait Bun.write(configPath, JSON.stringify(defaultConfig, null, 2))\n\t\t\t\tlogger.info(`Created ${configPath}`)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst editor = process.env.EDITOR || process.env.VISUAL || \"vi\"\n\n\tconst proc = Bun.spawn([editor, configPath], {\n\t\tstdin: \"inherit\",\n\t\tstdout: \"inherit\",\n\t\tstderr: \"inherit\",\n\t})\n\n\tconst exitCode = await proc.exited\n\tif (exitCode !== 0) {\n\t\tthrow new Error(`Editor exited with code ${exitCode}`)\n\t}\n}\n",
103
- "/**\n * Config Show Command\n *\n * Display the resolved configuration for the current directory.\n * Uses ConfigResolver with registry isolation (profile OR local, not merged).\n * OpenCode config and instructions are additively merged when not excluded.\n */\n\nimport type { Command } from \"commander\"\nimport kleur from \"kleur\"\nimport { ConfigResolver } from \"../../config/resolver\"\nimport { handleError } from \"../../utils/handle-error\"\nimport { sharedOptions } from \"../../utils/shared-options\"\n\ninterface ConfigShowOptions {\n\tjson?: boolean\n\torigin?: boolean\n\tprofile?: string\n}\n\nexport function registerConfigShowCommand(parent: Command): void {\n\tparent\n\t\t.command(\"show\")\n\t\t.description(\"Display resolved configuration for current directory\")\n\t\t.addOption(sharedOptions.json())\n\t\t.option(\"--origin\", \"Show where each setting came from\")\n\t\t.option(\"-p, --profile <name>\", \"Use specific profile\")\n\t\t.action(async (options: ConfigShowOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runConfigShow(options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runConfigShow(options: ConfigShowOptions): Promise<void> {\n\tconst resolver = await ConfigResolver.create(process.cwd(), { profile: options.profile })\n\n\tif (options.origin) {\n\t\tconst configWithOrigin = resolver.resolveWithOrigin()\n\n\t\tif (options.json) {\n\t\t\t// Convert Map to object for JSON serialization\n\t\t\tconst originsObj: Record<string, { path: string; source: string }> = {}\n\t\t\tfor (const [key, value] of configWithOrigin.origins) {\n\t\t\t\toriginsObj[key] = value\n\t\t\t}\n\t\t\tconsole.log(\n\t\t\t\tJSON.stringify(\n\t\t\t\t\t{\n\t\t\t\t\t\t...configWithOrigin,\n\t\t\t\t\t\torigins: originsObj,\n\t\t\t\t\t},\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// Human-readable output with origin annotations\n\t\tconsole.log(kleur.bold(\"Resolved Configuration\"))\n\t\tconsole.log()\n\n\t\tif (configWithOrigin.profileName) {\n\t\t\tconst origin = configWithOrigin.origins.get(\"profileName\")\n\t\t\tconsole.log(`${kleur.cyan(\"Profile:\")} ${configWithOrigin.profileName}`)\n\t\t\tif (origin) {\n\t\t\t\tconsole.log(` ${kleur.dim(`← ${origin.source}`)}`)\n\t\t\t}\n\t\t}\n\n\t\tconsole.log()\n\t\tconsole.log(kleur.cyan(\"Component Path:\"), configWithOrigin.componentPath)\n\t\tconst componentPathOrigin = configWithOrigin.origins.get(\"componentPath\")\n\t\tif (componentPathOrigin) {\n\t\t\tconsole.log(` ${kleur.dim(`← ${componentPathOrigin.source} (${componentPathOrigin.path})`)}`)\n\t\t}\n\n\t\tconsole.log()\n\t\tconsole.log(kleur.cyan(\"Registries:\"))\n\t\tfor (const [name, config] of Object.entries(configWithOrigin.registries)) {\n\t\t\tconsole.log(` ${kleur.green(name)}: ${config.url}`)\n\t\t\tconst regOrigin = configWithOrigin.origins.get(`registries.${name}`)\n\t\t\tif (regOrigin) {\n\t\t\t\tconsole.log(` ${kleur.dim(`← ${regOrigin.source} (${regOrigin.path})`)}`)\n\t\t\t}\n\t\t}\n\n\t\tif (configWithOrigin.instructions.length > 0) {\n\t\t\tconsole.log()\n\t\t\tconsole.log(kleur.cyan(\"Instructions:\"))\n\t\t\tfor (const instruction of configWithOrigin.instructions) {\n\t\t\t\tconsole.log(` ${instruction}`)\n\t\t\t}\n\t\t}\n\n\t\tif (Object.keys(configWithOrigin.opencode).length > 0) {\n\t\t\tconsole.log()\n\t\t\tconsole.log(kleur.cyan(\"OpenCode Config:\"))\n\t\t\tfor (const key of Object.keys(configWithOrigin.opencode)) {\n\t\t\t\tconst keyOrigin = configWithOrigin.origins.get(`opencode.${key}`)\n\t\t\t\tconsole.log(` ${key}:`, JSON.stringify(configWithOrigin.opencode[key]))\n\t\t\t\tif (keyOrigin) {\n\t\t\t\t\tconsole.log(` ${kleur.dim(`← ${keyOrigin.source} (${keyOrigin.path})`)}`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Standard output (no origin tracking)\n\tconst config = resolver.resolve()\n\n\tif (options.json) {\n\t\tconsole.log(JSON.stringify(config, null, 2))\n\t\treturn\n\t}\n\n\t// Human-readable output\n\tconsole.log(kleur.bold(\"Resolved Configuration\"))\n\tconsole.log()\n\n\tif (config.profileName) {\n\t\tconsole.log(`${kleur.cyan(\"Profile:\")} ${config.profileName}`)\n\t}\n\n\tconsole.log(`${kleur.cyan(\"Component Path:\")} ${config.componentPath}`)\n\n\tconsole.log()\n\tconsole.log(kleur.cyan(\"Registries:\"))\n\tif (Object.keys(config.registries).length === 0) {\n\t\tconsole.log(\" (none)\")\n\t} else {\n\t\tfor (const [name, regConfig] of Object.entries(config.registries)) {\n\t\t\tconsole.log(` ${kleur.green(name)}: ${regConfig.url}`)\n\t\t}\n\t}\n\n\tif (config.instructions.length > 0) {\n\t\tconsole.log()\n\t\tconsole.log(kleur.cyan(\"Instructions:\"))\n\t\tfor (const instruction of config.instructions) {\n\t\t\tconsole.log(` ${instruction}`)\n\t\t}\n\t}\n}\n",
104
- "/**\n * Config Command Group\n *\n * Parent command for viewing and editing configuration.\n */\n\nimport type { Command } from \"commander\"\nimport { registerConfigEditCommand } from \"./edit\"\nimport { registerConfigShowCommand } from \"./show\"\n\n/**\n * Register the config command and all subcommands.\n */\nexport function registerConfigCommand(program: Command): void {\n\tconst config = program.command(\"config\").description(\"View and edit configuration\")\n\n\tregisterConfigShowCommand(config)\n\tregisterConfigEditCommand(config)\n}\n",
105
- "/**\n * OCX CLI - init command\n * Initialize OCX configuration in a project or scaffold a new registry\n */\n\nimport { existsSync } from \"node:fs\"\nimport { cp, mkdir, readdir, readFile, rm, writeFile } from \"node:fs/promises\"\nimport { dirname, join } from \"node:path\"\nimport type { Command } from \"commander\"\nimport { OCX_SCHEMA_URL, REGISTRY_SCHEMA_LATEST_URL } from \"../constants\"\nimport { atomicWrite } from \"../profile/atomic\"\nimport { DEFAULT_OCX_CONFIG } from \"../profile/manager\"\nimport {\n\tgetGlobalConfig,\n\tgetProfileAgents,\n\tgetProfileDir,\n\tgetProfileOcxConfig,\n\tgetProfileOpencodeConfig,\n\tgetProfilesDir,\n} from \"../profile/paths\"\nimport { findOcxConfig, ocxConfigSchema } from \"../schemas/config\"\nimport { ensureOpencodeConfig } from \"../updaters/update-opencode-config\"\nimport { ConflictError, NetworkError, ValidationError } from \"../utils/errors\"\nimport { createSpinner, handleError, logger } from \"../utils/index\"\nimport { addCommonOptions, addGlobalOption, addVerboseOption } from \"../utils/shared-options\"\n\ndeclare const __VERSION__: string | undefined\n\nexport const TEMPLATE_REPO = \"kdcokenny/ocx\"\nconst TEMPLATE_PATH = \"examples/registry-starter\"\n\ninterface InitOptions {\n\tcwd?: string\n\tquiet?: boolean\n\tverbose?: boolean\n\tjson?: boolean\n\tregistry?: string\n\tnamespace?: string\n\tauthor?: string\n\tcanary?: boolean\n\tlocal?: string\n\tglobal?: boolean\n}\n\nexport function registerInitCommand(program: Command): void {\n\tconst cmd = program.command(\"init\").description(\"Initialize OCX configuration in your project\")\n\n\taddCommonOptions(cmd)\n\taddVerboseOption(cmd)\n\taddGlobalOption(cmd)\n\n\tcmd\n\t\t.option(\"--registry <path>\", \"Scaffold a new OCX registry project at path\")\n\t\t.option(\"--namespace <name>\", \"Registry namespace (e.g., my-org)\")\n\t\t.option(\"--author <name>\", \"Author name for the registry\")\n\t\t.option(\"--canary\", \"Use canary (main branch) instead of latest release\")\n\t\t.option(\"--local <path>\", \"Use local template directory instead of fetching\")\n\t\t.action(async (options: InitOptions) => {\n\t\t\ttry {\n\t\t\t\tif (options.registry) {\n\t\t\t\t\tawait runInitRegistry(options.registry, options)\n\t\t\t\t} else if (options.global) {\n\t\t\t\t\tawait runInitGlobal(options)\n\t\t\t\t} else {\n\t\t\t\t\tawait runInit(options)\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runInit(options: InitOptions): Promise<void> {\n\tconst cwd = options.cwd ?? process.cwd()\n\n\t// Check for existing config in either location\n\tconst { path: configPath, exists } = findOcxConfig(cwd)\n\n\t// Check for existing config - error if exists (Law 1: Early Exit)\n\tif (exists) {\n\t\tthrow new ConflictError(\n\t\t\t`ocx.jsonc already exists at ${configPath}\\n\\n` +\n\t\t\t\t`To reset, delete the config and run init again:\\n` +\n\t\t\t\t` rm ${configPath} && ocx init`,\n\t\t)\n\t}\n\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Initializing OCX...\" })\n\tspin?.start()\n\n\ttry {\n\t\t// Create minimal config - schema will apply defaults\n\t\tconst rawConfig = {\n\t\t\t$schema: OCX_SCHEMA_URL,\n\t\t\tregistries: {},\n\t\t}\n\n\t\t// Validate with schema (applies defaults)\n\t\tconst config = ocxConfigSchema.parse(rawConfig)\n\n\t\t// Ensure .opencode directory exists\n\t\tawait mkdir(dirname(configPath), { recursive: true })\n\n\t\t// Write config file\n\t\tconst content = JSON.stringify(config, null, 2)\n\t\tawait writeFile(configPath, content, \"utf-8\")\n\n\t\t// Ensure opencode.jsonc exists (upsert - creates if not present)\n\t\tconst opencodeResult = await ensureOpencodeConfig(cwd)\n\n\t\tspin?.succeed(\"Initialized OCX configuration\")\n\n\t\tif (options.json) {\n\t\t\tconsole.log(\n\t\t\t\tJSON.stringify({\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tpath: configPath,\n\t\t\t\t\topencodePath: opencodeResult.path,\n\t\t\t\t\topencodeCreated: opencodeResult.created,\n\t\t\t\t}),\n\t\t\t)\n\t\t} else if (!options.quiet) {\n\t\t\tlogger.info(`Created ${configPath}`)\n\t\t\tif (opencodeResult.created) {\n\t\t\t\tlogger.info(`Created ${opencodeResult.path}`)\n\t\t\t}\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.info(\"Next steps:\")\n\t\t\tlogger.info(\" 1. Add a registry: ocx registry add <url>\")\n\t\t\tlogger.info(\" 2. Install components: ocx add <component>\")\n\t\t}\n\t} catch (error) {\n\t\tspin?.fail(\"Failed to initialize\")\n\t\tthrow error\n\t}\n}\n\nasync function runInitGlobal(options: InitOptions): Promise<void> {\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Initializing global profiles...\" })\n\tspin?.start()\n\n\ttry {\n\t\tconst created: string[] = []\n\t\tconst existed: string[] = []\n\n\t\t// 1. Create global base config (create-if-missing)\n\t\tconst globalConfigPath = getGlobalConfig()\n\t\tif (existsSync(globalConfigPath)) {\n\t\t\texisted.push(\"globalConfig\")\n\t\t} else {\n\t\t\tawait mkdir(dirname(globalConfigPath), { recursive: true, mode: 0o700 })\n\t\t\tawait atomicWrite(globalConfigPath, {\n\t\t\t\t$schema: OCX_SCHEMA_URL,\n\t\t\t\tregistries: {},\n\t\t\t})\n\t\t\tcreated.push(\"globalConfig\")\n\t\t}\n\n\t\t// 2. Create profiles directory (create-if-missing)\n\t\tconst profilesDir = getProfilesDir()\n\t\tif (!existsSync(profilesDir)) {\n\t\t\tawait mkdir(profilesDir, { recursive: true, mode: 0o700 })\n\t\t}\n\n\t\t// 3. Create default profile directory (create-if-missing)\n\t\tconst profileDir = getProfileDir(\"default\")\n\t\tif (!existsSync(profileDir)) {\n\t\t\tawait mkdir(profileDir, { recursive: true, mode: 0o700 })\n\t\t}\n\n\t\t// 4. Check/create each profile file individually\n\t\tconst ocxPath = getProfileOcxConfig(\"default\")\n\t\tif (existsSync(ocxPath)) {\n\t\t\texisted.push(\"profileOcx\")\n\t\t} else {\n\t\t\tawait atomicWrite(ocxPath, DEFAULT_OCX_CONFIG)\n\t\t\tcreated.push(\"profileOcx\")\n\t\t}\n\n\t\tconst opencodePath = getProfileOpencodeConfig(\"default\")\n\t\tif (existsSync(opencodePath)) {\n\t\t\texisted.push(\"profileOpencode\")\n\t\t} else {\n\t\t\tawait atomicWrite(opencodePath, {})\n\t\t\tcreated.push(\"profileOpencode\")\n\t\t}\n\n\t\tconst agentsPath = getProfileAgents(\"default\")\n\t\tif (existsSync(agentsPath)) {\n\t\t\texisted.push(\"profileAgents\")\n\t\t} else {\n\t\t\tconst agentsContent = `# Profile Instructions\n\n<!-- Add your custom instructions for this profile here -->\n<!-- These will be included when running \\`ocx opencode -p default\\` -->\n`\n\t\t\tawait Bun.write(agentsPath, agentsContent, { mode: 0o600 })\n\t\t\tcreated.push(\"profileAgents\")\n\t\t}\n\n\t\tspin?.succeed(\"Initialized global profiles\")\n\n\t\tif (options.json) {\n\t\t\tconsole.log(\n\t\t\t\tJSON.stringify({\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tfiles: {\n\t\t\t\t\t\tglobalConfig: globalConfigPath,\n\t\t\t\t\t\tprofileOcx: ocxPath,\n\t\t\t\t\t\tprofileOpencode: opencodePath,\n\t\t\t\t\t\tprofileAgents: agentsPath,\n\t\t\t\t\t},\n\t\t\t\t\tcreated,\n\t\t\t\t\texisted,\n\t\t\t\t}),\n\t\t\t)\n\t\t} else if (!options.quiet) {\n\t\t\tif (created.length > 0) {\n\t\t\t\tfor (const key of created) {\n\t\t\t\t\tif (key === \"globalConfig\") logger.info(`Created global config: ${globalConfigPath}`)\n\t\t\t\t\tif (key === \"profileOcx\") logger.info(`Created profile config: ${ocxPath}`)\n\t\t\t\t\tif (key === \"profileOpencode\")\n\t\t\t\t\t\tlogger.info(`Created profile opencode config: ${opencodePath}`)\n\t\t\t\t\tif (key === \"profileAgents\") logger.info(`Created profile instructions: ${agentsPath}`)\n\t\t\t\t}\n\t\t\t\tlogger.info(\"\")\n\t\t\t\tlogger.info(\"Next steps:\")\n\t\t\t\tlogger.info(\" 1. Edit your profile config: ocx config edit -p default\")\n\t\t\t\tlogger.info(\" 2. Add registries: ocx registry add <url> --name <name> --global\")\n\t\t\t\tlogger.info(\" 3. Launch OpenCode: ocx opencode\")\n\t\t\t\tlogger.info(\" 4. Create more profiles: ocx profile add <name> --global\")\n\t\t\t} else {\n\t\t\t\tlogger.info(\"Global profiles already initialized (all files exist)\")\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tspin?.fail(\"Failed to initialize\")\n\t\tthrow error\n\t}\n}\n\nasync function runInitRegistry(registryPath: string, options: InitOptions): Promise<void> {\n\tconst cwd = registryPath\n\tconst namespace = options.namespace ?? \"my-registry\"\n\tconst author = options.author ?? \"Your Name\"\n\n\t// Validate namespace format (Early Exit)\n\tif (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(namespace)) {\n\t\tthrow new ValidationError(\n\t\t\t\"Invalid namespace format: must start with letter/number, use hyphens only between segments (e.g., 'my-registry')\",\n\t\t)\n\t}\n\n\t// Check if directory is empty (Early Exit)\n\tconst existingFiles = await readdir(cwd).catch(() => [])\n\tconst hasVisibleFiles = existingFiles.some((f) => !f.startsWith(\".\"))\n\n\tif (hasVisibleFiles) {\n\t\tthrow new ConflictError(\n\t\t\t\"Directory is not empty. Remove existing files or choose a different directory.\",\n\t\t)\n\t}\n\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Scaffolding registry...\" })\n\tspin?.start()\n\n\ttry {\n\t\t// Fetch and extract template (or copy from local)\n\t\tif (spin) spin.text = options.local ? \"Copying template...\" : \"Fetching template...\"\n\n\t\tif (options.local) {\n\t\t\t// Use local template directory\n\t\t\tawait mkdir(cwd, { recursive: true })\n\t\t\tawait copyDir(options.local, cwd)\n\t\t} else {\n\t\t\t// Fetch from GitHub\n\t\t\tconst version = options.canary ? \"main\" : getReleaseTag()\n\t\t\tawait fetchAndExtractTemplate(cwd, version, options.verbose)\n\t\t}\n\n\t\t// Replace placeholders\n\t\tif (spin) spin.text = \"Configuring project...\"\n\t\tawait replacePlaceholders(cwd, { namespace, author })\n\n\t\tspin?.succeed(`Created registry: ${namespace}`)\n\n\t\tif (options.json) {\n\t\t\tconsole.log(JSON.stringify({ success: true, namespace, path: cwd }))\n\t\t} else if (!options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.info(\"Next steps:\")\n\t\t\tlogger.info(\" 1. bun install\")\n\t\t\tlogger.info(\" 2. Edit registry.jsonc with your components\")\n\t\t\tlogger.info(\" 3. bun run build\")\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.info(\"Deploy to:\")\n\t\t\tlogger.info(\" Cloudflare: bunx wrangler deploy\")\n\t\t\tlogger.info(\" Vercel: vercel\")\n\t\t\tlogger.info(\" Netlify: netlify deploy\")\n\t\t}\n\t} catch (error) {\n\t\tspin?.fail(\"Failed to scaffold registry\")\n\t\tthrow error\n\t}\n}\n\n/** Copy directory recursively */\nasync function copyDir(src: string, dest: string): Promise<void> {\n\tawait cp(src, dest, { recursive: true })\n}\n\n/**\n * Returns the release tag for template fetching.\n * Throws in development mode - use --canary flag instead.\n */\nexport function getReleaseTag(): string {\n\tif (typeof __VERSION__ === \"undefined\") {\n\t\tthrow new ValidationError(\n\t\t\t\"Cannot fetch release template in development mode. Run with --canary flag to use the latest development template.\",\n\t\t)\n\t}\n\treturn `v${__VERSION__}`\n}\n\n/**\n * Constructs the GitHub tarball URL for a given version.\n * @param version - Either \"main\" for canary or \"vX.Y.Z\" for release\n */\nexport function getTemplateUrl(version: string): string {\n\tconst ref = version === \"main\" ? \"heads/main\" : `tags/${version}`\n\treturn `https://github.com/${TEMPLATE_REPO}/archive/refs/${ref}.tar.gz`\n}\n\nasync function fetchAndExtractTemplate(\n\tdestDir: string,\n\tversion: string,\n\tverbose?: boolean,\n): Promise<void> {\n\tconst tarballUrl = getTemplateUrl(version)\n\n\tif (verbose) {\n\t\tlogger.info(`Fetching ${tarballUrl}`)\n\t}\n\n\tconst response = await fetch(tarballUrl)\n\tif (!response.ok || !response.body) {\n\t\tthrow new NetworkError(`Failed to fetch template from ${tarballUrl}: ${response.statusText}`)\n\t}\n\n\t// Create temp directory for extraction\n\tconst tempDir = join(destDir, \".ocx-temp\")\n\tawait mkdir(tempDir, { recursive: true })\n\n\ttry {\n\t\t// Download tarball\n\t\tconst tarPath = join(tempDir, \"template.tar.gz\")\n\t\tconst arrayBuffer = await response.arrayBuffer()\n\t\tawait writeFile(tarPath, Buffer.from(arrayBuffer))\n\n\t\t// Extract using tar command (available on all platforms with Bun)\n\t\tconst proc = Bun.spawn([\"tar\", \"-xzf\", tarPath, \"-C\", tempDir], {\n\t\t\tstdout: \"ignore\",\n\t\t\tstderr: \"pipe\",\n\t\t})\n\t\tconst exitCode = await proc.exited\n\t\tif (exitCode !== 0) {\n\t\t\tconst stderr = await new Response(proc.stderr).text()\n\t\t\tthrow new Error(`Failed to extract template: ${stderr}`)\n\t\t}\n\n\t\t// Find the extracted directory (format: ocx-{version}/)\n\t\tconst extractedDirs = await readdir(tempDir)\n\t\tconst extractedDir = extractedDirs.find((d) => d.startsWith(\"ocx-\"))\n\t\tif (!extractedDir) {\n\t\t\tthrow new Error(\"Failed to find extracted template directory\")\n\t\t}\n\n\t\t// Copy template files to destination\n\t\tconst templateDir = join(tempDir, extractedDir, TEMPLATE_PATH)\n\t\tawait copyDir(templateDir, destDir)\n\t} finally {\n\t\t// Cleanup temp directory\n\t\tawait rm(tempDir, { recursive: true, force: true })\n\t}\n}\n\n/** Convert string to title case (e.g., \"my-registry\" → \"My Registry\") */\nfunction toTitleCase(str: string): string {\n\treturn str\n\t\t.split(/[-_\\s]+/)\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join(\" \")\n}\n\nasync function replacePlaceholders(\n\tdir: string,\n\tvalues: { namespace: string; author: string },\n): Promise<void> {\n\tconst filesToProcess = [\n\t\t\"registry.jsonc\",\n\t\t\"package.json\",\n\t\t\"wrangler.jsonc\",\n\t\t\"README.md\",\n\t\t\"AGENTS.md\",\n\t]\n\n\tfor (const file of filesToProcess) {\n\t\tconst filePath = join(dir, file)\n\t\tif (!existsSync(filePath)) continue\n\n\t\tlet content = await readFile(filePath).then((b) => b.toString())\n\n\t\t// Replace placeholders\n\t\tcontent = content.replace(/my-registry/g, values.namespace)\n\t\tcontent = content.replace(/My Registry/g, toTitleCase(values.namespace))\n\t\tcontent = content.replace(/Your Name/g, values.author)\n\n\t\tif (file === \"registry.jsonc\") {\n\t\t\tif (/\"\\$schema\"\\s*:/.test(content)) {\n\t\t\t\tcontent = content.replace(\n\t\t\t\t\t/(\"\\$schema\"\\s*:\\s*\")[^\"]*(\")/,\n\t\t\t\t\t`$1${REGISTRY_SCHEMA_LATEST_URL}$2`,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tcontent = content.replace(/{/, `{\\n\\t\"$schema\": \"${REGISTRY_SCHEMA_LATEST_URL}\",`)\n\t\t\t}\n\t\t}\n\n\t\tawait writeFile(filePath, content)\n\t}\n}\n",
106
- "/**\n * OCX CLI - migrate command\n *\n * Converts legacy ocx.lock state to .ocx/receipt.jsonc format and\n * normalizes deprecated registry config fields.\n *\n * Default: preview/dry-run (no writes). Use --apply to perform migration.\n * Default scope: local (cwd). Use --global for global config path + profiles.\n *\n * --global processes:\n * 1) Global root (~/.config/opencode / getGlobalConfigPath())\n * 2) All global profiles under <globalRoot>/profiles/*\n */\n\nimport { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\"\nimport { rename, writeFile } from \"node:fs/promises\"\nimport { join } from \"node:path\"\n\nimport type { Command } from \"commander\"\nimport { applyEdits, type ModificationOptions, modify, parse as parseJsonc } from \"jsonc-parser\"\nimport {\n\tfindOcxConfig,\n\tfindOcxLock,\n\tfindReceipt,\n\treadOcxConfig,\n\treadOcxLock,\n\twriteReceipt,\n} from \"../../schemas/config\"\nimport { ConfigError, handleError, logger, ValidationError } from \"../../utils/index\"\nimport { getGlobalConfigPath } from \"../../utils/paths\"\nimport {\n\tbuildReceiptFromLock,\n\ttype ConfigNormalizationAction,\n\tdetectConfigNormalization,\n\ttype MigrateBlocker,\n\ttype MigrateLifecycleStatus,\n\ttype MigrateResult,\n\ttype MigrateScope,\n\ttype TargetResult,\n} from \"./transform\"\n\nexport interface MigrateOptions {\n\tcwd?: string\n\tglobal?: boolean\n\tapply?: boolean\n\tjson?: boolean\n\tquiet?: boolean\n}\n\nconst MIGRATE_SCHEMA_VERSION = 1 as const\n\nexport function registerMigrateCommand(program: Command): void {\n\tprogram\n\t\t.command(\"migrate\")\n\t\t.description(\"Migrate legacy ocx.lock to receipt format (.ocx/receipt.jsonc)\")\n\t\t.option(\"--global\", \"Migrate global config scope (includes profiles)\")\n\t\t.option(\"--apply\", \"Apply migration (default is dry-run preview)\")\n\t\t.option(\"--json\", \"Output as JSON\")\n\t\t.option(\"-q, --quiet\", \"Suppress output\")\n\t\t.option(\"--cwd <path>\", \"Working directory\")\n\t\t.action(async (options: MigrateOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runMigrate(options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\n// =============================================================================\n// CORE LOGIC\n// =============================================================================\n\nasync function runMigrate(options: MigrateOptions): Promise<void> {\n\tif (options.global) {\n\t\tawait runGlobalMigrate(options)\n\t\treturn\n\t}\n\n\tawait runSingleTargetMigrate(options, \"local\", resolveRoot(options), false)\n}\n\n// =============================================================================\n// GLOBAL MULTI-TARGET MIGRATION\n// =============================================================================\n\n/**\n * Run migration across global root and all global profiles.\n *\n * Ordering: root first, then profiles sorted by name.\n * On apply: continues after target failure, exits non-zero with summary.\n */\nasync function runGlobalMigrate(options: MigrateOptions): Promise<void> {\n\tconst globalRoot = options.cwd ?? getGlobalConfigPath()\n\tconst targets = discoverGlobalTargets(globalRoot)\n\n\t// Preview mode: collect results from all targets, no writes\n\tif (!options.apply) {\n\t\tconst targetResults: TargetResult[] = []\n\t\tconst staleLockCleanupPendingTargets = new Set<string>()\n\n\t\tfor (const { label, path: targetPath } of targets) {\n\t\t\tconst receipt = findReceipt(targetPath)\n\t\t\tconst lockInfo = findOcxLock(targetPath, { isFlattened: true })\n\t\t\tif (receipt.exists && lockInfo.exists) {\n\t\t\t\tstaleLockCleanupPendingTargets.add(label)\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst result = await analyzeTarget(targetPath, true, {\n\t\t\t\t\temitWarnings: !options.json && !options.quiet,\n\t\t\t\t})\n\t\t\t\ttargetResults.push({ ...result, target: label })\n\t\t\t} catch (error) {\n\t\t\t\tconst targetErrorResult = createErrorTargetResult(label, error)\n\t\t\t\ttargetResults.push(targetErrorResult)\n\n\t\t\t\tif (!options.json && !options.quiet) {\n\t\t\t\t\tlogger.error(`[global:${label}] Preview failed: ${targetErrorResult.error}`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst aggregated = aggregateResults(targetResults, \"global\", false)\n\t\tconst previewBlocked = hasPreviewBlockers(aggregated)\n\n\t\tif (options.json) {\n\t\t\temitMigrateJson(aggregated, false)\n\t\t\tif (previewBlocked) process.exit(1)\n\t\t\treturn\n\t\t}\n\n\t\tif (!options.quiet) {\n\t\t\tlogGlobalPreview(targetResults, aggregated, staleLockCleanupPendingTargets)\n\t\t}\n\n\t\tif (previewBlocked) process.exit(1)\n\t\treturn\n\t}\n\n\t// Apply mode: migrate each target, continue on failure\n\tconst targetResults: TargetResult[] = []\n\tlet hasFailure = false\n\n\tfor (const { label, path: targetPath } of targets) {\n\t\ttry {\n\t\t\tconst result = await applyTarget(targetPath, true)\n\t\t\ttargetResults.push({ ...result, target: label })\n\t\t} catch (error) {\n\t\t\thasFailure = true\n\t\t\tconst targetErrorResult = createErrorTargetResult(label, error)\n\t\t\ttargetResults.push(targetErrorResult)\n\n\t\t\tif (!options.json && !options.quiet) {\n\t\t\t\tlogger.error(`[global:${label}] Migration failed: ${targetErrorResult.error}`)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst aggregated = aggregateResults(targetResults, \"global\", true)\n\n\tif (options.json) {\n\t\temitMigrateJson(aggregated, true)\n\t\tif (hasFailure) process.exit(1)\n\t\treturn\n\t}\n\n\tif (!options.quiet) {\n\t\tlogGlobalApplySummary(targetResults, hasFailure)\n\t}\n\n\tif (hasFailure) process.exit(1)\n}\n\n/**\n * Discover all global migration targets: root + profile directories.\n * Returns root first, then profiles sorted alphabetically.\n */\nfunction discoverGlobalTargets(globalRoot: string): Array<{ label: string; path: string }> {\n\tconst targets: Array<{ label: string; path: string }> = []\n\n\t// Root target\n\ttargets.push({ label: \"root\", path: globalRoot })\n\n\t// Profile targets\n\tconst profilesDir = join(globalRoot, \"profiles\")\n\tif (existsSync(profilesDir) && statSync(profilesDir).isDirectory()) {\n\t\tconst entries = readdirSync(profilesDir, { withFileTypes: true })\n\t\tconst profileNames = entries\n\t\t\t.filter((e) => e.isDirectory() && !e.name.startsWith(\".\"))\n\t\t\t.map((e) => e.name)\n\t\t\t.sort()\n\n\t\tfor (const name of profileNames) {\n\t\t\ttargets.push({ label: `profile:${name}`, path: join(profilesDir, name) })\n\t\t}\n\t}\n\n\treturn targets\n}\n\n/**\n * Analyze a single target for migration state (no writes).\n * Parses lock files to provide accurate component counts in preview.\n */\nasync function analyzeTarget(\n\troot: string,\n\tisFlattened: boolean,\n\toptions?: { emitWarnings?: boolean },\n): Promise<Omit<TargetResult, \"target\">> {\n\tconst shouldEmitWarnings = options?.emitWarnings ?? true\n\tconst configActions = detectConfigActionsForScope(root)\n\tconst receipt = findReceipt(root)\n\tconst lockInfo = findOcxLock(root, { isFlattened })\n\tconst shouldArchiveStaleLock = receipt.exists && lockInfo.exists\n\n\t// Already migrated and no config normalization needed\n\tif (receipt.exists && configActions.length === 0 && !shouldArchiveStaleLock) {\n\t\treturn { status: \"already_v2\", count: 0, components: [], configActions: [] }\n\t}\n\n\t// No lock, no receipt, no config actions → nothing to do\n\tif (!lockInfo.exists && !receipt.exists && configActions.length === 0) {\n\t\treturn { status: \"nothing_to_migrate\", count: 0, components: [], configActions: [] }\n\t}\n\n\t// Parse lock to get accurate component count for preview\n\tlet components: TargetResult[\"components\"] = []\n\tif (lockInfo.exists && !receipt.exists) {\n\t\ttry {\n\t\t\tconst lock = await readOcxLock(root, { isFlattened })\n\t\t\tconst config = await readOcxConfig(root, {\n\t\t\t\temitParseDiagnostics: shouldEmitWarnings,\n\t\t\t})\n\t\t\tif (lock && config) {\n\t\t\t\tconst built = buildReceiptFromLock(lock, config, root)\n\t\t\t\tcomponents = built.components\n\t\t\t}\n\t\t} catch {\n\t\t\t// Preview can still proceed with count=0 if parsing fails\n\t\t\tif (shouldEmitWarnings) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`[preview] Could not parse lock/config at \"${root}\"; component count may be incomplete.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { status: \"preview\", count: components.length, components, configActions }\n}\n\n/**\n * Apply migration to a single target. Returns the result.\n * Throws on error (caller handles continue-on-failure).\n */\nasync function applyTarget(\n\troot: string,\n\tisFlattened: boolean,\n): Promise<Omit<TargetResult, \"target\">> {\n\tconst configActions = detectConfigActionsForScope(root)\n\tconst receipt = findReceipt(root)\n\tconst lockInfo = findOcxLock(root, { isFlattened })\n\tconst shouldArchiveStaleLock = receipt.exists && lockInfo.exists\n\n\t// Already migrated and no config normalization needed\n\tif (receipt.exists && configActions.length === 0 && !shouldArchiveStaleLock) {\n\t\treturn { status: \"already_v2\", count: 0, components: [], configActions: [] }\n\t}\n\n\t// No lock, no receipt, no config actions → nothing to do\n\tif (!lockInfo.exists && !receipt.exists && configActions.length === 0) {\n\t\treturn { status: \"nothing_to_migrate\", count: 0, components: [], configActions: [] }\n\t}\n\n\t// Build lock migration plan (if lock exists and receipt doesn't)\n\tlet lockMigrationPlan: {\n\t\tnewReceipt: import(\"../../schemas/config\").Receipt\n\t\tcomponents: TargetResult[\"components\"]\n\t} | null = null\n\n\tif (lockInfo.exists && !receipt.exists) {\n\t\tconst lock = await readOcxLock(root, { isFlattened })\n\t\tif (!lock) {\n\t\t\tthrow new ValidationError(\n\t\t\t\t\"Failed to parse ocx.lock. The lock file exists but could not be read or contains invalid data.\",\n\t\t\t)\n\t\t}\n\n\t\tconst config = await readOcxConfig(root)\n\t\tif (!config) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t\"No ocx.jsonc found. The config is required to resolve registry URLs during migration.\",\n\t\t\t)\n\t\t}\n\n\t\tconst { receipt: newReceipt, components } = buildReceiptFromLock(lock, config, root)\n\t\tlockMigrationPlan = { newReceipt, components }\n\t}\n\n\tconst components = lockMigrationPlan?.components ?? []\n\tconst count = components.length\n\n\t// Write receipt and rename lock\n\tif (lockMigrationPlan) {\n\t\tawait writeReceipt(root, lockMigrationPlan.newReceipt)\n\t\tconst bakPath = resolveBackupPath(lockInfo.path)\n\t\tawait rename(lockInfo.path, bakPath)\n\t}\n\n\tif (shouldArchiveStaleLock) {\n\t\tconst bakPath = resolveBackupPath(lockInfo.path)\n\t\tawait rename(lockInfo.path, bakPath)\n\t}\n\n\t// Apply config normalization\n\tif (configActions.length > 0) {\n\t\tawait applyConfigNormalizationToFile(root, configActions)\n\t}\n\n\tconst didWrite = lockMigrationPlan !== null || shouldArchiveStaleLock || configActions.length > 0\n\treturn {\n\t\tstatus: didWrite ? \"migrated\" : \"already_v2\",\n\t\tcount,\n\t\tcomponents,\n\t\tconfigActions,\n\t}\n}\n\n/**\n * Aggregate per-target results into a single MigrateResult.\n * Preserves top-level keys for compatibility.\n */\nfunction aggregateResults(\n\ttargetResults: TargetResult[],\n\tscope: MigrateScope,\n\tisApply: boolean,\n): MigrateResult {\n\tconst hasError = targetResults.some((t) => t.status === \"error\")\n\tconst hasMigrated = targetResults.some((t) => t.status === \"migrated\" || t.status === \"preview\")\n\tconst allAlready = targetResults.every(\n\t\t(t) => t.status === \"already_v2\" || t.status === \"nothing_to_migrate\",\n\t)\n\n\tconst totalCount = targetResults.reduce((sum, t) => sum + t.count, 0)\n\tconst allComponents = targetResults.flatMap((t) => t.components)\n\tconst allConfigActions = targetResults.flatMap((t) => t.configActions)\n\n\tlet overallStatus: MigrateResult[\"status\"]\n\tif (hasError) {\n\t\toverallStatus = isApply ? \"partial_failure\" : \"preview_with_errors\"\n\t} else if (allAlready) {\n\t\t// Distinguish between \"all already_v2\" vs \"all nothing_to_migrate\"\n\t\tconst allNothing = targetResults.every((t) => t.status === \"nothing_to_migrate\")\n\t\toverallStatus = allNothing ? \"nothing_to_migrate\" : \"already_v2\"\n\t} else if (isApply) {\n\t\toverallStatus = hasMigrated ? \"migrated\" : \"already_v2\"\n\t} else {\n\t\toverallStatus = hasMigrated ? \"preview\" : \"already_v2\"\n\t}\n\n\treturn {\n\t\tsuccess: !hasError,\n\t\tstatus: overallStatus,\n\t\tscope,\n\t\tcount: totalCount,\n\t\tcomponents: allComponents,\n\t\tconfigActions: allConfigActions,\n\t\ttargets: targetResults,\n\t}\n}\n\nfunction hasPreviewBlockers(result: MigrateResult): boolean {\n\treturn result.status === \"preview_with_errors\"\n}\n\nfunction emitMigrateJson(result: MigrateResult, isApply: boolean): void {\n\tconst payload = withMigrateContract(result, isApply)\n\tconsole.log(JSON.stringify(payload, null, 2))\n}\n\nfunction withMigrateContract(result: MigrateResult, isApply: boolean): MigrateResult {\n\tconst targets = normalizeTargets(result)\n\tconst blockers = targets.flatMap((target) => target.blockers ?? [])\n\n\treturn {\n\t\t...result,\n\t\tlifecycle_status: mapLifecycleStatus(result.status, isApply),\n\t\tschema_version: MIGRATE_SCHEMA_VERSION,\n\t\tblockers,\n\t\ttargets,\n\t}\n}\n\nfunction normalizeTargets(result: MigrateResult): TargetResult[] {\n\tconst rawTargets =\n\t\tresult.targets && result.targets.length > 0 ? result.targets : [synthesizeTarget(result)]\n\treturn rawTargets.map((target) => normalizeTargetResult(target))\n}\n\nfunction synthesizeTarget(result: MigrateResult): TargetResult {\n\treturn {\n\t\ttarget: result.scope,\n\t\tstatus: result.status,\n\t\tcount: result.count,\n\t\tcomponents: result.components,\n\t\tconfigActions: result.configActions,\n\t\tblockers: result.blockers ?? [],\n\t}\n}\n\nfunction normalizeTargetResult(target: TargetResult): TargetResult {\n\tconst blockers =\n\t\ttarget.blockers ??\n\t\t(target.status === \"error\"\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"MIGRATE_BLOCKER\",\n\t\t\t\t\t\tmessage: target.error ?? \"Migration blocked\",\n\t\t\t\t\t\tpath: target.target,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: [])\n\n\treturn {\n\t\t...target,\n\t\tscope: target.scope ?? target.target,\n\t\tresult: target.result ?? target.status,\n\t\tblockers,\n\t}\n}\n\nfunction mapLifecycleStatus(\n\tstatus: MigrateResult[\"status\"],\n\tisApply: boolean,\n): MigrateLifecycleStatus {\n\tif (isApply) {\n\t\treturn status === \"partial_failure\" ? \"apply_failed\" : \"apply_ok\"\n\t}\n\n\treturn status === \"preview_with_errors\" ? \"preview_blocked\" : \"preview_ok\"\n}\n\nfunction createErrorTargetResult(target: string, error: unknown): TargetResult {\n\tconst blocker = toBlocker(error, target)\n\n\treturn {\n\t\ttarget,\n\t\tstatus: \"error\",\n\t\tcount: 0,\n\t\tcomponents: [],\n\t\tconfigActions: [],\n\t\terror: blocker.message,\n\t\tblockers: [blocker],\n\t}\n}\n\nfunction toBlocker(error: unknown, path: string): MigrateBlocker {\n\tconst message = error instanceof Error ? error.message : String(error)\n\treturn {\n\t\tcode: resolveBlockerCode(error, message),\n\t\tmessage,\n\t\tpath,\n\t}\n}\n\nfunction resolveBlockerCode(error: unknown, message: string): string {\n\tif (typeof error === \"object\" && error !== null && \"code\" in error) {\n\t\tconst code = (error as { code?: unknown }).code\n\t\tif (typeof code === \"string\" && code.length > 0) return code\n\t}\n\n\tconst lowerMessage = message.toLowerCase()\n\tif (lowerMessage.includes(\"ocx.jsonc\") || lowerMessage.includes(\"registry\")) {\n\t\treturn \"CONFIG_ERROR\"\n\t}\n\n\tif (lowerMessage.includes(\"parse\") || lowerMessage.includes(\"invalid\")) {\n\t\treturn \"VALIDATION_ERROR\"\n\t}\n\n\treturn \"MIGRATE_BLOCKER\"\n}\n\n// =============================================================================\n// SINGLE TARGET MIGRATION (preserves existing local behavior)\n// =============================================================================\n\nasync function runSingleTargetMigrate(\n\toptions: MigrateOptions,\n\tscope: MigrateScope,\n\troot: string,\n\tisFlattened: boolean,\n): Promise<void> {\n\t// Detect config normalization needs (pre-Zod raw parse)\n\tconst configActions = detectConfigActionsForScope(root)\n\n\t// Detect state: receipt exists?\n\tconst receipt = findReceipt(root)\n\tconst lockInfo = findOcxLock(root, { isFlattened })\n\tconst shouldArchiveStaleLock = receipt.exists && lockInfo.exists\n\n\t// Guard: already migrated (receipt exists) and no config normalization needed → safe no-op\n\tif (receipt.exists && configActions.length === 0 && !shouldArchiveStaleLock) {\n\t\tconst result: MigrateResult = {\n\t\t\tsuccess: true,\n\t\t\tstatus: \"already_v2\",\n\t\t\tscope,\n\t\t\tcount: 0,\n\t\t\tcomponents: [],\n\t\t\tconfigActions: [],\n\t\t}\n\n\t\tif (options.json) {\n\t\t\temitMigrateJson(result, Boolean(options.apply))\n\t\t\treturn\n\t\t}\n\n\t\tif (!options.quiet) {\n\t\t\tlogger.success(`[${scope}] Already migrated to receipt format (.ocx/receipt.jsonc).`)\n\t\t}\n\t\treturn\n\t}\n\n\t// Guard: no lock, no receipt, no config actions → nothing to do\n\tif (!lockInfo.exists && !receipt.exists && configActions.length === 0) {\n\t\tconst result: MigrateResult = {\n\t\t\tsuccess: true,\n\t\t\tstatus: \"nothing_to_migrate\",\n\t\t\tscope,\n\t\t\tcount: 0,\n\t\t\tcomponents: [],\n\t\t\tconfigActions: [],\n\t\t}\n\n\t\tif (options.json) {\n\t\t\temitMigrateJson(result, Boolean(options.apply))\n\t\t\treturn\n\t\t}\n\n\t\tif (!options.quiet) {\n\t\t\tlogger.info(`[${scope}] Nothing to migrate. No legacy ocx.lock found.`)\n\t\t}\n\t\treturn\n\t}\n\n\t// Build lock migration plan (if lock exists and receipt doesn't)\n\tlet lockMigrationPlan: {\n\t\tnewReceipt: import(\"../../schemas/config\").Receipt\n\t\tcomponents: MigrateResult[\"components\"]\n\t} | null = null\n\n\tif (lockInfo.exists && !receipt.exists) {\n\t\t// Parse legacy lock and config\n\t\tconst lock = await readOcxLock(root, { isFlattened })\n\t\tif (!lock) {\n\t\t\tthrow new ValidationError(\n\t\t\t\t\"Failed to parse ocx.lock. The lock file exists but could not be read or contains invalid data.\",\n\t\t\t)\n\t\t}\n\n\t\tconst config = await readOcxConfig(root)\n\t\tif (!config) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t\"No ocx.jsonc found. The config is required to resolve registry URLs during migration.\",\n\t\t\t)\n\t\t}\n\n\t\tconst { receipt: newReceipt, components } = buildReceiptFromLock(lock, config, root)\n\t\tlockMigrationPlan = { newReceipt, components }\n\t}\n\n\tconst components = lockMigrationPlan?.components ?? []\n\tconst count = components.length\n\n\t// Preview mode (default): show plan, no writes\n\tif (!options.apply) {\n\t\tconst result: MigrateResult = {\n\t\t\tsuccess: true,\n\t\t\tstatus: \"preview\",\n\t\t\tscope,\n\t\t\tcount,\n\t\t\tcomponents,\n\t\t\tconfigActions,\n\t\t}\n\n\t\tif (options.json) {\n\t\t\temitMigrateJson(result, false)\n\t\t\treturn\n\t\t}\n\n\t\tif (!options.quiet) {\n\t\t\tif (count > 0) {\n\t\t\t\tlogger.info(`[${scope}] Migration preview: ${count} component(s) would be migrated.`)\n\t\t\t\tlogger.break()\n\n\t\t\t\tfor (const comp of components) {\n\t\t\t\t\tlogger.info(` ${comp.legacyKey} → ${comp.canonicalId}`)\n\t\t\t\t}\n\t\t\t\tlogger.break()\n\t\t\t}\n\n\t\t\tif (shouldArchiveStaleLock) {\n\t\t\t\tlogger.info(\n\t\t\t\t\t`[${scope}] Legacy ocx.lock would be backed up and removed (receipt already exists).`,\n\t\t\t\t)\n\t\t\t\tlogger.break()\n\t\t\t}\n\n\t\t\tif (configActions.length > 0) {\n\t\t\t\tlogger.info(\n\t\t\t\t\t`[${scope}] Config normalization: ${configActions.length} deprecated field(s) would be removed.`,\n\t\t\t\t)\n\t\t\t\tfor (const action of configActions) {\n\t\t\t\t\tlogger.info(` registries.${action.registry}.${action.field} → remove`)\n\t\t\t\t}\n\t\t\t\tlogger.break()\n\t\t\t}\n\n\t\t\tif (count === 0 && configActions.length === 0 && !shouldArchiveStaleLock) {\n\t\t\t\tlogger.info(`[${scope}] Nothing to migrate.`)\n\t\t\t} else {\n\t\t\t\tlogger.info(\"No changes made. Run with --apply to perform migration.\")\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Apply mode: write receipt, rename lock → .bak, normalize config\n\tif (lockMigrationPlan) {\n\t\tawait writeReceipt(root, lockMigrationPlan.newReceipt)\n\n\t\tconst bakPath = resolveBackupPath(lockInfo.path)\n\t\tawait rename(lockInfo.path, bakPath)\n\n\t\tif (!options.json && !options.quiet) {\n\t\t\tlogger.success(\n\t\t\t\t`[${scope}] Migrated ${count} component(s) to receipt format (.ocx/receipt.jsonc).`,\n\t\t\t)\n\t\t\tlogger.break()\n\n\t\t\tfor (const comp of components) {\n\t\t\t\tlogger.success(` ✓ ${comp.legacyKey} → ${comp.canonicalId}`)\n\t\t\t}\n\n\t\t\tlogger.break()\n\t\t\tlogger.info(`Legacy lock backed up to: ${bakPath}`)\n\t\t}\n\t}\n\n\tif (shouldArchiveStaleLock) {\n\t\tconst bakPath = resolveBackupPath(lockInfo.path)\n\t\tawait rename(lockInfo.path, bakPath)\n\n\t\tif (!options.json && !options.quiet) {\n\t\t\tlogger.success(`[${scope}] Removed stale legacy lock (receipt already exists).`)\n\t\t\tlogger.info(`Legacy lock backed up to: ${bakPath}`)\n\t\t}\n\t}\n\n\t// Apply config normalization\n\tif (configActions.length > 0) {\n\t\tawait applyConfigNormalizationToFile(root, configActions)\n\n\t\tif (!options.json && !options.quiet) {\n\t\t\tif (lockMigrationPlan) logger.break()\n\t\t\tlogger.success(`[${scope}] Normalized ${configActions.length} deprecated config field(s).`)\n\t\t\tfor (const action of configActions) {\n\t\t\t\tlogger.success(` ✓ registries.${action.registry}.${action.field} removed`)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst didWrite = lockMigrationPlan !== null || shouldArchiveStaleLock || configActions.length > 0\n\tconst result: MigrateResult = {\n\t\tsuccess: true,\n\t\tstatus: didWrite ? \"migrated\" : \"already_v2\",\n\t\tscope,\n\t\tcount,\n\t\tcomponents,\n\t\tconfigActions,\n\t}\n\n\tif (options.json) {\n\t\temitMigrateJson(result, true)\n\t\treturn\n\t}\n\n\t// If no lock migration and only config actions, summarize\n\tif (!lockMigrationPlan && configActions.length > 0 && !options.quiet) {\n\t\tlogger.break()\n\t\tlogger.success(`[${scope}] Config normalization complete.`)\n\t}\n}\n\n// =============================================================================\n// GLOBAL OUTPUT HELPERS\n// =============================================================================\n\nfunction logGlobalPreview(\n\ttargetResults: TargetResult[],\n\taggregated: MigrateResult,\n\tstaleLockCleanupPendingTargets: Set<string>,\n): void {\n\tif (aggregated.status === \"nothing_to_migrate\") {\n\t\tlogger.info(\"[global] Nothing to migrate across all targets.\")\n\t\treturn\n\t}\n\n\tif (aggregated.status === \"already_v2\") {\n\t\tlogger.success(\"[global] All targets already migrated.\")\n\t\treturn\n\t}\n\n\tlogger.info(`[global] Migration preview across ${targetResults.length} target(s):`)\n\tlogger.break()\n\n\tfor (const t of targetResults) {\n\t\tconst shouldIncludeStaleLockCleanup = staleLockCleanupPendingTargets.has(t.target)\n\t\tconst actionsSummary = describeTargetActions(t, shouldIncludeStaleLockCleanup)\n\t\tlogger.info(` ${t.target}: ${actionsSummary}`)\n\t}\n\n\tlogger.break()\n\n\tif (aggregated.status === \"preview_with_errors\") {\n\t\tlogger.warn(\"[global] Preview completed with errors on some targets. See above for details.\")\n\t\tlogger.info(\"No changes made. Run with --apply to perform migration.\")\n\t} else {\n\t\tlogger.info(\"No changes made. Run with --apply to perform migration.\")\n\t}\n}\n\nfunction logGlobalApplySummary(targetResults: TargetResult[], hasFailure: boolean): void {\n\tlogger.break()\n\n\tconst migrated = targetResults.filter((t) => t.status === \"migrated\")\n\tconst already = targetResults.filter(\n\t\t(t) => t.status === \"already_v2\" || t.status === \"nothing_to_migrate\",\n\t)\n\tconst failed = targetResults.filter((t) => t.status === \"error\")\n\n\tif (migrated.length > 0) {\n\t\tlogger.success(`[global] Migrated ${migrated.length} target(s):`)\n\t\tfor (const t of migrated) {\n\t\t\tlogger.success(` ✓ ${t.target}`)\n\t\t}\n\t}\n\n\tif (already.length > 0) {\n\t\tlogger.info(`[global] ${already.length} target(s) already up to date.`)\n\t}\n\n\tif (failed.length > 0) {\n\t\tlogger.error(`[global] ${failed.length} target(s) failed:`)\n\t\tfor (const t of failed) {\n\t\t\tlogger.error(` ✗ ${t.target}: ${t.error}`)\n\t\t}\n\t}\n\n\tif (hasFailure) {\n\t\tlogger.break()\n\t\tlogger.error(\"[global] Migration completed with errors. See above for details.\")\n\t}\n}\n\nfunction describeTargetActions(t: TargetResult, shouldIncludeStaleLockCleanup: boolean): string {\n\tif (t.status === \"error\") return \"error\"\n\tif (t.status === \"already_v2\") return \"already migrated\"\n\tif (t.status === \"nothing_to_migrate\") return \"nothing to migrate\"\n\n\tconst parts: string[] = []\n\tif (t.count > 0) {\n\t\tparts.push(`${t.count} component(s) to migrate`)\n\t}\n\tif (t.configActions.length > 0) {\n\t\tparts.push(`${t.configActions.length} config field(s) to normalize`)\n\t}\n\tif (shouldIncludeStaleLockCleanup) {\n\t\tparts.push(\"legacy lock cleanup pending\")\n\t}\n\tif (parts.length === 0) return \"nothing to migrate\"\n\treturn parts.join(\", \")\n}\n\n// =============================================================================\n// HELPERS\n// =============================================================================\n\n/**\n * Resolve the migration root directory.\n *\n * - Local mode: uses --cwd or process.cwd()\n * - Global mode: uses --cwd if explicit, otherwise getGlobalConfigPath()\n *\n * This allows tests to override the global path via --cwd.\n */\nfunction resolveRoot(options: MigrateOptions): string {\n\tif (options.global) {\n\t\treturn options.cwd ?? getGlobalConfigPath()\n\t}\n\treturn options.cwd ?? process.cwd()\n}\n\n/**\n * Resolve a non-colliding backup path for the lock file.\n * Tries `.bak`, then `.bak.1`, `.bak.2`, etc.\n */\nfunction resolveBackupPath(lockPath: string): string {\n\tconst base = `${lockPath}.bak`\n\tif (!existsSync(base)) return base\n\n\tfor (let i = 1; i <= 100; i++) {\n\t\tconst candidate = `${base}.${i}`\n\t\tif (!existsSync(candidate)) return candidate\n\t}\n\n\t// Fallback: timestamp-based (effectively unreachable)\n\treturn `${base}.${Date.now()}`\n}\n\n/**\n * Read raw config (pre-Zod) to detect deprecated fields.\n * Returns empty actions if no config file is found.\n */\nfunction detectConfigActionsForScope(root: string): ConfigNormalizationAction[] {\n\tconst configInfo = findOcxConfig(root)\n\tif (!configInfo.exists) return []\n\n\ttry {\n\t\tconst raw = readFileSync(configInfo.path, \"utf-8\")\n\t\tconst parsed = parseJsonc(raw, [], { allowTrailingComma: true })\n\t\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) return []\n\n\t\treturn detectConfigNormalization(parsed as Record<string, unknown>)\n\t} catch {\n\t\treturn []\n\t}\n}\n\n/**\n * Formatting options for jsonc-parser edits during config normalization.\n * Matches the project's standard 2-space tab convention for JSON configs.\n */\nconst JSONC_EDIT_OPTIONS: ModificationOptions = {\n\tformattingOptions: {\n\t\ttabSize: 2,\n\t\tinsertSpaces: true,\n\t\teol: \"\\n\",\n\t},\n}\n\n/**\n * Apply config normalization by removing deprecated fields in-place.\n * Uses jsonc-parser's modify/applyEdits to preserve JSONC comments and formatting.\n * Deterministic and idempotent: each action maps to a single property removal.\n */\nasync function applyConfigNormalizationToFile(\n\troot: string,\n\tactions: ConfigNormalizationAction[],\n): Promise<void> {\n\tif (actions.length === 0) return\n\n\tconst configInfo = findOcxConfig(root)\n\tif (!configInfo.exists) return\n\n\tlet content = readFileSync(configInfo.path, \"utf-8\")\n\n\tfor (const action of actions) {\n\t\tconst edits = modify(\n\t\t\tcontent,\n\t\t\t[\"registries\", action.registry, action.field],\n\t\t\tundefined,\n\t\t\tJSONC_EDIT_OPTIONS,\n\t\t)\n\t\tcontent = applyEdits(content, edits)\n\t}\n\n\tawait writeFile(configInfo.path, content)\n}\n",
107
- "/**\n * Migration module: Legacy ocx.lock → V2 .ocx/receipt.jsonc\n *\n * Isolated transform logic for converting v1.4.6 lock entries into\n * canonical receipt entries, plus registry config normalization.\n * No side effects — pure data transform.\n */\n\nimport type { InstalledComponent, OcxConfig, OcxLock, Receipt } from \"../../schemas/config\"\nimport { createCanonicalId } from \"../../schemas/config\"\nimport { ConfigError } from \"../../utils/errors\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport type MigrateScope = \"local\" | \"global\"\n\nexport type MigrateStatus =\n\t| \"nothing_to_migrate\"\n\t| \"already_v2\"\n\t| \"preview\"\n\t| \"preview_with_errors\"\n\t| \"migrated\"\n\t| \"partial_failure\"\n\nexport type MigrateLifecycleStatus = \"preview_ok\" | \"preview_blocked\" | \"apply_ok\" | \"apply_failed\"\n\nexport interface MigrateBlocker {\n\tcode: string\n\tmessage: string\n\tpath: string\n}\n\n/** Describes a single registry config normalization action */\nexport interface ConfigNormalizationAction {\n\tregistry: string\n\tfield: string\n\taction: \"remove_deprecated\"\n}\n\nexport interface MigrateResult {\n\tsuccess: boolean\n\tstatus: MigrateStatus\n\t/** Additive status field for the migrate contract */\n\tlifecycle_status?: MigrateLifecycleStatus\n\t/** Additive schema version field for the migrate contract */\n\tschema_version?: 1\n\t/** Additive aggregate blockers for the migrate contract */\n\tblockers?: MigrateBlocker[]\n\tscope: MigrateScope\n\tcount: number\n\tcomponents: Array<{\n\t\tlegacyKey: string\n\t\tcanonicalId: string\n\t\tname: string\n\t\tregistryName: string\n\t}>\n\tconfigActions: ConfigNormalizationAction[]\n\t/** Per-target results when --global processes root + profiles */\n\ttargets?: TargetResult[]\n}\n\n/** Result for a single migration target (global root or profile) */\nexport interface TargetResult {\n\ttarget: string\n\t/** Additive target identity field for the migrate contract */\n\tscope?: string\n\tstatus: MigrateStatus | \"error\"\n\t/** Additive target result field for the migrate contract */\n\tresult?: MigrateStatus | \"error\"\n\t/** Additive target blockers field for the migrate contract */\n\tblockers?: MigrateBlocker[]\n\tcount: number\n\tcomponents: MigrateResult[\"components\"]\n\tconfigActions: ConfigNormalizationAction[]\n\terror?: string\n}\n\n// =============================================================================\n// TRANSFORM (Pure, deterministic)\n// =============================================================================\n\n/**\n * Transform a single legacy lock entry into a V2 installed component.\n *\n * Legacy format:\n * key = \"alias/component\"\n * entry = { registry, version, hash, files: string[], installedAt, updatedAt? }\n *\n * V2 format:\n * key = canonical ID (\"registryUrl::registryName/component@revision\")\n * entry = { registryUrl, registryName, name, revision, hash, files: {path,hash}[], ... }\n *\n * @param legacyKey - Legacy qualified key (e.g., \"kdco/researcher\")\n * @param entry - Legacy installed component entry\n * @param registryUrl - Resolved registry URL from ocx.jsonc config\n * @returns Tuple of [canonicalId, InstalledComponent]\n */\nexport function transformLegacyEntry(\n\tlegacyKey: string,\n\tentry: OcxLock[\"installed\"][string],\n\tregistryUrl: string,\n): [string, InstalledComponent] {\n\t// Guard: key must contain slash\n\tconst slashIndex = legacyKey.indexOf(\"/\")\n\tif (slashIndex === -1) {\n\t\tthrow new Error(`Invalid legacy key: \"${legacyKey}\". Expected format: alias/component`)\n\t}\n\n\tconst registryName = legacyKey.slice(0, slashIndex)\n\tconst name = legacyKey.slice(slashIndex + 1)\n\n\t// Guard: both parts must be non-empty\n\tif (!registryName || !name) {\n\t\tthrow new Error(`Invalid legacy key: \"${legacyKey}\". Both alias and component are required.`)\n\t}\n\n\tconst canonicalId = createCanonicalId(registryUrl, registryName, name, entry.version)\n\n\tconst component: InstalledComponent = {\n\t\tregistryUrl,\n\t\tregistryName,\n\t\tname,\n\t\trevision: entry.version,\n\t\thash: entry.hash,\n\t\tfiles: entry.files.map((filePath) => ({\n\t\t\tpath: filePath,\n\t\t\t// Legacy lock doesn't store per-file hashes — use empty string as sentinel\n\t\t\thash: \"\",\n\t\t})),\n\t\tinstalledAt: entry.installedAt,\n\t\t...(entry.updatedAt && { updatedAt: entry.updatedAt }),\n\t\towner: { type: \"user\" },\n\t}\n\n\treturn [canonicalId, component]\n}\n\n/**\n * Build a complete V2 receipt from a legacy lock and config.\n *\n * Deterministic: same inputs always produce same output.\n * Entries are sorted by canonical ID for stable JSON output.\n *\n * @param lock - Parsed legacy ocx.lock\n * @param config - Parsed ocx.jsonc with registry URLs\n * @param root - Install root path to record in receipt (optional)\n * @returns Receipt and migration metadata\n */\nexport function buildReceiptFromLock(\n\tlock: OcxLock,\n\tconfig: OcxConfig,\n\troot?: string,\n): { receipt: Receipt; components: MigrateResult[\"components\"] } {\n\tconst installed: Record<string, InstalledComponent> = {}\n\tconst components: MigrateResult[\"components\"] = []\n\n\t// Sort legacy keys for deterministic output\n\tconst sortedKeys = Object.keys(lock.installed).sort()\n\n\tfor (const legacyKey of sortedKeys) {\n\t\tconst entry = lock.installed[legacyKey]\n\t\tif (!entry) continue\n\n\t\t// Resolve registry URL from config\n\t\tconst registryConfig = config.registries[entry.registry]\n\t\tif (!registryConfig) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t`Registry \"${entry.registry}\" referenced in lock key \"${legacyKey}\" ` +\n\t\t\t\t\t`is not configured in ocx.jsonc. Add it before migrating.`,\n\t\t\t)\n\t\t}\n\n\t\tconst [canonicalId, component] = transformLegacyEntry(legacyKey, entry, registryConfig.url)\n\n\t\tinstalled[canonicalId] = component\n\t\tcomponents.push({\n\t\t\tlegacyKey,\n\t\t\tcanonicalId,\n\t\t\tname: component.name,\n\t\t\tregistryName: component.registryName,\n\t\t})\n\t}\n\n\tconst receipt: Receipt = {\n\t\tversion: 1,\n\t\t...(root && { root }),\n\t\tinstalled,\n\t}\n\n\treturn { receipt, components }\n}\n\n// =============================================================================\n// REGISTRY CONFIG NORMALIZATION (Pure, deterministic)\n// =============================================================================\n\n/** Known deprecated fields from legacy v1.4.6 registry config */\nconst DEPRECATED_REGISTRY_FIELDS = [\"version\"] as const\n\n/**\n * Detect deprecated `version` fields in registry config entries.\n *\n * Legacy v1.4.6 allowed `registries.<alias>.version` for pinning.\n * Current schema only allows `url` and `headers`. This function\n * inspects raw config data (pre-Zod-parse) to find deprecated keys.\n *\n * Pure function: returns planned actions, never mutates.\n *\n * @param rawConfig - Raw config object (may contain extra keys stripped by Zod)\n * @returns Array of normalization actions to apply\n */\nexport function detectConfigNormalization(\n\trawConfig: Record<string, unknown>,\n): ConfigNormalizationAction[] {\n\tconst registries = rawConfig.registries\n\tif (!registries || typeof registries !== \"object\" || Array.isArray(registries)) {\n\t\treturn []\n\t}\n\n\tconst actions: ConfigNormalizationAction[] = []\n\tconst registryMap = registries as Record<string, unknown>\n\n\tfor (const alias of Object.keys(registryMap).sort()) {\n\t\tconst entry = registryMap[alias]\n\t\tif (!entry || typeof entry !== \"object\" || Array.isArray(entry)) continue\n\n\t\tconst entryRecord = entry as Record<string, unknown>\n\t\tfor (const field of DEPRECATED_REGISTRY_FIELDS) {\n\t\t\tif (field in entryRecord) {\n\t\t\t\tactions.push({\n\t\t\t\t\tregistry: alias,\n\t\t\t\t\tfield,\n\t\t\t\t\taction: \"remove_deprecated\",\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn actions\n}\n",
108
- "/**\n * OpenCode Command\n *\n * Launch OpenCode with resolved configuration.\n * Uses ConfigResolver with registry isolation (profile OR local, not merged).\n * OpenCode config and instructions are additively merged when not excluded.\n * Spawns OpenCode with the resolved configuration.\n */\n\nimport * as path from \"node:path\"\nimport type { Command } from \"commander\"\nimport { ConfigResolver } from \"../config/resolver\"\nimport { getProfileDir, getProfileOpencodeConfig } from \"../profile/paths\"\nimport { getGitInfo } from \"../utils/git-context\"\nimport { handleError, logger } from \"../utils/index\"\nimport { getGlobalConfigPath } from \"../utils/paths\"\nimport {\n\tformatTerminalName,\n\trestoreTerminalTitle,\n\tsaveTerminalTitle,\n\tsetTerminalName,\n} from \"../utils/terminal-title\"\nimport {\n\tcreateOpencodeOcError,\n\ttype PreparedMergedConfigDir,\n\tprepareMergedConfigDirForProfile,\n} from \"./opencode-overlay\"\n\ninterface OpencodeOptions {\n\tprofile?: string\n\trename?: boolean\n}\n\n/**\n * Deduplicates an array while preserving last occurrence.\n * Last-wins behavior: if duplicates exist, keeps the LAST occurrence.\n *\n * Example: [\"a\", \"b\", \"a\", \"c\"] -> [\"b\", \"a\", \"c\"]\n * (first \"a\" is removed, last \"a\" is kept)\n *\n * @internal - Exported for testing\n */\nexport function dedupeLastWins<T>(items: T[]): T[] {\n\tconst seen = new Set<T>()\n\tconst result: T[] = []\n\n\t// Iterate backwards to find last occurrences\n\tfor (let i = items.length - 1; i >= 0; i--) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: index i is guaranteed valid within bounds\n\t\tconst item = items[i]!\n\t\tif (!seen.has(item)) {\n\t\t\tseen.add(item)\n\t\t\tresult.unshift(item) // Prepend to maintain order\n\t\t}\n\t}\n\n\treturn result\n}\n\n/**\n * Resolves which opencode binary to use.\n * Priority: configBin > envBin > \"opencode\"\n *\n * Uses nullish coalescing (??) to preserve original behavior:\n * - Empty string \"\" is passed through (will cause spawn error, but that's intentional)\n * - Only undefined/null falls through to the next option\n */\nexport function resolveOpenCodeBinary(opts: { configBin?: string; envBin?: string }): string {\n\treturn opts.configBin ?? opts.envBin ?? \"opencode\"\n}\n\nfunction isPathLikeLauncherToken(token: string): boolean {\n\treturn token.includes(\"/\") || token.includes(\"\\\\\")\n}\n\n/**\n * Resolve launcher token to a cwd-stable executable path.\n *\n * - Path-like tokens (absolute/relative) are normalized to absolute paths.\n * - Bare command names are resolved through PATH via Bun.which.\n * - Throws when PATH lookup fails, because OCX context requires a stable launcher path.\n */\nexport function resolveStableOpenCodeLauncherPath(opts: {\n\tconfiguredBin: string\n\tcwd: string\n\tresolveExecutable?: (command: string) => string | null | undefined\n}): string {\n\tconst { configuredBin, cwd } = opts\n\tconst resolveExecutable = opts.resolveExecutable ?? ((command: string) => Bun.which(command))\n\n\tif (!configuredBin.trim()) {\n\t\tthrow new Error(\"OpenCode launcher is empty and cannot be resolved to a stable path\")\n\t}\n\n\tif (isPathLikeLauncherToken(configuredBin)) {\n\t\treturn path.isAbsolute(configuredBin) ? configuredBin : path.resolve(cwd, configuredBin)\n\t}\n\n\tconst resolvedFromPath = resolveExecutable(configuredBin)\n\tif (!resolvedFromPath) {\n\t\tthrow new Error(\n\t\t\t`OpenCode launcher \"${configuredBin}\" is not available in PATH and cannot be used as OPENCODE_BIN`,\n\t\t)\n\t}\n\n\treturn path.isAbsolute(resolvedFromPath) ? resolvedFromPath : path.resolve(cwd, resolvedFromPath)\n}\n\nexport function resolveStableOcxExecutablePath(opts: {\n\tcwd: string\n\tinheritedOcxBin?: string\n\targv?: string[]\n\texecPath?: string\n\tresolveExecutable?: (command: string) => string | null | undefined\n\tisCompiledBinary?: boolean\n}): string {\n\tconst resolveExecutable = opts.resolveExecutable ?? ((command: string) => Bun.which(command))\n\tconst argv = opts.argv ?? process.argv\n\tconst execPath = opts.execPath ?? process.execPath\n\tconst isCompiledBinary =\n\t\topts.isCompiledBinary ??\n\t\t(typeof Bun !== \"undefined\" && typeof Bun.main === \"string\" && Bun.main.startsWith(\"/$bunfs/\"))\n\tconst inheritedOcxBin = opts.inheritedOcxBin?.trim()\n\tconst runtimeExecutable = isCompiledBinary ? execPath : argv[1]\n\n\tconst candidate =\n\t\tinheritedOcxBin && inheritedOcxBin.length > 0 ? inheritedOcxBin : runtimeExecutable\n\n\tif (!candidate?.trim()) {\n\t\tthrow new Error(\"OCX executable path is empty and cannot be resolved from the current process\")\n\t}\n\n\tif (isPathLikeLauncherToken(candidate)) {\n\t\treturn path.isAbsolute(candidate) ? candidate : path.resolve(opts.cwd, candidate)\n\t}\n\n\tconst resolvedFromPath = resolveExecutable(candidate)\n\tif (!resolvedFromPath) {\n\t\tthrow new Error(\n\t\t\t`OCX executable \"${candidate}\" is not available in PATH and cannot be persisted as OCX_BIN`,\n\t\t)\n\t}\n\n\treturn path.isAbsolute(resolvedFromPath)\n\t\t? resolvedFromPath\n\t\t: path.resolve(opts.cwd, resolvedFromPath)\n}\n\n/**\n * Builds environment variables to pass to the opencode process.\n * Returns a NEW object - does not mutate baseEnv.\n *\n * Behavior:\n * - Preserves all keys from baseEnv\n * - Overwrites OCX_PROFILE, OPENCODE_* keys with new values\n * - Exports OCX_CONTEXT/OCX_BIN only when a profile launch context is active\n * - OPENCODE_DISABLE_PROJECT_CONFIG: set to \"true\" ONLY when a profile is active\n * (profileName is provided). When no profile, project config is NOT disabled.\n * - OPENCODE_CONFIG_DIR: when configDir is provided → use it;\n * otherwise profile active → profile-specific dir; no profile → global config dir\n * - configContent is a pre-serialized JSON string; upstream OpenCode handles\n * {env:...} / {file:...} token resolution in OPENCODE_CONFIG_CONTENT\n */\nexport function buildOpenCodeEnv(opts: {\n\tbaseEnv: Record<string, string | undefined>\n\tprofileName?: string\n\tocxBin?: string\n\topencodeBin?: string\n\tconfigDir?: string\n\tconfigContent?: string\n}): Record<string, string | undefined> {\n\t// Profile presence gates both OPENCODE_DISABLE_PROJECT_CONFIG and OPENCODE_CONFIG_DIR\n\tconst hasProfile = Boolean(opts.profileName)\n\t// Never leak stale inherited disable flag into no-profile launches.\n\tconst {\n\t\tOPENCODE_DISABLE_PROJECT_CONFIG: _inheritedDisableProjectConfig,\n\t\tOPENCODE_BIN: _inheritedOpencodeBin,\n\t\tOCX_CONTEXT: _inheritedOcxContext,\n\t\tOCX_BIN: _inheritedOcxBin,\n\t\tOCX_PROFILE: _inheritedOcxProfile,\n\t\t...baseEnvWithoutDisableProjectConfig\n\t} = opts.baseEnv\n\n\treturn {\n\t\t...baseEnvWithoutDisableProjectConfig,\n\t\t...(opts.opencodeBin !== undefined && { OPENCODE_BIN: opts.opencodeBin }),\n\t\t...(hasProfile && { OPENCODE_DISABLE_PROJECT_CONFIG: \"true\" }),\n\t\tOPENCODE_CONFIG_DIR:\n\t\t\topts.configDir ??\n\t\t\t(hasProfile ? getProfileDir(opts.profileName as string) : getGlobalConfigPath()),\n\t\t...(opts.configContent && { OPENCODE_CONFIG_CONTENT: opts.configContent }),\n\t\t...(hasProfile && { OCX_CONTEXT: \"1\" }),\n\t\t...(hasProfile && opts.ocxBin && { OCX_BIN: opts.ocxBin }),\n\t\t...(opts.profileName && { OCX_PROFILE: opts.profileName }),\n\t}\n}\n\nexport function registerOpencodeCommand(program: Command): void {\n\tprogram\n\t\t.command(\"oc\")\n\t\t.alias(\"opencode\")\n\t\t.description(\"Launch OpenCode with resolved configuration\")\n\t\t.option(\"-p, --profile <name>\", \"Use specific profile\")\n\t\t.option(\"--no-rename\", \"Disable terminal/tmux window renaming\")\n\t\t.allowUnknownOption()\n\t\t.allowExcessArguments(true)\n\t\t.action(async (options: OpencodeOptions, command: Command) => {\n\t\t\ttry {\n\t\t\t\tawait runOpencode(command.args, options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error)\n\t\t\t}\n\t\t})\n}\n\nasync function runOpencode(args: string[], options: OpencodeOptions): Promise<void> {\n\t// Resolve project directory\n\tconst projectDir = process.cwd()\n\n\t// Create resolver with optional profile override\n\tconst resolver = await ConfigResolver.create(projectDir, { profile: options.profile })\n\tconst config = resolver.resolve()\n\tconst profile = resolver.getProfile()\n\n\t// Print feedback about which profile is being used\n\tif (config.profileName) {\n\t\tlogger.info(`Using profile: ${config.profileName}`)\n\t}\n\n\t// Determine if terminal should be renamed\n\t// Precedence: CLI flag > config > default(true)\n\tconst ocxConfig = profile?.ocx\n\tconst shouldRename = options.rename !== false && ocxConfig?.renameWindow !== false\n\n\t// Check for profile's opencode.jsonc (optional)\n\tif (config.profileName) {\n\t\tconst profileOpencodePath = getProfileOpencodeConfig(config.profileName)\n\t\tconst profileOpencodeFile = Bun.file(profileOpencodePath)\n\t\tconst hasOpencodeConfig = await profileOpencodeFile.exists()\n\t\tif (!hasOpencodeConfig) {\n\t\t\tlogger.warn(\n\t\t\t\t`No opencode.jsonc found at ${profileOpencodePath}. Create one to customize OpenCode settings.`,\n\t\t\t)\n\t\t}\n\t}\n\n\t// Build the config to pass to OpenCode\n\t// Merge discovered instructions with user-configured instructions\n\t// Order: discovered/global/profile/registry/project first, then user config instructions last (highest priority)\n\tconst userInstructions = Array.isArray(config.opencode.instructions)\n\t\t? config.opencode.instructions\n\t\t: []\n\tconst allInstructions = [...config.instructions, ...userInstructions]\n\t// Deduplicate while preserving last occurrence (last-wins)\n\tconst dedupedInstructions = dedupeLastWins(allInstructions)\n\n\tconst configToPass =\n\t\tdedupedInstructions.length > 0 || Object.keys(config.opencode).length > 0\n\t\t\t? {\n\t\t\t\t\t...config.opencode,\n\t\t\t\t\tinstructions: dedupedInstructions.length > 0 ? dedupedInstructions : undefined,\n\t\t\t\t}\n\t\t\t: undefined\n\n\t// Setup signal handlers BEFORE spawn to avoid race condition\n\tlet proc: ReturnType<typeof Bun.spawn> | null = null\n\tlet mergedConfig: PreparedMergedConfigDir | null = null\n\tlet primaryFailure: Error | null = null\n\tlet childExitCode: number | null = null\n\tlet preSpawnSignalExitCode: number | null = null\n\n\tconst sigintHandler = () => {\n\t\tif (proc) {\n\t\t\tproc.kill(\"SIGINT\")\n\t\t} else {\n\t\t\tpreSpawnSignalExitCode = 130\n\t\t}\n\t}\n\n\tconst sigtermHandler = () => {\n\t\tif (proc) {\n\t\t\tproc.kill(\"SIGTERM\")\n\t\t} else {\n\t\t\tpreSpawnSignalExitCode = 143\n\t\t}\n\t}\n\n\tconst exitHandler = () => {\n\t\tif (shouldRename) {\n\t\t\trestoreTerminalTitle()\n\t\t}\n\t}\n\n\ttry {\n\t\tprocess.on(\"SIGINT\", sigintHandler)\n\t\tprocess.on(\"SIGTERM\", sigtermHandler)\n\t\tprocess.on(\"exit\", exitHandler)\n\n\t\tif (preSpawnSignalExitCode !== null) {\n\t\t\tchildExitCode = preSpawnSignalExitCode\n\t\t\treturn\n\t\t}\n\n\t\tif (config.profileName) {\n\t\t\tmergedConfig = await prepareMergedConfigDirForProfile({\n\t\t\t\tprojectDir,\n\t\t\t\tprofileDir: getProfileDir(config.profileName),\n\t\t\t})\n\t\t}\n\n\t\tif (preSpawnSignalExitCode !== null) {\n\t\t\tchildExitCode = preSpawnSignalExitCode\n\t\t\treturn\n\t\t}\n\n\t\t// Set terminal name only if enabled\n\t\tif (shouldRename) {\n\t\t\tsaveTerminalTitle()\n\t\t\tconst gitInfo = await getGitInfo(projectDir)\n\t\t\tif (preSpawnSignalExitCode !== null) {\n\t\t\t\tchildExitCode = preSpawnSignalExitCode\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetTerminalName(formatTerminalName(projectDir, config.profileName ?? \"default\", gitInfo))\n\t\t}\n\n\t\tif (preSpawnSignalExitCode !== null) {\n\t\t\tchildExitCode = preSpawnSignalExitCode\n\t\t\treturn\n\t\t}\n\n\t\t// Determine OpenCode binary\n\t\tconst configuredBin = resolveOpenCodeBinary({\n\t\t\tconfigBin: ocxConfig?.bin,\n\t\t\tenvBin: process.env.OPENCODE_BIN,\n\t\t})\n\n\t\tconst hasProfileLaunchContext = Boolean(config.profileName)\n\t\tconst resolvedOpenCodeLaunchBin = hasProfileLaunchContext\n\t\t\t? resolveStableOpenCodeLauncherPath({\n\t\t\t\t\tconfiguredBin,\n\t\t\t\t\tcwd: projectDir,\n\t\t\t\t})\n\t\t\t: configuredBin\n\t\tconst resolvedOcxBin = hasProfileLaunchContext\n\t\t\t? resolveStableOcxExecutablePath({\n\t\t\t\t\tcwd: projectDir,\n\t\t\t\t\tinheritedOcxBin: process.env.OCX_BIN,\n\t\t\t\t})\n\t\t\t: undefined\n\n\t\t// Spawn OpenCode directly in the project directory with config via environment\n\t\tconst configContent = configToPass ? JSON.stringify(configToPass) : undefined\n\n\t\ttry {\n\t\t\tproc = Bun.spawn({\n\t\t\t\tcmd: [resolvedOpenCodeLaunchBin, ...args],\n\t\t\t\tcwd: projectDir,\n\t\t\t\tenv: buildOpenCodeEnv({\n\t\t\t\t\tbaseEnv: process.env as Record<string, string | undefined>,\n\t\t\t\t\tprofileName: config.profileName ?? undefined,\n\t\t\t\t\tocxBin: resolvedOcxBin,\n\t\t\t\t\topencodeBin: resolvedOpenCodeLaunchBin,\n\t\t\t\t\tconfigDir: mergedConfig?.path,\n\t\t\t\t\tconfigContent,\n\t\t\t\t}),\n\t\t\t\tstdin: \"inherit\",\n\t\t\t\tstdout: \"inherit\",\n\t\t\t\tstderr: \"inherit\",\n\t\t\t})\n\t\t} catch (error: unknown) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"spawn\",\n\t\t\t\t`Failed to launch OpenCode binary \"${configuredBin}\": ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t)\n\t\t}\n\n\t\t// Wait for child to exit\n\t\tchildExitCode = await proc.exited\n\t} catch (error: unknown) {\n\t\tprimaryFailure =\n\t\t\terror instanceof Error\n\t\t\t\t? error\n\t\t\t\t: createOpencodeOcError(\"spawn\", `OpenCode process failed: ${String(error)}`)\n\t} finally {\n\t\t// Cleanup signal handlers\n\t\tprocess.off(\"SIGINT\", sigintHandler)\n\t\tprocess.off(\"SIGTERM\", sigtermHandler)\n\t\tprocess.off(\"exit\", exitHandler)\n\n\t\tif (shouldRename) {\n\t\t\trestoreTerminalTitle()\n\t\t}\n\n\t\tif (mergedConfig) {\n\t\t\ttry {\n\t\t\t\tawait mergedConfig.cleanup()\n\t\t\t} catch (cleanupError: unknown) {\n\t\t\t\tconst hasPrimaryFailure =\n\t\t\t\t\tprimaryFailure !== null ||\n\t\t\t\t\tpreSpawnSignalExitCode !== null ||\n\t\t\t\t\t(childExitCode !== null && childExitCode !== 0)\n\n\t\t\t\tif (hasPrimaryFailure) {\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`Cleanup warning: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tconst cleanupFailure: Error =\n\t\t\t\t\t\tcleanupError instanceof Error\n\t\t\t\t\t\t\t? cleanupError\n\t\t\t\t\t\t\t: createOpencodeOcError(\n\t\t\t\t\t\t\t\t\t\"cleanup\",\n\t\t\t\t\t\t\t\t\t`Failed to remove temporary merged config directory: ${String(cleanupError)}`,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\tprimaryFailure = cleanupFailure\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (primaryFailure) {\n\t\tthrow primaryFailure\n\t}\n\n\tif (childExitCode !== null) {\n\t\tprocess.exit(childExitCode)\n\t}\n}\n",
109
- "/**\n * Terminal title and tmux window naming utilities.\n *\n * Provides cross-environment terminal identification by setting both\n * the terminal title (via ANSI OSC escape) and tmux window name (if applicable).\n *\n * Terminal renaming can be disabled via profile config (`renameWindow: false`)\n * or the `--no-rename` CLI flag for `ocx opencode`.\n */\n\nimport path from \"node:path\"\nimport { isTTY } from \"./env\"\nimport type { GitInfo } from \"./git-context\"\n\nconst MAX_BRANCH_LENGTH = 20\n\n// ============================================================================\n// Terminal Title Stack (Save/Restore)\n// ============================================================================\n// REQUIREMENT: Profile mode must restore the original terminal title on exit.\n//\n// APPROACH: Uses XTerm's title stack (CSI 22;2t push, CSI 23;2t pop).\n// This follows the pattern used by Vim and Neovim for reliable restoration.\n//\n// COMPATIBILITY: Supported by xterm, iTerm2, Alacritty, VTE/GNOME.\n// Unsupported terminals (kitty, Windows Terminal) safely ignore the sequences\n// per ECMA-48 specification.\n//\n// LIMITATION: SIGKILL cannot be caught, so title won't restore if the process\n// is killed with `kill -9`. This is an industry-accepted limitation.\n// ============================================================================\n\n/** Tracks whether we've pushed to the terminal title stack */\nlet titleSaved = false\n\n/**\n * Checks if the current process is running inside a tmux session.\n *\n * @returns true if inside tmux, false otherwise\n *\n * @example\n * ```ts\n * if (isInsideTmux()) {\n * console.log(\"Running inside tmux\")\n * }\n * ```\n */\nexport function isInsideTmux(): boolean {\n\treturn Boolean(process.env.TMUX)\n}\n\n/**\n * Sets the tmux window name for the current session.\n *\n * This function:\n * 1. Renames the current window to the specified name\n * 2. Disables automatic-rename to prevent tmux from overwriting it\n *\n * @param name - The name to set for the tmux window\n *\n * @example\n * ```ts\n * setTmuxWindowName(\"ocx: my-project\")\n * ```\n */\nexport function setTmuxWindowName(name: string): void {\n\t// Early exit: not inside tmux\n\tif (!isInsideTmux()) {\n\t\treturn\n\t}\n\n\t// Rename the current window\n\tBun.spawnSync([\"tmux\", \"rename-window\", name])\n\n\t// Disable automatic-rename to prevent tmux from overwriting our name\n\tBun.spawnSync([\"tmux\", \"set-window-option\", \"automatic-rename\", \"off\"])\n}\n\n/**\n * Sets the terminal title using ANSI OSC escape sequence.\n *\n * Uses OSC 0 (Operating System Command) which sets both window title\n * and icon name on supported terminals.\n *\n * @param title - The title to set for the terminal window\n *\n * @example\n * ```ts\n * setTerminalTitle(\"ocx: my-project\")\n * ```\n */\nexport function setTerminalTitle(title: string): void {\n\t// Early exit: not a TTY\n\tif (!isTTY) {\n\t\treturn\n\t}\n\n\t// OSC 0: Set window title and icon name\n\t// Format: ESC ] 0 ; <title> BEL\n\tprocess.stdout.write(`\\x1b]0;${title}\\x07`)\n}\n\n/**\n * Sets the terminal name across all supported environments.\n *\n * This is the main export that handles both:\n * - tmux window naming (if inside tmux)\n * - Standard terminal title (via ANSI escape)\n *\n * @param name - The name to set for the terminal\n *\n * @example\n * ```ts\n * // In opencode command\n * setTerminalName(`ocx: ${projectName}`)\n * ```\n */\nexport function setTerminalName(name: string): void {\n\tsetTmuxWindowName(name)\n\tsetTerminalTitle(name)\n}\n\n/**\n * Saves the current terminal title to the terminal's title stack.\n * Uses XTerm CSI 22;2t (push window title only).\n *\n * Safe to call on unsupported terminals - the sequence is ignored per ECMA-48.\n * Uses Neovim's pattern of tracking state to prevent double-push.\n *\n * @example\n * ```ts\n * saveTerminalTitle() // Push current title\n * setTerminalName(\"ocx[default]:repo/main\")\n * // ... later on exit ...\n * restoreTerminalTitle() // Pop to restore original\n * ```\n */\nexport function saveTerminalTitle(): void {\n\t// Guard: Already saved or not a TTY\n\tif (titleSaved || !isTTY) {\n\t\treturn\n\t}\n\n\t// CSI 22;2t - Push window title to stack (;2 = title only, not icon name)\n\tprocess.stdout.write(\"\\x1b[22;2t\")\n\ttitleSaved = true\n}\n\n/**\n * Restores the previous terminal title from the stack.\n * Uses XTerm CSI 23;2t (pop window title).\n * For tmux: re-enables automatic-rename to restore dynamic window naming.\n *\n * Safe to call even if save wasn't called - pop from empty stack is a no-op.\n * Must be called synchronously in exit handlers for guaranteed execution.\n *\n * @example\n * ```ts\n * process.on('exit', () => {\n * restoreTerminalTitle() // Restore original title\n * })\n * ```\n */\nexport function restoreTerminalTitle(): void {\n\t// Guard: Nothing to restore\n\tif (!titleSaved) {\n\t\treturn\n\t}\n\n\t// Restore tmux automatic window naming\n\tif (isInsideTmux()) {\n\t\tBun.spawnSync([\"tmux\", \"set-window-option\", \"automatic-rename\", \"on\"])\n\t}\n\n\t// CSI 23;2t - Pop window title from stack\n\tif (isTTY) {\n\t\tprocess.stdout.write(\"\\x1b[23;2t\")\n\t}\n\n\ttitleSaved = false\n}\n\n/**\n * Formats the terminal name for profile mode sessions.\n *\n * Format: ocx[profileName]:repoName/branch\n *\n * @param cwd - Current working directory\n * @param profileName - Active profile name\n * @param gitInfo - Git repository information\n * @returns Formatted terminal name\n *\n * @example\n * ```ts\n * formatTerminalName(\"/path/to/repo\", \"default\", { repoName: \"ocx\", branch: \"main\" })\n * // Returns: \"ocx[default]:ocx/main\"\n *\n * formatTerminalName(\"/path/to/repo\", \"work\", { repoName: null, branch: null })\n * // Returns: \"ocx[work]:repo\"\n * ```\n */\nexport function formatTerminalName(cwd: string, profileName: string, gitInfo: GitInfo): string {\n\tconst repoName = gitInfo.repoName ?? path.basename(cwd)\n\n\t// Early exit: no branch info\n\tif (!gitInfo.branch) {\n\t\treturn `ocx[${profileName}]:${repoName}`\n\t}\n\n\t// Truncate long branch names to keep terminal title readable\n\tconst branch =\n\t\tgitInfo.branch.length > MAX_BRANCH_LENGTH\n\t\t\t? `${gitInfo.branch.slice(0, MAX_BRANCH_LENGTH - 3)}...`\n\t\t\t: gitInfo.branch\n\n\treturn `ocx[${profileName}]:${repoName}/${branch}`\n}\n",
110
- "import { randomUUID } from \"node:crypto\"\nimport {\n\tcopyFile,\n\tcp,\n\tlstat,\n\tmkdir,\n\tmkdtemp,\n\treaddir,\n\treadFile,\n\trealpath,\n\trename,\n\trm,\n\tunlink,\n} from \"node:fs/promises\"\nimport { tmpdir } from \"node:os\"\nimport { basename, dirname, isAbsolute, join, relative } from \"node:path\"\nimport { Glob } from \"bun\"\nimport { type ParseError, parse as parseJsonc, printParseErrorCode } from \"jsonc-parser\"\nimport { z } from \"zod\"\nimport { findLocalConfigDir, OCX_CONFIG_FILE } from \"../profile/paths\"\nimport { ConfigError } from \"../utils/errors\"\nimport { validatePath } from \"../utils/path-security\"\n\nexport const OPENCODE_OVERLAY_SOURCE_SCOPES = [\"agent\", \"agents\", \"skill\", \"skills\"] as const\nexport const OPENCODE_MERGED_DIR_PREFIX = \"ocx-oc-merged-\"\nexport const OVERLAY_TRANSACTION_MANIFEST_VERSION = 1\n\nconst OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE =\n\t\"Full TOCTOU/symlink-swap hardening requires an fd-based native helper transaction.\"\n\nexport type OpencodeOcErrorClass = \"read\" | \"parse\" | \"validate\" | \"copy\" | \"spawn\" | \"cleanup\"\ntype Awaitable<T> = T | Promise<T>\n\ntype OverlayEntryType = \"file\" | \"directory\" | \"symlink\" | \"other\"\n\nexport interface OverlayManifestSourceSnapshot {\n\tentryType: OverlayEntryType\n\tdevice: string\n\tinode: string\n\tmode: string\n\tsize: string\n\tmtimeMs: string\n}\n\nexport interface OverlayTransactionManifestOperation {\n\tsourceRelativePath: string\n\tdestinationRelativePath: string\n\tsourceSnapshot: OverlayManifestSourceSnapshot\n}\n\nexport interface OverlayTransactionManifest {\n\tversion: typeof OVERLAY_TRANSACTION_MANIFEST_VERSION\n\tprojectConfigDir: string\n\toperations: OverlayTransactionManifestOperation[]\n}\n\nexport type OverlayHardeningMode = \"best-effort-js\" | \"native-fd-required\"\nexport type OverlayHardeningLevel = \"best-effort-js\" | \"native-fd\"\n\nexport interface OverlayNativeTransactionHelper {\n\treadonly name: string\n\tapplyManifest(manifest: OverlayTransactionManifest, mergedConfigDir: string): Promise<void>\n}\n\nexport function createOpencodeOcError(\n\terrorClass: OpencodeOcErrorClass,\n\tdetail: string,\n): ConfigError {\n\treturn new ConfigError(`ocx oc ${errorClass} error: ${detail}`)\n}\n\nfunction formatUnknownError(error: unknown): string {\n\tif (error instanceof Error) {\n\t\treturn error.message\n\t}\n\n\treturn String(error)\n}\n\nfunction formatJsoncParseError(parseErrors: ParseError[]): string {\n\tif (parseErrors.length === 0) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\tconst firstError = parseErrors[0]\n\tif (!firstError) {\n\t\treturn \"Unknown parse error\"\n\t}\n\n\treturn `${printParseErrorCode(firstError.error)} at offset ${firstError.offset}`\n}\n\nfunction toPosixPath(pathValue: string): string {\n\treturn pathValue.replaceAll(\"\\\\\", \"/\")\n}\n\nfunction normalizeGlobPattern(pattern: string): string {\n\treturn pattern.startsWith(\"./\") ? pattern.slice(2) : pattern\n}\n\nfunction isPathWithin(parentPath: string, childPath: string): boolean {\n\tconst relativePath = relative(parentPath, childPath)\n\tif (relativePath.length === 0) {\n\t\treturn true\n\t}\n\n\treturn !relativePath.startsWith(\"..\") && !isAbsolute(relativePath)\n}\n\nfunction getOverlayEntryType(stats: Awaited<ReturnType<typeof lstat>>): OverlayEntryType {\n\tif (stats.isFile()) {\n\t\treturn \"file\"\n\t}\n\n\tif (stats.isDirectory()) {\n\t\treturn \"directory\"\n\t}\n\n\tif (stats.isSymbolicLink()) {\n\t\treturn \"symlink\"\n\t}\n\n\treturn \"other\"\n}\n\nfunction captureOverlaySnapshot(\n\tstats: Awaited<ReturnType<typeof lstat>>,\n): OverlayManifestSourceSnapshot {\n\treturn {\n\t\tentryType: getOverlayEntryType(stats),\n\t\tdevice: String(stats.dev),\n\t\tinode: String(stats.ino),\n\t\tmode: String(stats.mode),\n\t\tsize: String(stats.size),\n\t\tmtimeMs: String(stats.mtimeMs),\n\t}\n}\n\nfunction overlaySnapshotIdentityMatches(\n\texpected: OverlayManifestSourceSnapshot,\n\tactual: OverlayManifestSourceSnapshot,\n): boolean {\n\treturn (\n\t\texpected.entryType === actual.entryType &&\n\t\texpected.device === actual.device &&\n\t\texpected.inode === actual.inode &&\n\t\texpected.mode === actual.mode\n\t)\n}\n\nfunction overlaySnapshotContentMatches(\n\texpected: OverlayManifestSourceSnapshot,\n\tactual: OverlayManifestSourceSnapshot,\n): boolean {\n\treturn expected.size === actual.size && expected.mtimeMs === actual.mtimeMs\n}\n\nasync function assertPathSnapshotUnchanged(options: {\n\tabsolutePath: string\n\toverlayRelativePath: string\n\texpectedSnapshot: OverlayManifestSourceSnapshot\n\tphase: string\n\tmustRemainDirectory?: boolean\n\tmustRemainFile?: boolean\n\tcompareContent?: boolean\n}): Promise<void> {\n\tlet currentStats: Awaited<ReturnType<typeof lstat>>\n\ttry {\n\t\tcurrentStats = await lstat(options.absolutePath)\n\t} catch {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Overlay path changed during ${options.phase}: ${options.overlayRelativePath}. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t)\n\t}\n\n\tif (options.mustRemainDirectory && !currentStats.isDirectory()) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Overlay path changed during ${options.phase}: ${options.overlayRelativePath}. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t)\n\t}\n\n\tif (options.mustRemainFile && !currentStats.isFile()) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Overlay path changed during ${options.phase}: ${options.overlayRelativePath}. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t)\n\t}\n\n\tconst currentSnapshot = captureOverlaySnapshot(currentStats)\n\tconst identityMatches = overlaySnapshotIdentityMatches(options.expectedSnapshot, currentSnapshot)\n\tconst shouldCompareContent = options.compareContent ?? true\n\tconst contentMatches = !shouldCompareContent\n\t\t? true\n\t\t: overlaySnapshotContentMatches(options.expectedSnapshot, currentSnapshot)\n\n\tif (!identityMatches || !contentMatches) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Overlay path changed during ${options.phase}: ${options.overlayRelativePath}. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t)\n\t}\n}\n\nexport interface ProjectOverlayPolicy {\n\tinclude: string[]\n\texclude: string[]\n}\n\nexport interface OverlayCandidate {\n\tsourcePath: string\n\toverlayRelativePath: string\n\tsourceSnapshot?: OverlayManifestSourceSnapshot\n}\n\nexport interface OverlayCopyOperation {\n\tsourcePath: string\n\tdestinationRelativePath: string\n\tsourceSnapshot?: OverlayManifestSourceSnapshot\n}\n\nexport interface OverlayCollectionSeams {\n\tbeforeScopeInspect?: (context: {\n\t\tscope: (typeof OPENCODE_OVERLAY_SOURCE_SCOPES)[number]\n\t\tscopeAbsolutePath: string\n\t\tprojectConfigDir: string\n\t}) => Awaitable<void>\n\tbeforeDirectoryRead?: (context: {\n\t\tabsolutePath: string\n\t\toverlayRelativePath: string\n\t}) => Awaitable<void>\n}\n\nasync function assertSafeOverlayDestinationPath(\n\tmergedConfigDir: string,\n\tdestinationPath: string,\n\tdestinationRelativePath: string,\n): Promise<void> {\n\tconst relativeDestinationPath = toPosixPath(relative(mergedConfigDir, destinationPath))\n\tconst pathComponents = relativeDestinationPath\n\t\t.split(\"/\")\n\t\t.filter((component) => component.length > 0)\n\n\tlet currentPath = mergedConfigDir\n\tfor (const component of pathComponents) {\n\t\tcurrentPath = join(currentPath, component)\n\n\t\tlet currentStats: Awaited<ReturnType<typeof lstat>>\n\t\ttry {\n\t\t\tcurrentStats = await lstat(currentPath)\n\t\t} catch (error) {\n\t\t\tconst errorCode = (error as NodeJS.ErrnoException).code\n\t\t\tif (errorCode === \"ENOENT\") {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Failed to inspect overlay destination path (${destinationRelativePath}): ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (currentStats.isSymbolicLink()) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Overlay destination path contains existing symlink (${destinationRelativePath})`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nconst projectOverlayPolicySchema = z\n\t.object({\n\t\tinclude: z.array(z.string()).optional(),\n\t\texclude: z.array(z.string()).optional(),\n\t})\n\t.passthrough()\n\nfunction validatePolicyPatterns(\n\tpolicyPath: string,\n\tfield: \"include\" | \"exclude\",\n\tpatterns: string[],\n): void {\n\tfor (const pattern of patterns) {\n\t\ttry {\n\t\t\tnew Glob(normalizeGlobPattern(pattern))\n\t\t} catch {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Invalid project overlay policy at ${policyPath}: ${field} contains invalid glob pattern \"${pattern}\"`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nexport async function loadProjectOverlayPolicy(\n\tlocalConfigDir: string | null,\n): Promise<ProjectOverlayPolicy> {\n\tif (!localConfigDir) {\n\t\treturn { include: [], exclude: [] }\n\t}\n\n\tconst policyPath = join(localConfigDir, OCX_CONFIG_FILE)\n\tconst policyReadPath = await resolveProjectOverlayPolicyReadPath(localConfigDir, policyPath)\n\tif (!policyReadPath) {\n\t\treturn { include: [], exclude: [] }\n\t}\n\n\tlet policyText: string\n\ttry {\n\t\tpolicyText = await readFile(policyReadPath, \"utf8\")\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"read\",\n\t\t\t`Failed to read project overlay policy at ${policyPath}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tconst parseErrors: ParseError[] = []\n\tconst parsedPolicy = parseJsonc(policyText, parseErrors, { allowTrailingComma: true })\n\tif (parseErrors.length > 0) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"parse\",\n\t\t\t`Failed to parse project overlay policy at ${policyPath}: ${formatJsoncParseError(parseErrors)}`,\n\t\t)\n\t}\n\n\tif (!parsedPolicy || typeof parsedPolicy !== \"object\" || Array.isArray(parsedPolicy)) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Invalid project overlay policy at ${policyPath}: root must be an object`,\n\t\t)\n\t}\n\n\tconst parsedResult = projectOverlayPolicySchema.safeParse(parsedPolicy)\n\tif (!parsedResult.success) {\n\t\tconst firstIssue = parsedResult.error.issues[0]\n\t\tconst issuePath = firstIssue?.path.length ? firstIssue.path.join(\".\") : \"root\"\n\t\tconst issueMessage = firstIssue?.message ?? \"Invalid project overlay policy\"\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Invalid project overlay policy at ${policyPath}: ${issuePath} ${issueMessage}`,\n\t\t)\n\t}\n\n\tconst include = parsedResult.data.include ?? []\n\tconst exclude = parsedResult.data.exclude ?? []\n\n\tvalidatePolicyPatterns(policyPath, \"include\", include)\n\tvalidatePolicyPatterns(policyPath, \"exclude\", exclude)\n\n\treturn { include, exclude }\n}\n\nasync function resolveProjectOverlayPolicyReadPath(\n\tlocalConfigDir: string,\n\tpolicyPath: string,\n): Promise<string | null> {\n\tlet policyStats: Awaited<ReturnType<typeof lstat>>\n\ttry {\n\t\tpolicyStats = await lstat(policyPath)\n\t} catch (error) {\n\t\tconst errorCode = (error as NodeJS.ErrnoException).code\n\t\tif (errorCode === \"ENOENT\" || errorCode === \"ENOTDIR\") {\n\t\t\treturn null\n\t\t}\n\n\t\tthrow createOpencodeOcError(\n\t\t\t\"read\",\n\t\t\t`Failed to inspect project overlay policy at ${policyPath}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (!policyStats.isSymbolicLink()) {\n\t\treturn policyPath\n\t}\n\n\tlet projectConfigRealPath: string\n\ttry {\n\t\tprojectConfigRealPath = await realpath(localConfigDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Unable to resolve project config directory ${localConfigDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tlet policyTargetRealPath: string\n\ttry {\n\t\tpolicyTargetRealPath = await realpath(policyPath)\n\t} catch (error) {\n\t\tconst errorCode = (error as NodeJS.ErrnoException).code\n\t\tif (errorCode === \"ENOENT\" || errorCode === \"ENOTDIR\") {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Broken symlink in project overlay policy: ${policyPath}`,\n\t\t\t)\n\t\t}\n\n\t\tthrow createOpencodeOcError(\n\t\t\t\"read\",\n\t\t\t`Failed to inspect project overlay policy symlink at ${policyPath}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (!isPathWithin(projectConfigRealPath, policyTargetRealPath)) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Symlink escapes project overlay policy scope: ${policyPath}`,\n\t\t)\n\t}\n\n\treturn policyTargetRealPath\n}\n\nexport function shouldIncludeOverlayPath(pathValue: string, policy: ProjectOverlayPolicy): boolean {\n\tfor (const pattern of policy.include) {\n\t\tconst glob = new Glob(normalizeGlobPattern(pattern))\n\t\tif (glob.match(pathValue)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tfor (const pattern of policy.exclude) {\n\t\tconst glob = new Glob(normalizeGlobPattern(pattern))\n\t\tif (glob.match(pathValue)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nexport function planOverlayCopyOperations(\n\tcandidates: readonly OverlayCandidate[],\n\tpolicy: ProjectOverlayPolicy,\n): OverlayCopyOperation[] {\n\treturn candidates\n\t\t.filter((candidate) => shouldIncludeOverlayPath(candidate.overlayRelativePath, policy))\n\t\t.map((candidate) => ({\n\t\t\tsourcePath: candidate.sourcePath,\n\t\t\tdestinationRelativePath: candidate.overlayRelativePath,\n\t\t\tsourceSnapshot: candidate.sourceSnapshot,\n\t\t}))\n}\n\nasync function rejectSymlinkEntry(\n\tprojectConfigRealPath: string,\n\tabsolutePath: string,\n\toverlayRelativePath: string,\n): Promise<never> {\n\tlet targetRealPath: string\n\ttry {\n\t\ttargetRealPath = await realpath(absolutePath)\n\t} catch (error) {\n\t\tconst errorCode = (error as NodeJS.ErrnoException).code\n\t\tif (errorCode === \"ENOENT\" || errorCode === \"ENOTDIR\") {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Broken symlink in project overlay scope: ${overlayRelativePath}`,\n\t\t\t)\n\t\t}\n\n\t\tthrow createOpencodeOcError(\n\t\t\t\"read\",\n\t\t\t`Failed to inspect symlink at ${overlayRelativePath}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (!isPathWithin(projectConfigRealPath, targetRealPath)) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Symlink escapes project overlay scope: ${overlayRelativePath}`,\n\t\t)\n\t}\n\n\tthrow createOpencodeOcError(\n\t\t\"validate\",\n\t\t`Symlink entries are not supported in project overlay scope: ${overlayRelativePath}`,\n\t)\n}\n\nasync function collectOverlayCandidatesFromPath(\n\tprojectConfigRealPath: string,\n\tabsPath: string,\n\toverlayRelativePath: string,\n\tcollector: OverlayCandidate[],\n\tseams: OverlayCollectionSeams,\n): Promise<void> {\n\tlet stats: Awaited<ReturnType<typeof lstat>>\n\ttry {\n\t\tstats = await lstat(absPath)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"read\",\n\t\t\t`Failed to inspect project overlay path ${overlayRelativePath}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (stats.isSymbolicLink()) {\n\t\tawait rejectSymlinkEntry(projectConfigRealPath, absPath, overlayRelativePath)\n\t}\n\n\tconst discoveredSnapshot = captureOverlaySnapshot(stats)\n\n\tif (stats.isDirectory()) {\n\t\tawait seams.beforeDirectoryRead?.({\n\t\t\tabsolutePath: absPath,\n\t\t\toverlayRelativePath,\n\t\t})\n\n\t\tlet children: string[]\n\t\ttry {\n\t\t\tchildren = await readdir(absPath)\n\t\t} catch (error) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"read\",\n\t\t\t\t`Failed to read project overlay directory ${overlayRelativePath}: ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\n\t\tchildren.sort((left, right) => left.localeCompare(right))\n\t\tfor (const childName of children) {\n\t\t\tconst childAbsolutePath = join(absPath, childName)\n\t\t\tconst childRelativePath = toPosixPath(join(overlayRelativePath, childName))\n\t\t\tawait collectOverlayCandidatesFromPath(\n\t\t\t\tprojectConfigRealPath,\n\t\t\t\tchildAbsolutePath,\n\t\t\t\tchildRelativePath,\n\t\t\t\tcollector,\n\t\t\t\tseams,\n\t\t\t)\n\t\t}\n\n\t\tawait assertPathSnapshotUnchanged({\n\t\t\tabsolutePath: absPath,\n\t\t\toverlayRelativePath,\n\t\t\texpectedSnapshot: discoveredSnapshot,\n\t\t\tphase: \"overlay discovery\",\n\t\t\tmustRemainDirectory: true,\n\t\t})\n\t\treturn\n\t}\n\n\tif (!stats.isFile()) {\n\t\treturn\n\t}\n\n\tcollector.push({\n\t\tsourcePath: absPath,\n\t\toverlayRelativePath: toPosixPath(overlayRelativePath),\n\t\tsourceSnapshot: discoveredSnapshot,\n\t})\n}\n\nasync function collectOverlayCandidates(\n\tprojectConfigDir: string,\n\tseams: OverlayCollectionSeams = {},\n): Promise<OverlayCandidate[]> {\n\tlet projectConfigRealPath: string\n\ttry {\n\t\tprojectConfigRealPath = await realpath(projectConfigDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Unable to resolve project config directory ${projectConfigDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tlet projectConfigRootStats: Awaited<ReturnType<typeof lstat>>\n\ttry {\n\t\tprojectConfigRootStats = await lstat(projectConfigDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Unable to inspect project overlay root ${projectConfigDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (!projectConfigRootStats.isDirectory()) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Project overlay root changed before discovery: ${projectConfigDir}. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t)\n\t}\n\n\tconst projectConfigRootSnapshot = captureOverlaySnapshot(projectConfigRootStats)\n\n\tconst candidates: OverlayCandidate[] = []\n\tfor (const scope of OPENCODE_OVERLAY_SOURCE_SCOPES) {\n\t\tconst scopeAbsolutePath = join(projectConfigDir, scope)\n\n\t\tawait seams.beforeScopeInspect?.({\n\t\t\tscope,\n\t\t\tscopeAbsolutePath,\n\t\t\tprojectConfigDir,\n\t\t})\n\n\t\tawait assertPathSnapshotUnchanged({\n\t\t\tabsolutePath: projectConfigDir,\n\t\t\toverlayRelativePath: \".opencode\",\n\t\t\texpectedSnapshot: projectConfigRootSnapshot,\n\t\t\tphase: \"overlay discovery\",\n\t\t\tmustRemainDirectory: true,\n\t\t})\n\n\t\tlet scopeStats: Awaited<ReturnType<typeof lstat>>\n\t\ttry {\n\t\t\tscopeStats = await lstat(scopeAbsolutePath)\n\t\t} catch (error) {\n\t\t\tconst errorCode = (error as NodeJS.ErrnoException).code\n\t\t\tif (errorCode === \"ENOENT\" || errorCode === \"ENOTDIR\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"read\",\n\t\t\t\t`Failed to inspect project overlay scope ${scope}: ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (scopeStats.isSymbolicLink()) {\n\t\t\tawait rejectSymlinkEntry(projectConfigRealPath, scopeAbsolutePath, scope)\n\t\t}\n\n\t\tawait collectOverlayCandidatesFromPath(\n\t\t\tprojectConfigRealPath,\n\t\t\tscopeAbsolutePath,\n\t\t\tscope,\n\t\t\tcandidates,\n\t\t\tseams,\n\t\t)\n\t}\n\n\tcandidates.sort((left, right) =>\n\t\tleft.overlayRelativePath.localeCompare(right.overlayRelativePath),\n\t)\n\treturn candidates\n}\n\nexport type OverlayAtomicPublisher = (sourcePath: string, destinationPath: string) => Promise<void>\n\nexport interface OverlayCopyOperationSeams {\n\tpublishAtomically?: OverlayAtomicPublisher\n\tbeforeSourceVerification?: (operation: OverlayCopyOperation) => Awaitable<void>\n\tbeforeDestinationParentCreate?: (context: {\n\t\toperation: OverlayCopyOperation\n\t\tdestinationPath: string\n\t\tdestinationParentPath: string\n\t}) => Awaitable<void>\n\tbeforeDestinationPublish?: (context: {\n\t\toperation: OverlayCopyOperation\n\t\tdestinationPath: string\n\t\tdestinationParentPath: string\n\t}) => Awaitable<void>\n}\n\nfunction buildOverlayTempPublicationPath(destinationPath: string): string {\n\tconst destinationDirPath = dirname(destinationPath)\n\tconst destinationBaseName = basename(destinationPath)\n\tconst atomicSuffix = `${process.pid}-${randomUUID()}`\n\treturn join(destinationDirPath, `.${destinationBaseName}.ocx-tmp-${atomicSuffix}`)\n}\n\nasync function publishOverlayFileAtomically(\n\tsourcePath: string,\n\tdestinationPath: string,\n): Promise<void> {\n\tconst tempPublicationPath = buildOverlayTempPublicationPath(destinationPath)\n\n\ttry {\n\t\tawait copyFile(sourcePath, tempPublicationPath)\n\t\tawait rename(tempPublicationPath, destinationPath)\n\t} catch (error) {\n\t\ttry {\n\t\t\tawait unlink(tempPublicationPath)\n\t\t} catch {\n\t\t\t// Ignore temp cleanup failures and preserve primary error.\n\t\t}\n\n\t\tthrow error\n\t}\n}\n\nexport async function applyOverlayCopyOperations(\n\toperations: readonly OverlayCopyOperation[],\n\tmergedConfigDir: string,\n\tseams: OverlayCopyOperationSeams = {},\n): Promise<void> {\n\tconst publishAtomically = seams.publishAtomically ?? publishOverlayFileAtomically\n\n\tlet mergedRootStats: Awaited<ReturnType<typeof lstat>>\n\ttry {\n\t\tmergedRootStats = await lstat(mergedConfigDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Unable to inspect merged overlay root ${mergedConfigDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (!mergedRootStats.isDirectory()) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Merged overlay root is not a directory: ${mergedConfigDir}`,\n\t\t)\n\t}\n\n\tconst mergedRootSnapshot = captureOverlaySnapshot(mergedRootStats)\n\n\tfor (const operation of operations) {\n\t\tawait seams.beforeSourceVerification?.(operation)\n\n\t\tif (operation.sourceSnapshot) {\n\t\t\tawait assertPathSnapshotUnchanged({\n\t\t\t\tabsolutePath: operation.sourcePath,\n\t\t\t\toverlayRelativePath: operation.destinationRelativePath,\n\t\t\t\texpectedSnapshot: operation.sourceSnapshot,\n\t\t\t\tphase: \"overlay source verification\",\n\t\t\t\tmustRemainFile: true,\n\t\t\t})\n\t\t}\n\n\t\tawait assertPathSnapshotUnchanged({\n\t\t\tabsolutePath: mergedConfigDir,\n\t\t\toverlayRelativePath: \".merged\",\n\t\t\texpectedSnapshot: mergedRootSnapshot,\n\t\t\tphase: \"overlay destination verification\",\n\t\t\tmustRemainDirectory: true,\n\t\t\tcompareContent: false,\n\t\t})\n\n\t\tlet destinationPath: string\n\t\ttry {\n\t\t\tdestinationPath = validatePath(mergedConfigDir, operation.destinationRelativePath)\n\t\t} catch (error) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Overlay destination path is invalid (${operation.destinationRelativePath}): ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\n\t\tawait assertSafeOverlayDestinationPath(\n\t\t\tmergedConfigDir,\n\t\t\tdestinationPath,\n\t\t\toperation.destinationRelativePath,\n\t\t)\n\n\t\tconst destinationParentPath = dirname(destinationPath)\n\n\t\tawait seams.beforeDestinationParentCreate?.({\n\t\t\toperation,\n\t\t\tdestinationPath,\n\t\t\tdestinationParentPath,\n\t\t})\n\n\t\tawait assertSafeOverlayDestinationPath(\n\t\t\tmergedConfigDir,\n\t\t\tdestinationPath,\n\t\t\toperation.destinationRelativePath,\n\t\t)\n\n\t\ttry {\n\t\t\tawait mkdir(destinationParentPath, { recursive: true })\n\t\t} catch (error) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"copy\",\n\t\t\t\t`Failed to copy overlay file ${operation.destinationRelativePath}: ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\n\t\tawait assertSafeOverlayDestinationPath(\n\t\t\tmergedConfigDir,\n\t\t\tdestinationPath,\n\t\t\toperation.destinationRelativePath,\n\t\t)\n\n\t\tlet destinationParentStats: Awaited<ReturnType<typeof lstat>>\n\t\ttry {\n\t\t\tdestinationParentStats = await lstat(destinationParentPath)\n\t\t} catch (error) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Failed to inspect overlay destination parent (${operation.destinationRelativePath}): ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\n\t\tif (!destinationParentStats.isDirectory()) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Overlay destination parent changed before publish (${operation.destinationRelativePath}). ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t\t)\n\t\t}\n\n\t\tconst destinationParentSnapshot = captureOverlaySnapshot(destinationParentStats)\n\n\t\tawait seams.beforeDestinationPublish?.({\n\t\t\toperation,\n\t\t\tdestinationPath,\n\t\t\tdestinationParentPath,\n\t\t})\n\n\t\tawait assertPathSnapshotUnchanged({\n\t\t\tabsolutePath: mergedConfigDir,\n\t\t\toverlayRelativePath: \".merged\",\n\t\t\texpectedSnapshot: mergedRootSnapshot,\n\t\t\tphase: \"overlay destination publish\",\n\t\t\tmustRemainDirectory: true,\n\t\t\tcompareContent: false,\n\t\t})\n\n\t\tawait assertPathSnapshotUnchanged({\n\t\t\tabsolutePath: destinationParentPath,\n\t\t\toverlayRelativePath: operation.destinationRelativePath,\n\t\t\texpectedSnapshot: destinationParentSnapshot,\n\t\t\tphase: \"overlay destination publish\",\n\t\t\tmustRemainDirectory: true,\n\t\t\tcompareContent: false,\n\t\t})\n\n\t\tawait assertSafeOverlayDestinationPath(\n\t\t\tmergedConfigDir,\n\t\t\tdestinationPath,\n\t\t\toperation.destinationRelativePath,\n\t\t)\n\n\t\ttry {\n\t\t\tawait publishAtomically(operation.sourcePath, destinationPath)\n\t\t} catch (error) {\n\t\t\tif (error instanceof ConfigError) {\n\t\t\t\tthrow error\n\t\t\t}\n\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"copy\",\n\t\t\t\t`Failed to copy overlay file ${operation.destinationRelativePath}: ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nasync function copyProfileBaseToMergedDir(\n\tprofileDir: string,\n\tmergedConfigDir: string,\n): Promise<void> {\n\tlet profileEntries: string[]\n\ttry {\n\t\tprofileEntries = await readdir(profileDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"copy\",\n\t\t\t`Failed to read profile directory ${profileDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tfor (const entryName of profileEntries) {\n\t\tconst sourcePath = join(profileDir, entryName)\n\t\tconst destinationPath = join(mergedConfigDir, entryName)\n\n\t\ttry {\n\t\t\tawait cp(sourcePath, destinationPath, { recursive: true, force: true, errorOnExist: false })\n\t\t} catch (error) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"copy\",\n\t\t\t\t`Failed to copy profile base file ${entryName}: ${formatUnknownError(error)}`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nexport async function cleanupMergedConfigDir(mergedConfigDir: string): Promise<void> {\n\ttry {\n\t\tawait rm(mergedConfigDir, { recursive: true, force: true })\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"cleanup\",\n\t\t\t`Failed to remove temporary merged config directory ${mergedConfigDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n}\n\nfunction toOverlaySourceRelativePath(projectConfigDir: string, sourcePath: string): string {\n\tconst relativeSourcePath = toPosixPath(relative(projectConfigDir, sourcePath))\n\tif (!relativeSourcePath || relativeSourcePath === \".\") {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Overlay source path failed relative parsing: ${sourcePath}`,\n\t\t)\n\t}\n\n\tif (\n\t\trelativeSourcePath === \"..\" ||\n\t\trelativeSourcePath.startsWith(\"../\") ||\n\t\tisAbsolute(relativeSourcePath)\n\t) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Overlay source path escapes project overlay scope: ${sourcePath}`,\n\t\t)\n\t}\n\n\treturn relativeSourcePath\n}\n\nfunction buildOverlayTransactionManifest(\n\tprojectConfigDir: string,\n\toperations: readonly OverlayCopyOperation[],\n): OverlayTransactionManifest {\n\tconst parsedOperations = operations.map((operation) => {\n\t\tif (!operation.sourceSnapshot) {\n\t\t\tthrow createOpencodeOcError(\n\t\t\t\t\"validate\",\n\t\t\t\t`Overlay source snapshot missing for ${operation.destinationRelativePath}. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t\t)\n\t\t}\n\n\t\treturn {\n\t\t\tsourceRelativePath: toOverlaySourceRelativePath(projectConfigDir, operation.sourcePath),\n\t\t\tdestinationRelativePath: operation.destinationRelativePath,\n\t\t\tsourceSnapshot: operation.sourceSnapshot,\n\t\t}\n\t})\n\n\treturn {\n\t\tversion: OVERLAY_TRANSACTION_MANIFEST_VERSION,\n\t\tprojectConfigDir,\n\t\toperations: parsedOperations,\n\t}\n}\n\nfunction resolveOverlayNativeTransactionHelper(): OverlayNativeTransactionHelper | null {\n\treturn null\n}\n\nasync function applyOverlayTransactionManifestWithJs(options: {\n\tmanifest: OverlayTransactionManifest\n\tmergedConfigDir: string\n\tcopySeams?: OverlayCopyOperationSeams\n}): Promise<void> {\n\tconst operations: OverlayCopyOperation[] = options.manifest.operations.map((operation) => ({\n\t\tsourcePath: validatePath(options.manifest.projectConfigDir, operation.sourceRelativePath),\n\t\tdestinationRelativePath: operation.destinationRelativePath,\n\t\tsourceSnapshot: operation.sourceSnapshot,\n\t}))\n\n\tawait applyOverlayCopyOperations(operations, options.mergedConfigDir, options.copySeams)\n}\n\nasync function executeOverlayMergeTransaction(options: {\n\tmanifest: OverlayTransactionManifest\n\tmergedConfigDir: string\n\thardeningMode: OverlayHardeningMode\n\tcopySeams?: OverlayCopyOperationSeams\n\tnativeHelper?: OverlayNativeTransactionHelper | null\n}): Promise<OverlayHardeningLevel> {\n\tif (options.manifest.operations.length === 0) {\n\t\treturn \"best-effort-js\"\n\t}\n\n\tconst nativeHelper = options.nativeHelper ?? resolveOverlayNativeTransactionHelper()\n\tif (nativeHelper) {\n\t\tawait nativeHelper.applyManifest(options.manifest, options.mergedConfigDir)\n\t\treturn \"native-fd\"\n\t}\n\n\tif (options.hardeningMode === \"native-fd-required\") {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Native fd helper required for overlay merge, but none is available in this Bun/Node runtime. ${OVERLAY_NATIVE_HELPER_REQUIRED_MESSAGE}`,\n\t\t)\n\t}\n\n\tawait applyOverlayTransactionManifestWithJs({\n\t\tmanifest: options.manifest,\n\t\tmergedConfigDir: options.mergedConfigDir,\n\t\tcopySeams: options.copySeams,\n\t})\n\n\treturn \"best-effort-js\"\n}\n\nexport interface OverlayPrepareSeams {\n\tcollection?: OverlayCollectionSeams\n\tcopy?: OverlayCopyOperationSeams\n\tnativeHelper?: OverlayNativeTransactionHelper | null\n}\n\ninterface PrepareMergedConfigDirOptions {\n\tprojectDir: string\n\tprofileDir: string\n\thardeningMode?: OverlayHardeningMode\n\tseams?: OverlayPrepareSeams\n}\n\nasync function resolveProjectOverlayConfigDir(localConfigDir: string): Promise<string> {\n\tconst projectRootDir = dirname(localConfigDir)\n\n\tlet projectRealPath: string\n\ttry {\n\t\tprojectRealPath = await realpath(projectRootDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Unable to resolve project directory ${projectRootDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tlet localConfigRealPath: string\n\ttry {\n\t\tlocalConfigRealPath = await realpath(localConfigDir)\n\t} catch (error) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Unable to resolve project config directory ${localConfigDir}: ${formatUnknownError(error)}`,\n\t\t)\n\t}\n\n\tif (!isPathWithin(projectRealPath, localConfigRealPath)) {\n\t\tthrow createOpencodeOcError(\n\t\t\t\"validate\",\n\t\t\t`Project .opencode root resolves outside project directory: ${localConfigDir}`,\n\t\t)\n\t}\n\n\treturn localConfigRealPath\n}\n\nexport interface PreparedMergedConfigDir {\n\tpath: string\n\tcleanup: () => Promise<void>\n\thardeningLevel: OverlayHardeningLevel\n}\n\nfunction toPrimaryPrepareError(error: unknown): ConfigError {\n\tif (error instanceof ConfigError) {\n\t\treturn error\n\t}\n\n\treturn createOpencodeOcError(\n\t\t\"copy\",\n\t\t`Failed to prepare temporary merged config directory: ${formatUnknownError(error)}`,\n\t)\n}\n\nexport async function prepareMergedConfigDirForProfile(\n\toptions: PrepareMergedConfigDirOptions,\n): Promise<PreparedMergedConfigDir> {\n\tconst localConfigDir = findLocalConfigDir(options.projectDir)\n\tconst hardeningMode = options.hardeningMode ?? \"best-effort-js\"\n\tlet mergedConfigDir: string | null = null\n\n\ttry {\n\t\tmergedConfigDir = await mkdtemp(join(tmpdir(), OPENCODE_MERGED_DIR_PREFIX))\n\n\t\tawait copyProfileBaseToMergedDir(options.profileDir, mergedConfigDir)\n\n\t\tlet hardeningLevel: OverlayHardeningLevel = \"best-effort-js\"\n\n\t\tif (localConfigDir) {\n\t\t\tconst projectOverlayConfigDir = await resolveProjectOverlayConfigDir(localConfigDir)\n\t\t\tconst policy = await loadProjectOverlayPolicy(projectOverlayConfigDir)\n\t\t\tconst candidates = await collectOverlayCandidates(\n\t\t\t\tprojectOverlayConfigDir,\n\t\t\t\toptions.seams?.collection,\n\t\t\t)\n\t\t\tconst copyPlan = planOverlayCopyOperations(candidates, policy)\n\t\t\tconst manifest = buildOverlayTransactionManifest(projectOverlayConfigDir, copyPlan)\n\t\t\thardeningLevel = await executeOverlayMergeTransaction({\n\t\t\t\tmanifest,\n\t\t\t\tmergedConfigDir,\n\t\t\t\thardeningMode,\n\t\t\t\tcopySeams: options.seams?.copy,\n\t\t\t\tnativeHelper: options.seams?.nativeHelper,\n\t\t\t})\n\t\t}\n\n\t\tconst preparedPath = mergedConfigDir\n\t\treturn {\n\t\t\tpath: preparedPath,\n\t\t\tcleanup: () => cleanupMergedConfigDir(preparedPath),\n\t\t\thardeningLevel,\n\t\t}\n\t} catch (error) {\n\t\tconst primaryError = toPrimaryPrepareError(error)\n\n\t\tif (mergedConfigDir) {\n\t\t\ttry {\n\t\t\t\tawait cleanupMergedConfigDir(mergedConfigDir)\n\t\t\t} catch (cleanupError) {\n\t\t\t\tprimaryError.message = `${primaryError.message}\\nCleanup warning: ${formatUnknownError(cleanupError)}`\n\t\t\t}\n\t\t}\n\n\t\tthrow primaryError\n\t}\n}\n",
111
- "/**\n * Profile Add Command\n *\n * Create a new profile (global only — local profiles are unsupported).\n * Optionally clone settings from an existing profile or install from registry.\n *\n * Contract:\n * - Empty profile: `ocx profile add <name> --global`\n * - Clone profile: `ocx profile add <name> --clone <profile-name> --global`\n * - Install from configured registry: `ocx profile add <name> --source <namespace/component> --global`\n * - Install from ephemeral registry: `ocx profile add <name> --source <namespace/component> --from <registry-url> --global`\n */\n\nimport type { Command } from \"commander\"\nimport { parse as parseJsonc } from \"jsonc-parser\"\nimport { atomicCopy } from \"../../profile/atomic\"\nimport { ProfileManager } from \"../../profile/manager\"\nimport { getGlobalConfig, getProfileOcxConfig } from \"../../profile/paths\"\nimport type { ProfileOcxConfig } from \"../../schemas/ocx\"\nimport { profileOcxConfigSchema } from \"../../schemas/ocx\"\nimport {\n\tConfigError,\n\tOCXError,\n\tProfileExistsError,\n\tProfileNotFoundError,\n\tValidationError,\n} from \"../../utils/errors\"\nimport { handleError, logger, normalizeRegistryUrl, outputJson } from \"../../utils/index\"\nimport { installProfileFromRegistry } from \"./install-from-registry\"\n\n// =============================================================================\n// SOURCE INPUT TYPES (Parsed at boundary)\n// =============================================================================\n\n/**\n * Parsed --source input - namespace/component format only.\n * Parsed at the boundary (Law 2: Parse Don't Validate).\n */\nexport interface SourceInput {\n\tnamespace: string\n\tcomponent: string\n}\n\n/**\n * Parse the --source option value to extract namespace and component.\n *\n * @param source - The --source option value (must be namespace/component format)\n * @returns Parsed SourceInput with namespace and component\n * @throws ValidationError if format is invalid\n */\nexport function parseSourceOption(source: string): SourceInput {\n\t// Guard: empty input\n\tif (!source?.trim()) {\n\t\tthrow new ValidationError(\"--source value cannot be empty\")\n\t}\n\n\tconst trimmed = source.trim()\n\n\t// Must contain exactly one /\n\tconst slashCount = (trimmed.match(/\\//g) || []).length\n\tif (slashCount !== 1) {\n\t\tthrow new ValidationError(`Invalid --source format: \"${source}\". Expected: namespace/component`)\n\t}\n\n\tconst [namespace, component] = trimmed.split(\"/\").map((s) => s.trim())\n\tif (!namespace || !component) {\n\t\tthrow new ValidationError(`Invalid --source format: \"${source}\". Expected: namespace/component`)\n\t}\n\n\treturn { namespace, component }\n}\n\n// =============================================================================\n// COMMAND OPTIONS\n// =============================================================================\n\ninterface ProfileAddOptions {\n\tclone?: string\n\tsource?: string\n\tfrom?: string\n\tglobal?: boolean\n\tjson?: boolean\n}\n\ninterface ProfileAddResult {\n\tname: string\n\tscope: \"local\" | \"global\"\n\tmode: \"empty\" | \"clone\" | \"registry\"\n\tcloneFrom?: string\n\tregistry?: {\n\t\tnamespace: string\n\t\tcomponent: string\n\t\turl: string\n\t\tephemeral: boolean\n\t}\n}\n\n// =============================================================================\n// GLOBAL CONFIG HELPERS\n// =============================================================================\n\n/**\n * Read and parse the global ocx.jsonc configuration.\n * Returns null if file doesn't exist.\n *\n * @throws ConfigError if file exists but is invalid\n */\nasync function readGlobalOcxConfig() {\n\tconst configPath = getGlobalConfig()\n\tconst file = Bun.file(configPath)\n\n\tif (!(await file.exists())) {\n\t\treturn null\n\t}\n\n\ttry {\n\t\tconst content = await file.text()\n\t\tconst json = parseJsonc(content, [], { allowTrailingComma: true })\n\t\treturn profileOcxConfigSchema.parse(json)\n\t} catch (error) {\n\t\t// Guard: Wrap parse errors with helpful context (Law 4: Fail Fast, Fail Loud)\n\t\tif (error instanceof Error) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t`Failed to parse global config at \"${configPath}\": ${error.message}\\n\\n` +\n\t\t\t\t\t`Check the file for syntax errors or run: ocx config edit --global`,\n\t\t\t)\n\t\t}\n\t\tthrow error\n\t}\n}\n\n/**\n * Get the global config with a specific registry, throwing if not configured.\n *\n * @param namespace - Registry namespace to require\n * @returns Global config and the registry URL\n * @throws ConfigError if registry is not configured globally\n */\nasync function requireGlobalRegistry(\n\tnamespace: string,\n): Promise<{ config: ProfileOcxConfig; registryUrl: string }> {\n\tconst globalConfig = await readGlobalOcxConfig()\n\n\t// Guard: no global config\n\tif (!globalConfig) {\n\t\tthrow new ConfigError(\n\t\t\t`Registry \"${namespace}\" is not configured globally.\\n\\n` +\n\t\t\t\t`Profile installation requires global registry configuration.\\n` +\n\t\t\t\t`Run: ocx registry add <url> --name ${namespace} --global`,\n\t\t)\n\t}\n\n\t// Guard: registry not in global config\n\tconst registry = globalConfig.registries[namespace]\n\tif (!registry) {\n\t\tthrow new ConfigError(\n\t\t\t`Registry \"${namespace}\" is not configured globally.\\n\\n` +\n\t\t\t\t`Profile installation requires global registry configuration.\\n` +\n\t\t\t\t`Run: ocx registry add <url> --name ${namespace} --global`,\n\t\t)\n\t}\n\n\treturn { config: globalConfig, registryUrl: registry.url }\n}\n\n// =============================================================================\n// COMMAND REGISTRATION\n// =============================================================================\n\nexport function registerProfileAddCommand(parent: Command): void {\n\tparent\n\t\t.command(\"add <name>\")\n\t\t.description(\n\t\t\t\"Create a new profile (--global required), clone from existing, or install from registry\",\n\t\t)\n\t\t.option(\"--clone <profile>\", \"Clone from existing global profile\")\n\t\t.option(\"--source <namespace/component>\", \"Install from registry (requires --global)\")\n\t\t.option(\"--from <url>\", \"Ephemeral registry URL for --source (does not persist)\")\n\t\t.option(\"-g, --global\", \"Create global profile (required — local profiles are unsupported)\")\n\t\t.option(\"--json\", \"Output as JSON\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\t`\nExamples:\n $ ocx profile add work --global # Create global profile (~/.config/opencode/profiles/work/)\n $ ocx profile add work --clone dev --global # Clone from existing global profile\n $ ocx profile add work --source kdco/minimal --global # Install from configured registry\n $ ocx profile add work --source kdco/minimal --from http://r.com --global # Install from ephemeral registry\n`,\n\t\t)\n\t\t.action(async (name: string, options: ProfileAddOptions) => {\n\t\t\ttry {\n\t\t\t\tconst result = await runProfileAdd(name, options)\n\t\t\t\tif (options.json) {\n\t\t\t\t\toutputJson({ success: true, data: result })\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\n// =============================================================================\n// COMMAND IMPLEMENTATION\n// =============================================================================\n\nasync function runProfileAdd(name: string, options: ProfileAddOptions): Promise<ProfileAddResult> {\n\tconst quiet = options.json === true\n\n\t// ==========================================================================\n\t// Guard: Validate option combinations (Law 1: Early Exit, Law 4: Fail Fast)\n\t// These fire before the --global guard so their specific messages are preserved.\n\t// ==========================================================================\n\n\t// Guard: --clone cannot be used with --source or --from\n\tif (options.clone && (options.source || options.from)) {\n\t\tthrow new ValidationError(\n\t\t\t\"--clone cannot be used with --source or --from.\\n\\n\" +\n\t\t\t\t\"Use one of:\\n\" +\n\t\t\t\t\" ocx profile add <name> --clone <profile> --global # Clone existing profile\\n\" +\n\t\t\t\t\" ocx profile add <name> --source <ns/comp> --global # Install from registry\",\n\t\t)\n\t}\n\n\t// Guard: --from requires --source\n\tif (options.from && !options.source) {\n\t\t// Detect legacy usage pattern and provide migration hint\n\t\tconst fromValue = options.from.trim()\n\t\tconst isUrl = fromValue.startsWith(\"http://\") || fromValue.startsWith(\"https://\")\n\t\tconst isRegistryRef = (fromValue.match(/\\//g) || []).length === 1 && !isUrl\n\n\t\tif (isRegistryRef) {\n\t\t\t// Legacy: --from namespace/component\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Invalid option: --from requires --source.\\n\\n` +\n\t\t\t\t\t`Migration: The --from option now only accepts registry URLs.\\n` +\n\t\t\t\t\t`Use --source for namespace/component references:\\n\\n` +\n\t\t\t\t\t` ocx profile add ${name} --source ${fromValue} --global`,\n\t\t\t)\n\t\t}\n\n\t\tif (isUrl) {\n\t\t\t// Legacy: --from <url> with component in path\n\t\t\t// Attempt to extract base URL safely for a helpful hint\n\t\t\tlet migrationHint: string\n\t\t\ttry {\n\t\t\t\tconst parsed = new URL(fromValue)\n\t\t\t\t// Check if path has component-like segments (namespace/component)\n\t\t\t\tconst pathSegments = parsed.pathname.split(\"/\").filter(Boolean)\n\t\t\t\tif (pathSegments.length >= 2) {\n\t\t\t\t\t// Extract namespace/component from path and provide base URL\n\t\t\t\t\tconst component = pathSegments.slice(-2).join(\"/\")\n\t\t\t\t\tparsed.pathname = pathSegments.slice(0, -2).join(\"/\") || \"/\"\n\t\t\t\t\tconst baseUrl = parsed.toString().replace(/\\/$/, \"\")\n\t\t\t\t\tmigrationHint =\n\t\t\t\t\t\t`Migration: Separate the registry URL and component:\\n\\n` +\n\t\t\t\t\t\t` ocx profile add ${name} --source ${component} --from ${baseUrl} --global`\n\t\t\t\t} else {\n\t\t\t\t\t// Path doesn't look like namespace/component - use generic template\n\t\t\t\t\tmigrationHint =\n\t\t\t\t\t\t`Migration: Separate the registry URL and component:\\n\\n` +\n\t\t\t\t\t\t` ocx profile add ${name} --source <namespace/component> --from <registry-url> --global`\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// URL parsing failed - use generic template\n\t\t\t\tmigrationHint =\n\t\t\t\t\t`Migration: Separate the registry URL and component:\\n\\n` +\n\t\t\t\t\t` ocx profile add ${name} --source <namespace/component> --from <registry-url> --global`\n\t\t\t}\n\t\t\tthrow new ValidationError(`Invalid option: --from requires --source.\\n\\n${migrationHint}`)\n\t\t}\n\n\t\t// Plain profile name - suggest --clone instead\n\t\tthrow new ValidationError(\n\t\t\t`Invalid option: --from requires --source.\\n\\n` +\n\t\t\t\t`Did you mean to clone a profile?\\n\\n` +\n\t\t\t\t` ocx profile add ${name} --clone ${fromValue} --global`,\n\t\t)\n\t}\n\n\t// Guard: --source requires --global\n\tif (options.source && !options.global) {\n\t\tthrow new ValidationError(\n\t\t\t\"--source requires --global flag.\\n\\n\" +\n\t\t\t\t\"Profile installation from registries is only supported for global profiles:\\n\\n\" +\n\t\t\t\t` ocx profile add ${name} --source ${options.source} --global`,\n\t\t)\n\t}\n\n\t// Guard: Validate --from is a well-formed URL when provided with --source (Law 2: Parse at boundary)\n\tif (options.from) {\n\t\tconst fromValue = options.from.trim()\n\t\ttry {\n\t\t\tconst parsed = new URL(fromValue)\n\t\t\t// Require http/https protocol\n\t\t\tif (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Invalid --from value: \"${options.from}\".\\n\\n` +\n\t\t\t\t\t\t\"--from must be a registry URL with http:// or https:// protocol.\\n\" +\n\t\t\t\t\t\t\"For profile cloning, use --clone instead.\",\n\t\t\t\t)\n\t\t\t}\n\t\t\t// Require valid hostname (catches http:// or https:///)\n\t\t\tif (!parsed.hostname) {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Invalid --from value: \"${options.from}\".\\n\\n` +\n\t\t\t\t\t\t\"--from must be a valid registry URL with a hostname.\\n\" +\n\t\t\t\t\t\t\"Example: --from https://registry.example.com\",\n\t\t\t\t)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// URL constructor throws TypeError for malformed URLs\n\t\t\tif (error instanceof ValidationError) {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Invalid --from value: \"${options.from}\".\\n\\n` +\n\t\t\t\t\t\"--from must be a valid registry URL (http:// or https://).\\n\" +\n\t\t\t\t\t\"Example: --from https://registry.example.com\",\n\t\t\t)\n\t\t}\n\t}\n\n\t// ==========================================================================\n\t// Guard: Local profiles are unsupported (catch-all after specific guards)\n\t// ==========================================================================\n\tif (!options.global) {\n\t\tthrow new ConfigError(\n\t\t\t\"Local profiles are unsupported. Use --global to create a global profile.\\n\\n\" +\n\t\t\t\t` ocx profile add ${name} --global`,\n\t\t)\n\t}\n\n\tconst scope = \"global\" as const\n\n\t// ==========================================================================\n\t// Route to appropriate handler\n\t// ==========================================================================\n\n\tconst manager = await ProfileManager.requireInitialized()\n\n\t// Route: --clone (profile cloning)\n\tif (options.clone) {\n\t\tawait cloneFromGlobalProfile(manager, name, options.clone, quiet)\n\t\treturn {\n\t\t\tname,\n\t\t\tscope,\n\t\t\tmode: \"clone\",\n\t\t\tcloneFrom: options.clone,\n\t\t}\n\t}\n\n\t// Route: --source (registry installation)\n\tif (options.source) {\n\t\tconst { namespace, component } = parseSourceOption(options.source)\n\t\tlet registryUrl: string\n\n\t\tif (options.from) {\n\t\t\t// Ephemeral registry URL\n\t\t\tregistryUrl = normalizeRegistryUrl(options.from.trim())\n\t\t\tawait installProfileFromRegistry({\n\t\t\t\tnamespace,\n\t\t\t\tcomponent,\n\t\t\t\tprofileName: name,\n\t\t\t\tregistryUrl,\n\t\t\t\tquiet,\n\t\t\t})\n\t\t} else {\n\t\t\t// Configured registry\n\t\t\tconst globalRegistry = await requireGlobalRegistry(namespace)\n\t\t\tregistryUrl = globalRegistry.registryUrl\n\t\t\tawait installProfileFromRegistry({\n\t\t\t\tnamespace,\n\t\t\t\tcomponent,\n\t\t\t\tprofileName: name,\n\t\t\t\tregistryUrl,\n\t\t\t\tquiet,\n\t\t\t})\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\tscope,\n\t\t\tmode: \"registry\",\n\t\t\tregistry: {\n\t\t\t\tnamespace,\n\t\t\t\tcomponent,\n\t\t\t\turl: registryUrl,\n\t\t\t\tephemeral: Boolean(options.from),\n\t\t\t},\n\t\t}\n\t}\n\n\t// Route: No options (empty profile creation)\n\tawait createEmptyProfile(manager, name, quiet)\n\n\treturn {\n\t\tname,\n\t\tscope,\n\t\tmode: \"empty\",\n\t}\n}\n\n/**\n * Create an empty profile with default configuration.\n */\nasync function createEmptyProfile(\n\tmanager: ProfileManager,\n\tname: string,\n\tquiet: boolean,\n): Promise<void> {\n\tconst exists = await manager.exists(name)\n\tif (exists) {\n\t\tthrow new ProfileExistsError(name, `Remove it first with 'ocx profile rm ${name} --global'.`)\n\t}\n\tawait manager.add(name)\n\tif (!quiet) {\n\t\tlogger.success(`Created global profile \"${name}\"`)\n\t}\n}\n\n/**\n * Clone settings from an existing global profile.\n */\nasync function cloneFromGlobalProfile(\n\tmanager: ProfileManager,\n\tname: string,\n\tsourceName: string,\n\tquiet: boolean,\n): Promise<void> {\n\t// Guard: check if target profile already exists (Fail Fast)\n\tconst exists = await manager.exists(name)\n\tif (exists) {\n\t\tthrow new ProfileExistsError(name, `Remove it first with 'ocx profile rm ${name} --global'.`)\n\t}\n\n\t// Load source from global scope\n\ttry {\n\t\tawait manager.get(sourceName)\n\t} catch (error) {\n\t\t// Re-throw known errors with enhanced scope context\n\t\tif (error instanceof ProfileNotFoundError) {\n\t\t\tthrow new ProfileNotFoundError(\n\t\t\t\tsourceName,\n\t\t\t\t`Profile '${sourceName}' not found in global scope.`,\n\t\t\t)\n\t\t}\n\t\tif (error instanceof OCXError) {\n\t\t\tthrow error\n\t\t}\n\t\t// Wrap unknown errors with context\n\t\tthrow new ValidationError(\n\t\t\t`Failed to load profile '${sourceName}': ${error instanceof Error ? error.message : String(error)}`,\n\t\t)\n\t}\n\n\tawait manager.add(name)\n\n\t// Copy OCX config from source (byte-for-byte)\n\tconst sourceOcxPath = getProfileOcxConfig(sourceName)\n\tconst targetOcxPath = getProfileOcxConfig(name)\n\tawait atomicCopy(sourceOcxPath, targetOcxPath)\n\n\tif (!quiet) {\n\t\tlogger.success(`Created global profile \"${name}\" (cloned from \"${sourceName}\")`)\n\t}\n}\n",
112
- "/**\n * Profile Installation from Registry\n *\n * Installs a profile package from a registry, including:\n * - Profile files (ocx.jsonc, opencode.jsonc, AGENTS.md) -> flat in profile dir\n * - Dependencies (agents, skills, etc.) via runAddCore in flat profile root\n * - V2 receipt initialization (.ocx/receipt.jsonc)\n */\n\nimport { existsSync } from \"node:fs\"\nimport { mkdir, mkdtemp, rename, rm, writeFile } from \"node:fs/promises\"\nimport { dirname, join, relative } from \"node:path\"\nimport { parse } from \"jsonc-parser\"\nimport type { ConfigProvider } from \"../../config/provider\"\nimport { getProfileDir, getProfilesDir } from \"../../profile/paths\"\nimport { profileNameSchema } from \"../../profile/schema\"\nimport { fetchComponent, fetchFileContent } from \"../../registry/fetcher\"\nimport type { RegistryConfig } from \"../../schemas/config\"\nimport { writeReceipt } from \"../../schemas/config\"\nimport { profileOcxConfigSchema } from \"../../schemas/ocx\"\nimport { normalizeComponentManifest } from \"../../schemas/registry\"\nimport { resolveComponentTargetRoot } from \"../../utils/component-root-resolution\"\nimport {\n\tConfigError,\n\tConflictError,\n\tNetworkError,\n\tNotFoundError,\n\tValidationError,\n} from \"../../utils/errors\"\nimport { createSpinner, logger, normalizeRegistryUrl } from \"../../utils/index\"\nimport { PathValidationError, validatePath } from \"../../utils/path-security\"\nimport { registerPlannedWriteOrThrow } from \"../../utils/planned-writes\"\nimport { isPlainObject } from \"../../utils/type-guards\"\nimport { runAddCore } from \"../add\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface InstallProfileOptions {\n\t/** Registry name (configured alias, e.g., \"kdco\"). Required for identity resolution. */\n\tnamespace?: string\n\t/** Component name (e.g., \"minimal\") */\n\tcomponent: string\n\t/** Local profile name (e.g., \"work\") */\n\tprofileName: string\n\t/** Resolved registry URL */\n\tregistryUrl: string\n\t/** Suppress output */\n\tquiet?: boolean\n}\n\nfunction formatProfileRollbackCleanupWarning(\n\taction: string,\n\ttargetPath: string,\n\terror: unknown,\n): string {\n\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\treturn `${action} \"${targetPath}\" (${errorMessage})`\n}\n\ninterface RegistryDiagnosticsContext {\n\tregistryContext: \"source\" | \"dependency\"\n\tregistryName: string\n\tqualifiedName: string\n\tfallbackPhase: string\n\tfallbackUrl?: string\n}\n\ninterface ResolvedDependencyDiagnosticsContext {\n\tregistryName: string\n\tqualifiedName: string\n\tfallbackUrl?: string\n}\n\nfunction buildPackumentUrl(registryUrl: string, qualifiedName: string): string | undefined {\n\tconst [registryName, componentName] = qualifiedName.split(\"/\")\n\tif (!registryName || !componentName) {\n\t\treturn undefined\n\t}\n\n\treturn `${normalizeRegistryUrl(registryUrl)}/components/${componentName}.json`\n}\n\nfunction parseQualifiedNameParts(\n\tqualifiedName: string | undefined,\n): { registryName: string; componentName: string } | null {\n\tif (!qualifiedName) return null\n\n\tconst [registryName, componentName, ...extraParts] = qualifiedName.split(\"/\")\n\tif (!registryName || !componentName || extraParts.length > 0) {\n\t\treturn null\n\t}\n\n\treturn { registryName, componentName }\n}\n\nfunction inferDependencyFromErrorUrl(\n\terrorUrl: string | undefined,\n\tregistries: Record<string, RegistryConfig>,\n): { registryName?: string; componentName?: string } {\n\tif (!errorUrl) {\n\t\treturn {}\n\t}\n\n\tlet componentName: string | undefined\n\ttry {\n\t\tconst parsedErrorUrl = new URL(errorUrl)\n\t\tconst packumentMatch = parsedErrorUrl.pathname.match(/(?:^|\\/)components\\/([^/]+)\\.json$/)\n\t\tif (packumentMatch?.[1]) {\n\t\t\tcomponentName = decodeURIComponent(packumentMatch[1])\n\t\t} else {\n\t\t\tconst fileContentMatch = parsedErrorUrl.pathname.match(/(?:^|\\/)components\\/([^/]+)\\/.+$/)\n\t\t\tif (fileContentMatch?.[1]) {\n\t\t\t\tcomponentName = decodeURIComponent(fileContentMatch[1])\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Keep diagnostics best-effort; unresolved URL falls back to other context.\n\t}\n\n\tconst normalizedErrorUrl = normalizeRegistryUrl(errorUrl)\n\tlet registryName: string | undefined\n\tlet matchedPrefixLength = -1\n\n\tfor (const [candidateRegistryName, registryConfig] of Object.entries(registries)) {\n\t\tconst normalizedRegistryUrl = normalizeRegistryUrl(registryConfig.url)\n\t\tconst isMatch =\n\t\t\tnormalizedErrorUrl === normalizedRegistryUrl ||\n\t\t\tnormalizedErrorUrl.startsWith(`${normalizedRegistryUrl}/`)\n\n\t\tif (!isMatch || normalizedRegistryUrl.length <= matchedPrefixLength) {\n\t\t\tcontinue\n\t\t}\n\n\t\tregistryName = candidateRegistryName\n\t\tmatchedPrefixLength = normalizedRegistryUrl.length\n\t}\n\n\treturn { registryName, componentName }\n}\n\nfunction resolveDependencyDiagnosticsContext(options: {\n\terror: NetworkError\n\tdepRefs: string[]\n\tnamespace: string\n\tcomponent: string\n\tregistryUrl: string\n\tprofileRegistries: Record<string, RegistryConfig>\n}): ResolvedDependencyDiagnosticsContext {\n\tconst fallbackQualifiedName = options.depRefs[0] ?? `${options.namespace}/${options.component}`\n\tconst knownRegistries: Record<string, RegistryConfig> = {\n\t\t...options.profileRegistries,\n\t\t...(options.profileRegistries[options.namespace]\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\t[options.namespace]: {\n\t\t\t\t\t\turl: options.registryUrl,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t}\n\n\tlet registryName = options.error.registryName\n\tlet qualifiedName = options.error.qualifiedName\n\n\tconst qualifiedNameParts = parseQualifiedNameParts(qualifiedName)\n\tif (!registryName && qualifiedNameParts) {\n\t\tregistryName = qualifiedNameParts.registryName\n\t}\n\n\tconst qualifiedComponentName = qualifiedNameParts?.componentName\n\tconst bareComponentNameFromError =\n\t\tqualifiedName && !qualifiedNameParts && !qualifiedName.includes(\"/\") ? qualifiedName : undefined\n\n\tconst inferred = inferDependencyFromErrorUrl(options.error.url, knownRegistries)\n\tif (!registryName && inferred.registryName) {\n\t\tregistryName = inferred.registryName\n\t}\n\n\tconst resolvedComponentName =\n\t\tqualifiedComponentName ?? bareComponentNameFromError ?? inferred.componentName\n\tif ((!qualifiedName || !qualifiedNameParts) && registryName && resolvedComponentName) {\n\t\tqualifiedName = `${registryName}/${resolvedComponentName}`\n\t}\n\n\tif (!qualifiedName) {\n\t\tqualifiedName = fallbackQualifiedName\n\t}\n\n\tif (!registryName) {\n\t\tregistryName = parseQualifiedNameParts(qualifiedName)?.registryName ?? options.namespace\n\t}\n\n\tconst fallbackRegistryUrl =\n\t\tknownRegistries[registryName]?.url ||\n\t\t(registryName === options.namespace ? options.registryUrl : undefined)\n\n\treturn {\n\t\tregistryName,\n\t\tqualifiedName,\n\t\tfallbackUrl:\n\t\t\toptions.error.url ||\n\t\t\t(fallbackRegistryUrl ? buildPackumentUrl(fallbackRegistryUrl, qualifiedName) : undefined),\n\t}\n}\n\nfunction withRegistryDiagnostics(\n\terror: NetworkError,\n\tcontext: RegistryDiagnosticsContext,\n): NetworkError {\n\tconst phase = error.phase ?? context.fallbackPhase\n\tconst url = error.url ?? context.fallbackUrl\n\n\tconst diagnostics = [\n\t\t`phase: ${phase}`,\n\t\t`qualifiedName: ${context.qualifiedName}`,\n\t\t`registryContext: ${context.registryContext}`,\n\t\t`registryName: ${context.registryName}`,\n\t\t...(url ? [`url: ${url}`] : []),\n\t]\n\n\treturn new NetworkError(`${error.message} (${diagnostics.join(\", \")})`, {\n\t\turl,\n\t\tstatus: error.status,\n\t\tstatusText: error.statusText,\n\t\tphase,\n\t\tqualifiedName: context.qualifiedName,\n\t\tregistryContext: context.registryContext,\n\t\tregistryName: context.registryName,\n\t})\n}\n\n/**\n * Resolve an embedded .opencode/* profile target to a safe staging-relative path.\n * Re-validates containment after stripping the legacy prefix.\n */\nexport function resolveEmbeddedProfileTarget(rawTarget: string, stagingDir: string): string {\n\tif (!rawTarget.startsWith(\".opencode/\")) {\n\t\tthrow new ValidationError(\n\t\t\t`Invalid embedded target \"${rawTarget}\": expected .opencode/ prefix for embedded profile files.`,\n\t\t)\n\t}\n\n\tconst strippedTarget = rawTarget.slice(\".opencode/\".length)\n\tif (!strippedTarget) {\n\t\tthrow new ValidationError(\n\t\t\t`Invalid embedded target \"${rawTarget}\": missing path after .opencode/ prefix.`,\n\t\t)\n\t}\n\n\tlet safeAbsolutePath: string\n\ttry {\n\t\tsafeAbsolutePath = validatePath(stagingDir, strippedTarget)\n\t} catch (error) {\n\t\tif (error instanceof PathValidationError) {\n\t\t\tthrow new ValidationError(`Invalid embedded target \"${rawTarget}\": ${error.message}`)\n\t\t}\n\t\tthrow error\n\t}\n\n\tconst safeRelativeTarget = relative(stagingDir, safeAbsolutePath).replace(/\\\\/g, \"/\")\n\tif (safeRelativeTarget === \".\" || safeRelativeTarget === \"\") {\n\t\tthrow new ValidationError(\n\t\t\t`Invalid embedded target \"${rawTarget}\": target must resolve to a file path.`,\n\t\t)\n\t}\n\n\treturn safeRelativeTarget\n}\n\n// =============================================================================\n// MAIN INSTALLATION FUNCTION\n// =============================================================================\n\n/**\n * Install a profile from a registry.\n *\n * Flow:\n * 1. Fetch and validate the profile component manifest\n * 2. Fetch all profile files from registry\n * 3. Create staging directory for atomic install\n * 4. Write profile files (flat in profile dir)\n * 5. Initialize V2 receipt (.ocx/receipt.jsonc)\n * 6. Move staging dir to final profile location\n * 7. Install dependencies via runAddCore (if any)\n *\n * @throws ValidationError if component is not type \"profile\"\n * @throws NotFoundError if component doesn't exist\n * @throws ConflictError if profile exists and force is not set\n */\nexport async function installProfileFromRegistry(options: InstallProfileOptions): Promise<void> {\n\tconst { namespace: providedNamespace, component, profileName, registryUrl, quiet } = options\n\n\t// ==========================================================================\n\t// Guard: Validate profile name at boundary (Law 2: Parse Don't Validate)\n\t// ==========================================================================\n\n\tconst parseResult = profileNameSchema.safeParse(profileName)\n\tif (!parseResult.success) {\n\t\tthrow new ValidationError(\n\t\t\t`Invalid profile name: \"${profileName}\". ` +\n\t\t\t\t`Profile names must start with a letter and contain only alphanumeric characters, dots, underscores, or hyphens.`,\n\t\t)\n\t}\n\n\t// ==========================================================================\n\t// Phase 0: Resolve registry name (required — cannot derive from index)\n\t// ==========================================================================\n\n\tlet namespace: string\n\tif (providedNamespace) {\n\t\tnamespace = providedNamespace\n\t} else {\n\t\t// Cannot derive from index — registry name must be provided by caller\n\t\tthrow new ValidationError(\n\t\t\t`Registry name is required for URL-based profile installs.\\n\\n` +\n\t\t\t\t`Use a qualified component reference (e.g., 'my-registry/${component}') ` +\n\t\t\t\t`or specify --name to provide a registry alias.`,\n\t\t)\n\t}\n\n\tconst profileDir = getProfileDir(profileName)\n\tconst qualifiedName = `${namespace}/${component}`\n\tconst profileExists = existsSync(profileDir)\n\n\t// ==========================================================================\n\t// Guard: Profile already exists\n\t// ==========================================================================\n\n\tif (profileExists) {\n\t\tthrow new ConflictError(\n\t\t\t`Profile \"${profileName}\" already exists. Remove it first with 'ocx profile rm ${profileName} --global'.`,\n\t\t)\n\t}\n\n\t// ==========================================================================\n\t// Phase 1: Fetch and validate the profile component\n\t// ==========================================================================\n\n\tconst fetchSpin = quiet ? null : createSpinner({ text: `Fetching ${qualifiedName}...` })\n\tfetchSpin?.start()\n\n\tlet manifest: Awaited<ReturnType<typeof fetchComponent>>\n\ttry {\n\t\tmanifest = await fetchComponent(registryUrl, component)\n\t} catch (error) {\n\t\tfetchSpin?.fail(`Failed to fetch ${qualifiedName}`)\n\t\tif (error instanceof NetworkError) {\n\t\t\tthrow withRegistryDiagnostics(error, {\n\t\t\t\tregistryContext: \"source\",\n\t\t\t\tregistryName: namespace,\n\t\t\t\tqualifiedName,\n\t\t\t\tfallbackPhase: \"packument-fetch\",\n\t\t\t\tfallbackUrl: buildPackumentUrl(registryUrl, qualifiedName),\n\t\t\t})\n\t\t}\n\t\tif (error instanceof NotFoundError) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\t`Profile component \"${qualifiedName}\" not found in registry.\\n\\n` +\n\t\t\t\t\t`Check the component name and ensure the registry is configured.`,\n\t\t\t)\n\t\t}\n\t\tthrow error\n\t}\n\n\t// Guard: Must be canonical profile type component\n\tif (manifest.type !== \"profile\") {\n\t\tfetchSpin?.fail(`Invalid component type`)\n\t\tthrow new ValidationError(\n\t\t\t`Component \"${qualifiedName}\" is type \"${manifest.type}\", not \"profile\".\\n\\n` +\n\t\t\t\t`Only profile components can be installed with 'ocx profile add --source <ns/comp> --global'.`,\n\t\t)\n\t}\n\n\t// Normalize the manifest (expand Cargo-style shorthands)\n\tconst normalized = normalizeComponentManifest(manifest)\n\n\tfetchSpin?.succeed(`Fetched ${qualifiedName}`)\n\n\t// ==========================================================================\n\t// Phase 2: Fetch all profile files\n\t// ==========================================================================\n\n\tconst filesSpin = quiet ? null : createSpinner({ text: \"Downloading profile files...\" })\n\tfilesSpin?.start()\n\n\tconst profileFiles: { path: string; target: string; content: Buffer }[] = []\n\tconst embeddedFiles: { path: string; target: string; content: Buffer }[] = []\n\n\tfor (const file of normalized.files) {\n\t\tconst content = await fetchFileContent(registryUrl, component, file.path)\n\t\tconst fileEntry = {\n\t\t\tpath: file.path,\n\t\t\ttarget: file.target,\n\t\t\tcontent: Buffer.from(content),\n\t\t}\n\n\t\t// Route files: .opencode/ prefix marks embedded files for profile flattening\n\t\tif (file.target.startsWith(\".opencode/\")) {\n\t\t\tembeddedFiles.push(fileEntry)\n\t\t} else {\n\t\t\tprofileFiles.push(fileEntry)\n\t\t}\n\t}\n\n\tfilesSpin?.succeed(`Downloaded ${normalized.files.length} files`)\n\n\t// ==========================================================================\n\t// Phase 3: Create staging directory\n\t// Use profiles directory as parent to ensure same filesystem (avoids EXDEV on rename)\n\t// ==========================================================================\n\n\tconst profilesDir = getProfilesDir()\n\tawait mkdir(profilesDir, { recursive: true, mode: 0o700 })\n\tconst stagingDir = await mkdtemp(join(profilesDir, \".staging-\"))\n\tlet profilePromoted = false\n\tlet installCommitted = false\n\n\ttry {\n\t\t// ==========================================================================\n\t\t// Phase 4: Write profile files (flat in staging dir)\n\t\t// ==========================================================================\n\n\t\tconst writeSpin = quiet ? null : createSpinner({ text: \"Writing profile files...\" })\n\t\twriteSpin?.start()\n\n\t\tconst plannedWrites = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tabsolutePath: string\n\t\t\t\trelativePath: string\n\t\t\t\tcontent: Buffer\n\t\t\t\tsource: string\n\t\t\t}\n\t\t>()\n\n\t\tfor (const file of profileFiles) {\n\t\t\tconst resolvedTarget = resolveComponentTargetRoot(file.target, stagingDir)\n\t\t\tconst targetPath = join(stagingDir, resolvedTarget)\n\n\t\t\tregisterPlannedWriteOrThrow(plannedWrites, {\n\t\t\t\tabsolutePath: targetPath,\n\t\t\t\trelativePath: resolvedTarget,\n\t\t\t\tcontent: file.content,\n\t\t\t\tsource: `${component}:${file.path}`,\n\t\t\t})\n\t\t}\n\n\t\t// Write embedded files flat (strip .opencode/ prefix for profile mode)\n\t\tfor (const file of embeddedFiles) {\n\t\t\tconst target = resolveEmbeddedProfileTarget(file.target, stagingDir)\n\t\t\tconst resolvedTarget = resolveComponentTargetRoot(target, stagingDir)\n\t\t\tconst targetPath = join(stagingDir, resolvedTarget)\n\n\t\t\tregisterPlannedWriteOrThrow(plannedWrites, {\n\t\t\t\tabsolutePath: targetPath,\n\t\t\t\trelativePath: resolvedTarget,\n\t\t\t\tcontent: file.content,\n\t\t\t\tsource: `${component}:${file.path}`,\n\t\t\t})\n\t\t}\n\n\t\tfor (const plannedWrite of plannedWrites.values()) {\n\t\t\tconst targetPath = plannedWrite.absolutePath\n\t\t\tconst targetDir = dirname(targetPath)\n\n\t\t\tif (!existsSync(targetDir)) {\n\t\t\t\tawait mkdir(targetDir, { recursive: true })\n\t\t\t}\n\n\t\t\tawait writeFile(targetPath, plannedWrite.content)\n\t\t}\n\n\t\twriteSpin?.succeed(`Wrote ${plannedWrites.size} profile files`)\n\n\t\t// ==========================================================================\n\t\t// Phase 5: Initialize V2 receipt in staging directory\n\t\t// ==========================================================================\n\n\t\tawait writeReceipt(stagingDir, {\n\t\t\tversion: 1,\n\t\t\troot: profileDir,\n\t\t\tinstalled: {},\n\t\t})\n\n\t\t// ==========================================================================\n\t\t// Phase 6: Move staging to final profile directory\n\t\t// ==========================================================================\n\n\t\tconst renameSpin = quiet ? null : createSpinner({ text: \"Moving to profile directory...\" })\n\t\trenameSpin?.start()\n\n\t\t// Ensure parent directory exists\n\t\tconst profilesDir = dirname(profileDir)\n\t\tif (!existsSync(profilesDir)) {\n\t\t\tawait mkdir(profilesDir, { recursive: true, mode: 0o700 })\n\t\t}\n\n\t\tawait rename(stagingDir, profileDir)\n\t\tprofilePromoted = true\n\t\trenameSpin?.succeed(\"Profile installed\")\n\n\t\t// ==========================================================================\n\t\t// Phase 7: Install dependencies via runAddCore\n\t\t// ==========================================================================\n\n\t\tif (manifest.dependencies.length > 0) {\n\t\t\tconst depsSpin = quiet ? null : createSpinner({ text: \"Installing dependencies...\" })\n\t\t\tdepsSpin?.start()\n\t\t\tconst depRefs = manifest.dependencies.map((dep) =>\n\t\t\t\tdep.includes(\"/\") ? dep : `${namespace}/${dep}`,\n\t\t\t)\n\t\t\tlet profileRegistries: Record<string, RegistryConfig> = {}\n\n\t\t\ttry {\n\t\t\t\t// ========================================================================\n\t\t\t\t// Law 2: Parse Don't Validate - Extract and validate profile's registries\n\t\t\t\t// ========================================================================\n\n\t\t\t\t// 1. Parse the profile's ocx.jsonc to get its registry declarations\n\t\t\t\tconst profileOcxConfigPath = join(profileDir, \"ocx.jsonc\")\n\n\t\t\t\tif (existsSync(profileOcxConfigPath)) {\n\t\t\t\t\tconst profileOcxFile = Bun.file(profileOcxConfigPath)\n\t\t\t\t\tconst profileOcxContent = await profileOcxFile.text()\n\t\t\t\t\tconst profileOcxRaw = parse(profileOcxContent)\n\n\t\t\t\t\t// Validate registries with Zod\n\t\t\t\t\tconst parseResult = profileOcxConfigSchema.safeParse(profileOcxRaw)\n\t\t\t\t\tif (parseResult.success) {\n\t\t\t\t\t\tprofileRegistries = parseResult.data.registries ?? {}\n\t\t\t\t\t} else if (isPlainObject(profileOcxRaw) && \"registries\" in profileOcxRaw) {\n\t\t\t\t\t\t// registries field exists but is invalid - fail loud (Law 4)\n\t\t\t\t\t\tthrow new ConfigError(\n\t\t\t\t\t\t\t`Invalid registries in profile \"${profileName}\": ${parseResult.error.message}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\t// If parse fails and no registries field, just use empty {} (already initialized)\n\t\t\t\t}\n\n\t\t\t\t// Create provider with FULL profile registries\n\t\t\t\t// Pass all registries from the profile's ocx.jsonc to support transitive dependencies.\n\t\t\t\t// The profile's ocx.jsonc should declare all registries needed (including transitive).\n\t\t\t\tconst provider: ConfigProvider = {\n\t\t\t\t\tcwd: profileDir,\n\t\t\t\t\tgetRegistries: () => profileRegistries,\n\t\t\t\t\tgetComponentPath: () => \"\", // Flat install - no .opencode/ prefix\n\t\t\t\t}\n\n\t\t\t\tawait runAddCore(depRefs, { profile: profileName, quiet }, provider)\n\t\t\t\tdepsSpin?.succeed(`Installed ${manifest.dependencies.length} dependencies`)\n\t\t\t} catch (error) {\n\t\t\t\tdepsSpin?.fail(\"Failed to install dependencies\")\n\t\t\t\tif (error instanceof NetworkError) {\n\t\t\t\t\tconst dependencyDiagnosticsContext = resolveDependencyDiagnosticsContext({\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tdepRefs,\n\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tregistryUrl,\n\t\t\t\t\t\tprofileRegistries,\n\t\t\t\t\t})\n\n\t\t\t\t\tthrow withRegistryDiagnostics(error, {\n\t\t\t\t\t\tregistryContext: \"dependency\",\n\t\t\t\t\t\tregistryName: dependencyDiagnosticsContext.registryName,\n\t\t\t\t\t\tqualifiedName: dependencyDiagnosticsContext.qualifiedName,\n\t\t\t\t\t\tfallbackPhase: \"packument-fetch\",\n\t\t\t\t\t\tfallbackUrl: dependencyDiagnosticsContext.fallbackUrl,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\n\t\tinstallCommitted = true\n\n\t\t// ==========================================================================\n\t\t// Summary\n\t\t// ==========================================================================\n\n\t\tif (!quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.success(`Installed profile \"${profileName}\" from ${qualifiedName}`)\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.info(\"Profile contents:\")\n\t\t\tfor (const file of profileFiles) {\n\t\t\t\tlogger.info(` ${file.target}`)\n\t\t\t}\n\t\t\tfor (const file of embeddedFiles) {\n\t\t\t\tconst target = resolveEmbeddedProfileTarget(file.target, profileDir)\n\t\t\t\tlogger.info(` ${target}`)\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconst cleanupWarnings: string[] = []\n\n\t\t// Cleanup staging directory on failure\n\t\ttry {\n\t\t\tif (existsSync(stagingDir)) {\n\t\t\t\tawait rm(stagingDir, { recursive: true })\n\t\t\t}\n\t\t} catch (cleanupError) {\n\t\t\tcleanupWarnings.push(\n\t\t\t\tformatProfileRollbackCleanupWarning(\n\t\t\t\t\t\"Profile add rollback cleanup warning: failed to remove staging directory\",\n\t\t\t\t\tstagingDir,\n\t\t\t\t\tcleanupError,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\t// Roll back promoted profile when dependency install (or later commit work) fails.\n\t\t// This keeps failure deterministic: command failure leaves no blocking partial profile.\n\t\tif (profilePromoted && !installCommitted) {\n\t\t\ttry {\n\t\t\t\tif (existsSync(profileDir)) {\n\t\t\t\t\tawait rm(profileDir, { recursive: true, force: true })\n\t\t\t\t}\n\t\t\t} catch (cleanupError) {\n\t\t\t\tcleanupWarnings.push(\n\t\t\t\t\tformatProfileRollbackCleanupWarning(\n\t\t\t\t\t\t\"Profile add rollback cleanup warning: failed to remove promoted profile\",\n\t\t\t\t\t\tprofileDir,\n\t\t\t\t\t\tcleanupError,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tif (!quiet) {\n\t\t\tfor (const warning of cleanupWarnings) {\n\t\t\t\tlogger.warn(warning)\n\t\t\t}\n\t\t}\n\t\tthrow error\n\t}\n}\n",
113
- "/**\n * Profile List Command\n *\n * List all available profiles.\n * Profiles are global-only; local scope is unsupported and produces a hard error.\n * Use --global (required) to list global profiles (~/.config/opencode/profiles/).\n */\n\nimport type { Command } from \"commander\"\nimport { ProfileManager } from \"../../profile/manager\"\nimport { ConfigError } from \"../../utils/errors\"\nimport { handleError } from \"../../utils/handle-error\"\nimport { sharedOptions } from \"../../utils/shared-options\"\n\ninterface ProfileListOptions {\n\tglobal?: boolean\n\tjson?: boolean\n}\n\nexport function registerProfileListCommand(parent: Command): void {\n\tparent\n\t\t.command(\"list\")\n\t\t.alias(\"ls\")\n\t\t.description(\"List profiles (use --global; local profiles are unsupported)\")\n\t\t.option(\"-g, --global\", \"List global profiles (required — local profiles are unsupported)\")\n\t\t.addOption(sharedOptions.json())\n\t\t.action(async (options: ProfileListOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runProfileList(options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runProfileList(options: ProfileListOptions): Promise<void> {\n\t// Guard: local scope is unsupported (Law 1: Early Exit, Law 4: Fail Fast)\n\tif (!options.global) {\n\t\tthrow new ConfigError(\n\t\t\t\"Local profiles are unsupported. Use --global to list global profiles.\\n\\n\" +\n\t\t\t\t\" ocx profile list --global\",\n\t\t)\n\t}\n\n\tconst manager = await ProfileManager.requireInitialized()\n\n\tconst profiles = await manager.list()\n\n\tif (options.json) {\n\t\tconsole.log(JSON.stringify({ profiles, initialized: true }, null, 2))\n\t\treturn\n\t}\n\n\tconst heading = \"Global profiles:\"\n\tconst createHint =\n\t\t\"No global profiles found. Run 'ocx profile add <name> --global' to create one.\"\n\n\t// Guard: Handle empty profiles list\n\tif (profiles.length === 0) {\n\t\tconsole.log(createHint)\n\t\treturn\n\t}\n\n\t// Display profiles\n\tconsole.log(heading)\n\tfor (const name of profiles) {\n\t\tconsole.log(` ${name}`)\n\t}\n}\n",
114
- "/**\n * Profile Move Command\n *\n * Move (rename) a profile atomically.\n * Profiles are global-only; local scope is unsupported and produces a hard error.\n * Uses Cargo-style CLI pattern: no interactive confirmation.\n */\n\nimport type { Command } from \"commander\"\nimport { ProfileManager } from \"../../profile/manager\"\nimport { ConfigError } from \"../../utils/errors\"\nimport { handleError, logger, outputJson } from \"../../utils/index\"\n\ninterface MoveOptions {\n\tglobal?: boolean\n\tjson?: boolean\n}\n\nexport function registerProfileMoveCommand(parent: Command): void {\n\tparent\n\t\t.command(\"move <old-name> <new-name>\")\n\t\t.alias(\"mv\")\n\t\t.description(\"Move (rename) a profile (use --global; local profiles are unsupported)\")\n\t\t.option(\"-g, --global\", \"Move global profile (required — local profiles are unsupported)\")\n\t\t.option(\"--json\", \"Output as JSON\")\n\t\t.action(async (oldName: string, newName: string, options: MoveOptions) => {\n\t\t\ttry {\n\t\t\t\tconst result = await runProfileMove(oldName, newName, options)\n\t\t\t\tif (options.json) {\n\t\t\t\t\toutputJson({ success: true, data: result })\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runProfileMove(\n\toldName: string,\n\tnewName: string,\n\toptions: MoveOptions,\n): Promise<{ from: string; to: string; scope: \"global\"; warnActiveProfile: boolean }> {\n\t// Guard: local scope is unsupported (Law 1: Early Exit, Law 4: Fail Fast)\n\tif (!options.global) {\n\t\tthrow new ConfigError(\n\t\t\t\"Local profiles are unsupported. Use --global to move a global profile.\\n\\n\" +\n\t\t\t\t` ocx profile move ${oldName} ${newName} --global`,\n\t\t)\n\t}\n\n\tconst manager = await ProfileManager.requireInitialized()\n\n\tconst { warnActiveProfile } = await manager.move(oldName, newName)\n\n\tif (warnActiveProfile && !options.json) {\n\t\tlogger.warn(`Moving active profile. Update OCX_PROFILE env var to \"${newName}\".`)\n\t}\n\n\tif (!options.json) {\n\t\tlogger.success(`Moved global profile \"${oldName}\" → \"${newName}\"`)\n\t}\n\n\treturn { from: oldName, to: newName, scope: \"global\", warnActiveProfile }\n}\n",
115
- "/**\n * Profile Remove Command\n *\n * Delete a profile.\n * Profiles are global-only; local scope is unsupported and produces a hard error.\n * Uses Cargo-style CLI pattern: no interactive confirmation.\n */\n\nimport type { Command } from \"commander\"\nimport { ProfileManager } from \"../../profile/manager\"\nimport { ConfigError, ProfileNotFoundError } from \"../../utils/errors\"\nimport { handleError, logger, outputJson } from \"../../utils/index\"\n\ninterface RemoveOptions {\n\tglobal?: boolean\n\tjson?: boolean\n}\n\nexport function registerProfileRemoveCommand(parent: Command): void {\n\tparent\n\t\t.command(\"remove <name>\")\n\t\t.alias(\"rm\")\n\t\t.description(\"Delete a profile (use --global; local profiles are unsupported)\")\n\t\t.option(\"-g, --global\", \"Remove global profile (required — local profiles are unsupported)\")\n\t\t.option(\"--json\", \"Output as JSON\")\n\t\t.action(async (name: string, options: RemoveOptions) => {\n\t\t\ttry {\n\t\t\t\tconst result = await runProfileRemove(name, options)\n\t\t\t\tif (options.json) {\n\t\t\t\t\toutputJson({ success: true, data: result })\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runProfileRemove(\n\tname: string,\n\toptions: RemoveOptions,\n): Promise<{ name: string; scope: \"global\" }> {\n\t// Guard: local scope is unsupported (Law 1: Early Exit, Law 4: Fail Fast)\n\tif (!options.global) {\n\t\tthrow new ConfigError(\n\t\t\t\"Local profiles are unsupported. Use --global to remove a global profile.\\n\\n\" +\n\t\t\t\t\" ocx profile remove <name> --global\",\n\t\t)\n\t}\n\n\tconst manager = await ProfileManager.requireInitialized()\n\n\t// Verify profile exists first (fail fast)\n\tif (!(await manager.exists(name))) {\n\t\tthrow new ProfileNotFoundError(name)\n\t}\n\n\tawait manager.remove(name)\n\tif (!options.json) {\n\t\tlogger.success(`Deleted global profile \"${name}\"`)\n\t}\n\n\treturn { name, scope: \"global\" }\n}\n",
116
- "/**\n * Profile Show Command\n *\n * Display detailed information about a profile.\n * Shows the profile name, file paths, and OCX config contents.\n * Profiles are global-only; local scope is unsupported and produces a hard error.\n */\n\nimport type { Command } from \"commander\"\nimport { ProfileManager } from \"../../profile/manager\"\nimport {\n\tgetProfileAgents,\n\tgetProfileOcxConfig,\n\tgetProfileOpencodeConfig,\n} from \"../../profile/paths\"\nimport { ConfigError } from \"../../utils/errors\"\nimport { handleError } from \"../../utils/handle-error\"\nimport { sharedOptions } from \"../../utils/shared-options\"\n\ninterface ProfileShowOptions {\n\tglobal?: boolean\n\tjson?: boolean\n}\n\nexport function registerProfileShowCommand(parent: Command): void {\n\tparent\n\t\t.command(\"show [name]\")\n\t\t.description(\"Display profile contents (use --global; local profiles are unsupported)\")\n\t\t.option(\"-g, --global\", \"Show global profile (required — local profiles are unsupported)\")\n\t\t.addOption(sharedOptions.json())\n\t\t.action(async (name: string | undefined, options: ProfileShowOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runProfileShow(name, options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runProfileShow(\n\tname: string | undefined,\n\toptions: ProfileShowOptions,\n): Promise<void> {\n\t// Guard: local scope is unsupported (Law 1: Early Exit, Law 4: Fail Fast)\n\tif (!options.global) {\n\t\tthrow new ConfigError(\n\t\t\t\"Local profiles are unsupported. Use --global to show a global profile.\\n\\n\" +\n\t\t\t\t\" ocx profile show [name] --global\",\n\t\t)\n\t}\n\n\tconst manager = await ProfileManager.requireInitialized()\n\n\t// Use provided name or resolve profile (flag > env > default)\n\tconst profileName = name ?? (await manager.resolveProfile())\n\tconst profile = await manager.get(profileName)\n\n\tif (options.json) {\n\t\tconsole.log(JSON.stringify(profile, null, 2))\n\t\treturn\n\t}\n\n\t// Human-readable output\n\tconsole.log(`Profile: ${profile.name}`)\n\tconsole.log(`\\nFiles:`)\n\tconsole.log(` ocx.jsonc: ${getProfileOcxConfig(profileName)}`)\n\n\tif (profile.opencode) {\n\t\tconsole.log(` opencode.jsonc: ${getProfileOpencodeConfig(profileName)}`)\n\t}\n\n\tif (profile.hasAgents) {\n\t\tconsole.log(` AGENTS.md: ${getProfileAgents(profileName)}`)\n\t}\n\n\tconsole.log(`\\nOCX Config:`)\n\tconsole.log(JSON.stringify(profile.ocx, null, 2))\n}\n",
117
- "/**\n * Profile Command Group\n *\n * Parent command for managing global profiles.\n * Profiles allow multiple named configurations for different contexts.\n * Global profiles: ~/.config/opencode/profiles/ (user-wide)\n * Local profiles are unsupported and produce a hard error.\n *\n * Alias: `ocx p` (shorthand for `ocx profile`)\n */\n\nimport type { Command } from \"commander\"\nimport { registerProfileAddCommand } from \"./add\"\nimport { registerProfileListCommand } from \"./list\"\nimport { registerProfileMoveCommand } from \"./move\"\nimport { registerProfileRemoveCommand } from \"./remove\"\nimport { registerProfileShowCommand } from \"./show\"\n\n/**\n * Register the profile command and all subcommands.\n */\nexport function registerProfileCommand(program: Command): void {\n\tconst profile = program.command(\"profile\").alias(\"p\").description(\"Manage profiles (global only)\")\n\n\tregisterProfileListCommand(profile)\n\tregisterProfileAddCommand(profile)\n\tregisterProfileRemoveCommand(profile)\n\tregisterProfileMoveCommand(profile)\n\tregisterProfileShowCommand(profile)\n}\n",
118
- "/**\n * Registry Command\n *\n * Manage configured registries.\n */\n\nimport { existsSync } from \"node:fs\"\nimport { dirname, join } from \"node:path\"\nimport type { Command } from \"commander\"\nimport kleur from \"kleur\"\nimport { ProfileManager } from \"../profile/manager\"\nimport { getProfileOcxConfig } from \"../profile/paths\"\nimport type { RegistryConfig } from \"../schemas/config\"\nimport { findOcxConfig, readOcxConfig, writeOcxConfig } from \"../schemas/config\"\nimport { type DryRunResult, outputDryRun } from \"../utils/dry-run\"\nimport {\n\tConfigError,\n\tProfileNotFoundError,\n\tRegistryExistsError,\n\tValidationError,\n} from \"../utils/errors\"\nimport { handleError, logger, normalizeRegistryUrl, outputJson } from \"../utils/index\"\nimport { getGlobalConfigPath } from \"../utils/paths\"\nimport {\n\taddCommonOptions,\n\taddGlobalOption,\n\taddProfileOption,\n\tvalidateProfileName,\n} from \"../utils/shared-options\"\n\nexport interface RegistryOptions {\n\tcwd: string\n\tjson?: boolean\n\tquiet?: boolean\n\tglobal?: boolean\n\tprofile?: string\n}\n\nexport interface RegistryAddOptions extends RegistryOptions {\n\tname: string // Always present — enforced by Commander .requiredOption()\n\tdryRun?: boolean\n}\n\n// =============================================================================\n// CORE FUNCTIONS (used by both standard and profile commands)\n// =============================================================================\n\n/**\n * Core logic for adding a registry.\n * @param url Registry URL\n * @param options Options including optional name, version\n * @param callbacks Callbacks for reading/writing config\n */\nexport async function runRegistryAddCore(\n\turl: string,\n\toptions: RegistryAddOptions,\n\tcallbacks: {\n\t\tgetRegistries: () => Record<string, RegistryConfig>\n\t\tisLocked?: () => boolean\n\t\tsetRegistry: (name: string, config: RegistryConfig) => Promise<void>\n\t\ttargetLabel?: string // For dry-run summary\n\t},\n): Promise<\n\t{ name: string; url: string; updated: boolean; alreadyConfigured: boolean } | DryRunResult\n> {\n\t// Guard: Check registries aren't locked\n\tif (callbacks.isLocked?.()) {\n\t\tthrow new Error(\"Registries are locked. Cannot add.\")\n\t}\n\n\t// Validate and parse URL\n\tconst trimmedUrl = url.trim()\n\tif (!trimmedUrl) {\n\t\tthrow new ValidationError(\"Registry URL is required\")\n\t}\n\ttry {\n\t\tconst parsed = new URL(trimmedUrl)\n\t\tif (![\"http:\", \"https:\"].includes(parsed.protocol)) {\n\t\t\tthrow new ValidationError(`Invalid registry URL: ${trimmedUrl} (must use http or https)`)\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof ValidationError) throw error\n\t\tthrow new ValidationError(`Invalid registry URL: ${trimmedUrl}`)\n\t}\n\n\tconst normalizedUrl = normalizeRegistryUrl(trimmedUrl)\n\n\tconst name = options.name\n\tconst registries = callbacks.getRegistries()\n\tconst existingByName = registries[name]\n\n\t// URL uniqueness check: find any existing registry with the same normalized URL\n\tconst existingByUrl = findRegistryByUrl(registries, normalizedUrl)\n\n\t// Fetch registry index to validate the URL serves a valid registry\n\tconst { fetchRegistryIndex } = await import(\"../registry/fetcher\")\n\tawait fetchRegistryIndex(normalizedUrl)\n\n\t// -------------------------------------------------------------------------\n\t// Conflict resolution matrix (alias-first model)\n\t// Rule 1: New name + new URL => add\n\t// Rule 2: Same name + same URL => idempotent no-op\n\t// Rule 3: Same name + different URL => fail (name conflict)\n\t// Rule 4: Different name + same URL => fail (URL conflict)\n\t// -------------------------------------------------------------------------\n\n\tconst nameExists = existingByName !== undefined\n\tconst urlExists = existingByUrl !== null\n\tconst sameUrl = nameExists && normalizeRegistryUrl(existingByName.url) === normalizedUrl\n\tconst urlOwnedByDifferentName = urlExists && existingByUrl.name !== name\n\n\t// Dry-run mode: report what would happen\n\tif (options.dryRun) {\n\t\tconst warnings: string[] = []\n\n\t\tif (nameExists && !sameUrl) {\n\t\t\twarnings.push(\n\t\t\t\t`Registry '${name}' already exists with a different URL (${existingByName.url}). ` +\n\t\t\t\t\t`Run 'ocx registry remove ${name}' first, then re-add.`,\n\t\t\t)\n\t\t} else if (urlOwnedByDifferentName) {\n\t\t\twarnings.push(\n\t\t\t\t`URL '${normalizedUrl}' is already registered under name '${existingByUrl.name}'. ` +\n\t\t\t\t\t`Run 'ocx registry remove ${existingByUrl.name}' first, then re-add.`,\n\t\t\t)\n\t\t}\n\n\t\tconst isConflict = (nameExists && !sameUrl) || urlOwnedByDifferentName\n\t\tconst isIdempotent = nameExists && sameUrl\n\t\tconst targetLabel = callbacks.targetLabel || \"config\"\n\n\t\tconst dryRunResult: DryRunResult = {\n\t\t\tdryRun: true,\n\t\t\tcommand: \"registry add\",\n\t\t\twouldPerform: isIdempotent\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taction: \"add\",\n\t\t\t\t\t\t\ttarget: `registry:${name}`,\n\t\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\t\turl: normalizedUrl,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\tvalidation: {\n\t\t\t\tpassed: !isConflict,\n\t\t\t\twarnings: warnings.length > 0 ? warnings : undefined,\n\t\t\t},\n\t\t\tsummary: isConflict\n\t\t\t\t? `Would fail: conflict detected for registry '${name}'`\n\t\t\t\t: isIdempotent\n\t\t\t\t\t? `Registry '${name}' already configured with same URL (no-op)`\n\t\t\t\t\t: `Would add registry '${name}' to ${targetLabel}`,\n\t\t}\n\n\t\treturn dryRunResult\n\t}\n\n\t// Rule 3: Same name + different URL => fail\n\tif (nameExists && !sameUrl) {\n\t\tthrow new RegistryExistsError(name, existingByName.url, normalizedUrl, callbacks.targetLabel)\n\t}\n\n\t// Rule 4: Different name + same URL => fail\n\tif (urlOwnedByDifferentName) {\n\t\tthrow new RegistryExistsError(\n\t\t\tname,\n\t\t\tnormalizedUrl,\n\t\t\tnormalizedUrl,\n\t\t\tcallbacks.targetLabel,\n\t\t\texistingByUrl.name,\n\t\t)\n\t}\n\n\t// Rule 2: Same name + same URL => idempotent no-op\n\tif (nameExists && sameUrl) {\n\t\treturn { name, url: normalizedUrl, updated: false, alreadyConfigured: true }\n\t}\n\n\t// Rule 1: New name + new URL => add\n\tawait callbacks.setRegistry(name, {\n\t\turl: normalizedUrl,\n\t})\n\n\treturn { name, url: normalizedUrl, updated: false, alreadyConfigured: false }\n}\n\n/**\n * Find an existing registry entry by normalized URL.\n * Returns the entry name and config if found, null otherwise.\n */\nfunction findRegistryByUrl(\n\tregistries: Record<string, RegistryConfig>,\n\tnormalizedUrl: string,\n): { name: string; config: RegistryConfig } | null {\n\tfor (const [name, config] of Object.entries(registries)) {\n\t\tif (normalizeRegistryUrl(config.url) === normalizedUrl) {\n\t\t\treturn { name, config }\n\t\t}\n\t}\n\treturn null\n}\n\n/**\n * Core logic for removing a registry.\n * @param name Registry name to remove\n * @param callbacks Callbacks for reading/writing config\n */\nexport async function runRegistryRemoveCore(\n\tname: string,\n\tcallbacks: {\n\t\tgetRegistries: () => Record<string, RegistryConfig>\n\t\tisLocked?: () => boolean\n\t\tremoveRegistry: (name: string) => Promise<void>\n\t},\n): Promise<{ removed: string }> {\n\t// Guard: Check registries aren't locked\n\tif (callbacks.isLocked?.()) {\n\t\tthrow new Error(\"Registries are locked. Cannot remove.\")\n\t}\n\n\tconst registries = callbacks.getRegistries()\n\tif (!(name in registries)) {\n\t\tthrow new Error(`Registry '${name}' not found.`)\n\t}\n\n\tawait callbacks.removeRegistry(name)\n\treturn { removed: name }\n}\n\n/**\n * Core logic for listing registries.\n * @param callbacks Callbacks for reading config\n */\nexport function runRegistryListCore(callbacks: {\n\tgetRegistries: () => Record<string, RegistryConfig>\n\tisLocked?: () => boolean\n}): { registries: Array<{ name: string; url: string }>; locked: boolean } {\n\tconst registries = callbacks.getRegistries()\n\tconst locked = callbacks.isLocked?.() ?? false\n\n\tconst list = Object.entries(registries).map(([name, cfg]) => ({\n\t\tname,\n\t\turl: cfg.url,\n\t}))\n\n\treturn { registries: list, locked }\n}\n\n// =============================================================================\n// REGISTRY TARGET RESOLUTION\n// =============================================================================\n\ninterface RegistryTarget {\n\tscope: \"profile\" | \"global\" | \"local\"\n\tconfigPath: string\n\tconfigDir: string\n\ttargetLabel: string\n}\n\n/**\n * Resolves the target config location for registry operations.\n * Handles mutual exclusivity checks and profile/global/local scope selection.\n */\nasync function resolveRegistryTarget(\n\toptions: RegistryOptions,\n\tcommand: Command,\n\tcwd: string,\n): Promise<RegistryTarget> {\n\tconst cwdExplicitlyProvided = command.getOptionValueSource(\"cwd\") === \"cli\"\n\n\t// Mutual exclusivity checks\n\tif (options.global && options.profile) {\n\t\tthrow new ValidationError(\"Cannot use both --global and --profile flags\")\n\t}\n\tif (cwdExplicitlyProvided && options.profile) {\n\t\tthrow new ValidationError(\"Cannot use both --cwd and --profile flags\")\n\t}\n\tif (options.global && cwdExplicitlyProvided) {\n\t\tthrow new ValidationError(\"Cannot use both --global and --cwd flags\")\n\t}\n\n\t// Profile scope\n\tif (options.profile) {\n\t\tvalidateProfileName(options.profile)\n\n\t\tconst manager = await ProfileManager.requireInitialized()\n\t\tif (!(await manager.exists(options.profile))) {\n\t\t\tthrow new ProfileNotFoundError(options.profile)\n\t\t}\n\n\t\tconst configPath = getProfileOcxConfig(options.profile)\n\t\tif (!existsSync(configPath)) {\n\t\t\tthrow new ConfigError(\n\t\t\t\t`Profile '${options.profile}' has no ocx.jsonc. Run 'ocx profile config ${options.profile}' to create it.`,\n\t\t\t)\n\t\t}\n\n\t\treturn {\n\t\t\tscope: \"profile\",\n\t\t\tconfigPath,\n\t\t\tconfigDir: dirname(configPath),\n\t\t\ttargetLabel: `profile '${options.profile}' config`,\n\t\t}\n\t}\n\n\t// Global scope\n\tif (options.global) {\n\t\tconst configDir = getGlobalConfigPath()\n\t\treturn {\n\t\t\tscope: \"global\",\n\t\t\tconfigPath: join(configDir, \"ocx.jsonc\"),\n\t\t\tconfigDir,\n\t\t\ttargetLabel: \"global config\",\n\t\t}\n\t}\n\n\t// Local scope (default)\n\tconst found = findOcxConfig(cwd)\n\treturn {\n\t\tscope: \"local\",\n\t\tconfigPath: found.path,\n\t\tconfigDir: found.exists ? dirname(found.path) : join(cwd, \".opencode\"),\n\t\ttargetLabel: \"local config\",\n\t}\n}\n\n// =============================================================================\n// COMMAND REGISTRATION\n// =============================================================================\n\nexport function registerRegistryCommand(program: Command): void {\n\tconst registry = program.command(\"registry\").description(\"Manage registries\")\n\n\t// registry add <url> --name <name>\n\tconst addCmd = registry\n\t\t.command(\"add\")\n\t\t.description(\"Add a registry\")\n\t\t.argument(\"<url>\", \"Registry URL\")\n\t\t.requiredOption(\n\t\t\t\"--name <name>\",\n\t\t\t\"Registry alias (required, used as lookup key for alias/component refs)\",\n\t\t)\n\t\t.option(\"--dry-run\", \"Validate registry without adding to config\")\n\n\taddGlobalOption(addCmd)\n\taddProfileOption(addCmd)\n\taddCommonOptions(addCmd)\n\n\taddCmd.action(async (url: string, options: RegistryAddOptions, command: Command) => {\n\t\tlet target: RegistryTarget | undefined\n\t\ttry {\n\t\t\tconst cwd = options.cwd ?? process.cwd()\n\t\t\ttarget = await resolveRegistryTarget(options, command, cwd)\n\t\t\tconst { configDir, configPath } = target\n\n\t\t\t// Read config from resolved path\n\t\t\tconst config = await readOcxConfig(configDir)\n\t\t\tif (!config) {\n\t\t\t\tconst initHint =\n\t\t\t\t\ttarget.scope === \"global\"\n\t\t\t\t\t\t? \"Run 'ocx init --global' first.\"\n\t\t\t\t\t\t: target.scope === \"profile\"\n\t\t\t\t\t\t\t? `Run 'ocx profile config ${options.profile}' to create it.`\n\t\t\t\t\t\t\t: \"Run 'ocx init' first.\"\n\t\t\t\tlogger.error(`${target.targetLabel} not found. ${initHint}`)\n\t\t\t\tprocess.exit(1)\n\t\t\t}\n\n\t\t\tconst result = await runRegistryAddCore(url, options, {\n\t\t\t\tgetRegistries: () => config.registries,\n\t\t\t\tisLocked: () => config.lockRegistries ?? false,\n\t\t\t\tsetRegistry: async (name, regConfig) => {\n\t\t\t\t\tconfig.registries[name] = regConfig\n\t\t\t\t\tawait writeOcxConfig(configDir, config, configPath)\n\t\t\t\t},\n\t\t\t\ttargetLabel: target.targetLabel,\n\t\t\t})\n\n\t\t\t// Handle dry-run result\n\t\t\tif (\"dryRun\" in result && result.dryRun) {\n\t\t\t\toutputDryRun(result, { json: options.json, quiet: options.quiet })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Type narrowing: result is now the add-result shape\n\t\t\tconst actualResult = result as {\n\t\t\t\tname: string\n\t\t\t\turl: string\n\t\t\t\tupdated: boolean\n\t\t\t\talreadyConfigured: boolean\n\t\t\t}\n\n\t\t\tif (options.json) {\n\t\t\t\toutputJson({ success: true, data: actualResult })\n\t\t\t} else if (!options.quiet) {\n\t\t\t\tif (actualResult.alreadyConfigured) {\n\t\t\t\t\tlogger.info(`Registry already configured (no changes): ${actualResult.name}`)\n\t\t\t\t} else if (actualResult.updated) {\n\t\t\t\t\tlogger.success(\n\t\t\t\t\t\t`Updated registry in ${target.targetLabel}: ${actualResult.name} -> ${actualResult.url}`,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tlogger.success(\n\t\t\t\t\t\t`Added registry to ${target.targetLabel}: ${actualResult.name} -> ${actualResult.url}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\thandleError(error, { json: options.json })\n\t\t}\n\t})\n\n\t// registry remove <name>\n\tconst removeCmd = registry\n\t\t.command(\"remove\")\n\t\t.description(\"Remove a registry\")\n\t\t.argument(\"<name>\", \"Registry name\")\n\n\taddGlobalOption(removeCmd)\n\taddProfileOption(removeCmd)\n\taddCommonOptions(removeCmd)\n\n\tremoveCmd.action(async (name: string, options: RegistryOptions, command: Command) => {\n\t\ttry {\n\t\t\tconst cwd = options.cwd ?? process.cwd()\n\t\t\tconst target = await resolveRegistryTarget(options, command, cwd)\n\n\t\t\t// Read config from resolved path\n\t\t\tconst config = await readOcxConfig(target.configDir)\n\t\t\tif (!config) {\n\t\t\t\tconst initHint =\n\t\t\t\t\ttarget.scope === \"global\"\n\t\t\t\t\t\t? \"Run 'ocx init --global' first.\"\n\t\t\t\t\t\t: target.scope === \"profile\"\n\t\t\t\t\t\t\t? `Run 'ocx profile config ${options.profile}' to create it.`\n\t\t\t\t\t\t\t: \"Run 'ocx init' first.\"\n\t\t\t\tlogger.error(`${target.targetLabel} not found. ${initHint}`)\n\t\t\t\tprocess.exit(1)\n\t\t\t}\n\n\t\t\tconst result = await runRegistryRemoveCore(name, {\n\t\t\t\tgetRegistries: () => config.registries,\n\t\t\t\tisLocked: () => config.lockRegistries ?? false,\n\t\t\t\tremoveRegistry: async (regName) => {\n\t\t\t\t\tdelete config.registries[regName]\n\t\t\t\t\tawait writeOcxConfig(target.configDir, config, target.configPath)\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (options.json) {\n\t\t\t\toutputJson({ success: true, data: result })\n\t\t\t} else if (!options.quiet) {\n\t\t\t\tlogger.success(`Removed registry from ${target.targetLabel}: ${result.removed}`)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\thandleError(error, { json: options.json })\n\t\t}\n\t})\n\n\t// registry list\n\tconst listCmd = registry.command(\"list\").description(\"List configured registries\")\n\n\taddGlobalOption(listCmd)\n\taddProfileOption(listCmd)\n\taddCommonOptions(listCmd)\n\n\tlistCmd.action(async (options: RegistryOptions, command: Command) => {\n\t\ttry {\n\t\t\tconst cwd = options.cwd ?? process.cwd()\n\t\t\tconst target = await resolveRegistryTarget(options, command, cwd)\n\n\t\t\t// Read config from resolved path\n\t\t\tconst config = await readOcxConfig(target.configDir)\n\t\t\tif (!config) {\n\t\t\t\tconst initHint =\n\t\t\t\t\ttarget.scope === \"global\"\n\t\t\t\t\t\t? \"Run 'ocx init --global' first.\"\n\t\t\t\t\t\t: target.scope === \"profile\"\n\t\t\t\t\t\t\t? `Run 'ocx profile config ${options.profile}' to create it.`\n\t\t\t\t\t\t\t: \"Run 'ocx init' first.\"\n\t\t\t\tlogger.warn(`${target.targetLabel} not found. ${initHint}`)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst result = runRegistryListCore({\n\t\t\t\tgetRegistries: () => config.registries,\n\t\t\t\tisLocked: () => config.lockRegistries ?? false,\n\t\t\t})\n\n\t\t\tif (options.json) {\n\t\t\t\toutputJson({ success: true, data: result })\n\t\t\t} else if (!options.quiet) {\n\t\t\t\tif (result.registries.length === 0) {\n\t\t\t\t\tlogger.info(\"No registries configured.\")\n\t\t\t\t} else {\n\t\t\t\t\tconst scopeLabel =\n\t\t\t\t\t\ttarget.scope === \"global\"\n\t\t\t\t\t\t\t? \" (global)\"\n\t\t\t\t\t\t\t: target.scope === \"profile\"\n\t\t\t\t\t\t\t\t? ` (profile '${options.profile}')`\n\t\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t`Configured registries${scopeLabel}${result.locked ? kleur.yellow(\" (locked)\") : \"\"}:`,\n\t\t\t\t\t)\n\t\t\t\t\tfor (const reg of result.registries) {\n\t\t\t\t\t\tconsole.log(` ${kleur.cyan(reg.name)}: ${reg.url}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\thandleError(error, { json: options.json })\n\t\t}\n\t})\n}\n",
119
- "/**\n * OCX CLI - remove command\n * Remove installed components\n */\n\nimport { realpathSync } from \"node:fs\"\nimport { rm } from \"node:fs/promises\"\nimport { sep } from \"node:path\"\n\nimport type { Command } from \"commander\"\nimport { LocalConfigProvider } from \"../config/provider\"\nimport { readReceipt, writeReceipt } from \"../schemas/config\"\nimport { resolveInstalledComponentRefs } from \"../utils/component-ref-resolver\"\nimport { type DryRunResult, outputDryRun } from \"../utils/dry-run\"\nimport { NotFoundError, ValidationError } from \"../utils/errors\"\nimport { createSpinner, handleError, logger } from \"../utils/index\"\nimport { PathValidationError, validatePath } from \"../utils/path-security\"\nimport { checkFileIntegrity, parseCanonicalId } from \"../utils/receipt\"\nimport { addCommonOptions, addVerboseOption } from \"../utils/shared-options\"\n\ninterface PreflightRemovalFile {\n\tpath: string\n\ttargetReal: string | null\n}\n\nexport function resolvePreflightRemovalTarget(\n\tprojectCwd: string,\n\tbaseReal: string,\n\trelativePath: string,\n): PreflightRemovalFile {\n\tconst safePath = validatePath(projectCwd, relativePath)\n\n\tlet targetReal: string\n\ttry {\n\t\ttargetReal = realpathSync(safePath)\n\t} catch (error: unknown) {\n\t\tconst code = (error as NodeJS.ErrnoException).code\n\t\tif (code === \"ENOENT\" || code === \"ENOTDIR\") {\n\t\t\treturn {\n\t\t\t\tpath: relativePath,\n\t\t\t\ttargetReal: null,\n\t\t\t}\n\t\t}\n\t\tif (code === \"ELOOP\") {\n\t\t\tthrow new ValidationError(`Security violation: symlink loop detected at ${relativePath}`)\n\t\t}\n\t\tif (code === \"EACCES\" || code === \"EPERM\") {\n\t\t\tthrow new ValidationError(`Security violation: cannot verify path ${relativePath}`)\n\t\t}\n\t\tthrow error\n\t}\n\n\tif (targetReal === baseReal) {\n\t\tthrow new ValidationError(\n\t\t\t`Security violation: cannot delete project root directory (${relativePath})`,\n\t\t)\n\t}\n\n\tif (!targetReal.startsWith(baseReal + sep)) {\n\t\tthrow new ValidationError(\"Security violation: path escapes project directory\")\n\t}\n\n\treturn {\n\t\tpath: relativePath,\n\t\ttargetReal,\n\t}\n}\n\nexport function resolveDeleteTimeRemovalTarget(\n\tprojectCwd: string,\n\tbaseReal: string,\n\tpreflightFile: PreflightRemovalFile,\n): string | null {\n\tconst currentResolution = resolvePreflightRemovalTarget(projectCwd, baseReal, preflightFile.path)\n\n\tif (!preflightFile.targetReal) {\n\t\tif (currentResolution.targetReal) {\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Security violation: missing target reappeared during removal (${preflightFile.path})`,\n\t\t\t)\n\t\t}\n\n\t\treturn null\n\t}\n\n\tif (!currentResolution.targetReal) {\n\t\treturn null\n\t}\n\n\tif (currentResolution.targetReal !== preflightFile.targetReal) {\n\t\tthrow new ValidationError(\n\t\t\t`Security violation: target changed during removal (${preflightFile.path})`,\n\t\t)\n\t}\n\n\treturn currentResolution.targetReal\n}\n\nfunction deduplicateCanonicalIds(canonicalIds: string[]): string[] {\n\tconst seen = new Set<string>()\n\tconst uniqueCanonicalIds: string[] = []\n\n\tfor (const canonicalId of canonicalIds) {\n\t\tif (seen.has(canonicalId)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tseen.add(canonicalId)\n\t\tuniqueCanonicalIds.push(canonicalId)\n\t}\n\n\treturn uniqueCanonicalIds\n}\n\nexport interface RemoveOptions {\n\tcwd?: string\n\tquiet?: boolean\n\tverbose?: boolean\n\tjson?: boolean\n\tforce?: boolean\n\tdryRun?: boolean\n}\n\nexport function registerRemoveCommand(program: Command): void {\n\tconst cmd = program\n\t\t.command(\"remove\")\n\t\t.description(\"Remove installed components\")\n\t\t.argument(\"<components...>\", \"Component refs to remove (canonical ID or alias/component)\")\n\n\taddCommonOptions(cmd)\n\tcmd.option(\"-f, --force\", \"Force removal even if files have been modified\")\n\taddVerboseOption(cmd)\n\n\tcmd\n\t\t.option(\"--dry-run\", \"Show what would be removed without making changes\")\n\t\t.action(async (components: string[], options: RemoveOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runRemove(components, options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\nasync function runRemove(componentRefs: string[], options: RemoveOptions): Promise<void> {\n\tconst cwd = options.cwd ?? process.cwd()\n\tconst provider = await LocalConfigProvider.requireInitialized(cwd)\n\n\t// Guard: No components specified\n\tif (componentRefs.length === 0) {\n\t\tthrow new ValidationError(\"No components specified. Specify at least one component ID.\")\n\t}\n\n\t// V1: Read receipt\n\tconst receipt = await readReceipt(provider.cwd)\n\tif (!receipt || Object.keys(receipt.installed).length === 0) {\n\t\tthrow new NotFoundError(\"No components installed.\")\n\t}\n\n\tconst canonicalIds = deduplicateCanonicalIds(\n\t\tresolveInstalledComponentRefs(componentRefs, receipt),\n\t)\n\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Removing components...\" })\n\tspin?.start()\n\n\tconst removed: string[] = []\n\tconst notFound: string[] = []\n\tconst toRemove: Array<{ canonicalId: string; files: PreflightRemovalFile[] }> = []\n\tconst warnings: string[] = []\n\tlet hasIntegrityIssues = false\n\n\tlet baseReal: string\n\ttry {\n\t\tbaseReal = realpathSync(provider.cwd)\n\t} catch (_error: unknown) {\n\t\tthrow new ValidationError(\"Cannot resolve project directory\")\n\t}\n\n\ttry {\n\t\t// First pass: validate all components and check integrity\n\t\tfor (const canonicalId of canonicalIds) {\n\t\t\t// Guard: Component must exist in receipt\n\t\t\tconst entry = receipt.installed[canonicalId]\n\t\t\tif (!entry) {\n\t\t\t\tthrow new Error(`Resolved component '${canonicalId}' was not found in receipt.`)\n\t\t\t}\n\n\t\t\t// Preflight validation: validate all file paths before any deletion\n\t\t\tconst preflightFiles: PreflightRemovalFile[] = []\n\t\t\tfor (const fileEntry of entry.files) {\n\t\t\t\t// Guard: Empty or \".\" paths are rejected (Law 1: Early Exit)\n\t\t\t\tif (!fileEntry.path || fileEntry.path === \".\") {\n\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t`Invalid file path in receipt for '${canonicalId}': path cannot be empty or \".\"`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Validate path structure and containment checks (same checks as deletion phase)\n\t\t\t\ttry {\n\t\t\t\t\tpreflightFiles.push(resolvePreflightRemovalTarget(provider.cwd, baseReal, fileEntry.path))\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof PathValidationError) {\n\t\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t\t`Security violation in receipt for '${canonicalId}': ${error.message}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check file integrity before removal\n\t\t\tconst integrity = await checkFileIntegrity(provider.cwd, entry)\n\t\t\tif (!integrity.intact) {\n\t\t\t\thasIntegrityIssues = true\n\t\t\t\tconst modifiedFiles = integrity.modified.map((f) => ` - ${f}`).join(\"\\n\")\n\n\t\t\t\tif (options.force) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t`Component '${canonicalId}' has been modified but will be force-removed:\\n${modifiedFiles}`,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t`Component '${canonicalId}' has been modified. Use --force to remove anyway:\\n${modifiedFiles}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Collect files to remove\n\t\t\ttoRemove.push({ canonicalId, files: preflightFiles })\n\t\t}\n\n\t\t// Handle dry-run mode\n\t\tif (options.dryRun) {\n\t\t\tspin?.stop()\n\n\t\t\tconst dryRunResult: DryRunResult = {\n\t\t\t\tdryRun: true,\n\t\t\t\tcommand: \"remove\",\n\t\t\t\twouldPerform: toRemove.flatMap(({ canonicalId, files }) =>\n\t\t\t\t\tfiles.map((fileEntry) => ({\n\t\t\t\t\t\taction: \"delete\" as const,\n\t\t\t\t\t\ttarget: fileEntry.path,\n\t\t\t\t\t\tdetails: { component: canonicalId },\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t\tvalidation: {\n\t\t\t\t\tpassed: !hasIntegrityIssues || Boolean(options.force),\n\t\t\t\t\twarnings: warnings.length > 0 ? warnings : undefined,\n\t\t\t\t},\n\t\t\t\tsummary: `${toRemove.length} component(s), ${toRemove.reduce((sum, item) => sum + item.files.length, 0)} file(s) would be removed`,\n\t\t\t}\n\n\t\t\toutputDryRun(dryRunResult, {\n\t\t\t\tjson: options.json,\n\t\t\t\tquiet: options.quiet,\n\t\t\t\thints:\n\t\t\t\t\thasIntegrityIssues && !options.force\n\t\t\t\t\t\t? [\"Add --force to remove modified files\"]\n\t\t\t\t\t\t: undefined,\n\t\t\t})\n\n\t\t\treturn\n\t\t}\n\n\t\t// Actual removal: fail fast if integrity issues and not forced\n\t\tif (hasIntegrityIssues && !options.force) {\n\t\t\tspin?.fail(\"File integrity check failed\")\n\n\t\t\t// Law 1 (Early Exit): for...of with early break on first failure\n\t\t\t// Law 4 (Fail Loud): try/catch wraps checkFileIntegrity, throws ValidationError on failure\n\t\t\tlet firstIssue:\n\t\t\t\t| { canonicalId: string; integrity: Awaited<ReturnType<typeof checkFileIntegrity>> }\n\t\t\t\t| undefined\n\n\t\t\tfor (const item of toRemove) {\n\t\t\t\tconst entry = receipt.installed[item.canonicalId]\n\t\t\t\tif (!entry) continue\n\n\t\t\t\ttry {\n\t\t\t\t\tconst integrity = await checkFileIntegrity(provider.cwd, entry)\n\t\t\t\t\tif (!integrity.intact) {\n\t\t\t\t\t\tfirstIssue = { canonicalId: item.canonicalId, integrity }\n\t\t\t\t\t\tbreak // Early exit on first issue\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// EDGE CASE: checkFileIntegrity throws → abort removal with clear error\n\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t`Failed to check integrity for '${item.canonicalId}': ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (firstIssue) {\n\t\t\t\t// Include both modified AND missing files in error message\n\t\t\t\tconst modifiedList =\n\t\t\t\t\tfirstIssue.integrity.modified.length > 0\n\t\t\t\t\t\t? `Modified files:\\n${firstIssue.integrity.modified.map((f) => ` - ${f}`).join(\"\\n\")}`\n\t\t\t\t\t\t: \"\"\n\t\t\t\tconst missingList =\n\t\t\t\t\tfirstIssue.integrity.missing.length > 0\n\t\t\t\t\t\t? `Missing files:\\n${firstIssue.integrity.missing.map((f) => ` - ${f}`).join(\"\\n\")}`\n\t\t\t\t\t\t: \"\"\n\t\t\t\tconst details = [modifiedList, missingList].filter(Boolean).join(\"\\n\")\n\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Component '${firstIssue.canonicalId}' has been modified. Use --force to remove anyway.\\n${details}`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\t// Second pass: actually remove files (preflight already validated all targets)\n\t\tfor (const { canonicalId, files } of toRemove) {\n\t\t\t// Remove files\n\t\t\tfor (const fileEntry of files) {\n\t\t\t\tconst deleteTarget = resolveDeleteTimeRemovalTarget(provider.cwd, baseReal, fileEntry)\n\n\t\t\t\tif (!deleteTarget) {\n\t\t\t\t\tif (options.verbose) {\n\t\t\t\t\t\tlogger.info(` ⊘ Skipped ${fileEntry.path} (not found)`)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tawait rm(deleteTarget, { force: true })\n\t\t\t\tif (options.verbose) {\n\t\t\t\t\tlogger.info(` ✓ Removed ${fileEntry.path}`)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove from receipt\n\t\t\tdelete receipt.installed[canonicalId]\n\t\t\tremoved.push(canonicalId)\n\t\t}\n\n\t\t// Save receipt first\n\t\tawait writeReceipt(provider.cwd, receipt)\n\n\t\t// Only show success after write completes\n\t\tspin?.succeed(`Removed ${removed.length} component(s)`)\n\n\t\t// Output results\n\t\tif (options.json) {\n\t\t\tconsole.log(JSON.stringify({ success: true, removed, notFound }, null, 2))\n\t\t} else if (!options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tfor (const id of removed) {\n\t\t\t\tconst parsed = parseCanonicalId(id)\n\t\t\t\tlogger.success(`✓ Removed ${parsed.registryName}/${parsed.name}@${parsed.revision}`)\n\t\t\t}\n\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.success(`Done! Removed ${removed.length} component(s).`)\n\t\t}\n\t} catch (error) {\n\t\tspin?.fail(\"Failed to remove components\")\n\t\tthrow error\n\t}\n}\n",
120
- "import type { Receipt } from \"../schemas/config\"\nimport { parseQualifiedComponent } from \"../schemas/registry\"\nimport { NotFoundError, ValidationError } from \"./errors\"\nimport { parseCanonicalId } from \"./receipt\"\n\nfunction isShorthandComponentRef(ref: string): boolean {\n\treturn ref.includes(\"/\") && !ref.includes(\"::\")\n}\n\nfunction parseShorthandComponentRef(ref: string): { registryName: string; componentName: string } {\n\ttry {\n\t\tconst { namespace, component } = parseQualifiedComponent(ref)\n\t\treturn { registryName: namespace, componentName: component }\n\t} catch (error) {\n\t\tthrow new ValidationError(\n\t\t\terror instanceof Error ? error.message : `Invalid component ref: '${ref}'`,\n\t\t)\n\t}\n}\n\nfunction formatAmbiguousRefMessage(ref: string, matchingCanonicalIds: string[]): string {\n\treturn (\n\t\t`Ambiguous component reference '${ref}'. Found ${matchingCanonicalIds.length} installed matches:\\n` +\n\t\tmatchingCanonicalIds.map((canonicalId) => ` - ${canonicalId}`).join(\"\\n\") +\n\t\t\"\\n\\nUse one of the canonical IDs above.\"\n\t)\n}\n\nfunction formatUnknownRefMessage(ref: string): string {\n\treturn `Component '${ref}' is not installed.\\nRun 'ocx search --installed' to see installed components.`\n}\n\nexport function resolveInstalledComponentRef(ref: string, receipt: Receipt): string {\n\tconst installedCanonicalIds = Object.keys(receipt.installed)\n\n\tif (receipt.installed[ref]) {\n\t\treturn ref\n\t}\n\n\tif (isShorthandComponentRef(ref)) {\n\t\tconst { registryName, componentName } = parseShorthandComponentRef(ref)\n\t\tconst matchingCanonicalIds = installedCanonicalIds\n\t\t\t.filter((canonicalId) => {\n\t\t\t\tconst parsed = parseCanonicalId(canonicalId)\n\t\t\t\treturn parsed.registryName === registryName && parsed.name === componentName\n\t\t\t})\n\t\t\t.sort()\n\n\t\tif (matchingCanonicalIds.length === 1) {\n\t\t\tconst [canonicalId] = matchingCanonicalIds\n\t\t\tif (!canonicalId) {\n\t\t\t\tthrow new Error(\"Unexpected empty canonical ID result\")\n\t\t\t}\n\t\t\treturn canonicalId\n\t\t}\n\n\t\tif (matchingCanonicalIds.length > 1) {\n\t\t\tthrow new ValidationError(formatAmbiguousRefMessage(ref, matchingCanonicalIds))\n\t\t}\n\t}\n\n\tthrow new NotFoundError(formatUnknownRefMessage(ref))\n}\n\nexport function resolveInstalledComponentRefs(refs: string[], receipt: Receipt): string[] {\n\treturn refs.map((ref) => resolveInstalledComponentRef(ref, receipt))\n}\n",
121
- "/**\n * Search/List Command\n *\n * Search for components across registries or list installed.\n */\n\nimport type { Command } from \"commander\"\nimport { InvalidArgumentError, Option } from \"commander\"\nimport fuzzysort from \"fuzzysort\"\nimport kleur from \"kleur\"\nimport type { ConfigProvider } from \"../config/provider\"\nimport { LocalConfigProvider } from \"../config/provider\"\nimport { ConfigResolver } from \"../config/resolver\"\nimport { fetchRegistryIndex } from \"../registry/fetcher\"\nimport { readReceipt } from \"../schemas\"\nimport { createSpinner, handleError, logger, outputJson } from \"../utils/index\"\nimport { addCommonOptions, addVerboseOption } from \"../utils/shared-options\"\n\nexport interface SearchOptions {\n\tcwd: string\n\tjson: boolean\n\tquiet: boolean\n\tverbose: boolean\n\tinstalled: boolean\n\tlimit: number\n\tprofile?: string\n}\n\n/**\n * Parses and validates a positive integer from CLI input.\n * @param value - The string value from CLI\n * @returns The parsed positive integer\n * @throws InvalidArgumentError if value is not a positive integer\n */\nfunction parsePositiveInt(value: string): number {\n\tconst parsed = parseInt(value, 10)\n\tif (Number.isNaN(parsed) || parsed <= 0) {\n\t\tthrow new InvalidArgumentError(\"Must be a positive integer\")\n\t}\n\treturn parsed\n}\n\nexport function registerSearchCommand(program: Command): void {\n\tconst cmd = program\n\t\t.command(\"search\")\n\t\t.alias(\"list\")\n\t\t.description(\"Search for components across registries or list installed\")\n\t\t.argument(\"[query]\", \"Search query\")\n\t\t.option(\"--installed\", \"List installed components only\", false)\n\t\t.option(\"-p, --profile <name>\", \"Use specific profile\")\n\t\t.addOption(new Option(\"--limit <n>\", \"Limit results\").default(20).argParser(parsePositiveInt))\n\n\taddCommonOptions(cmd)\n\taddVerboseOption(cmd)\n\n\tcmd.action(async (query: string | undefined, options: SearchOptions) => {\n\t\ttry {\n\t\t\t// List installed only\n\t\t\tif (options.installed) {\n\t\t\t\tconst receipt = await readReceipt(options.cwd)\n\t\t\t\tif (!receipt || Object.keys(receipt.installed).length === 0) {\n\t\t\t\t\tif (options.json) {\n\t\t\t\t\t\toutputJson({ success: true, data: { components: [] } })\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.info(\"No components installed.\")\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst installed = Object.entries(receipt.installed).map(([_canonicalId, info]) => ({\n\t\t\t\t\tname: `${info.registryName}/${info.name}`,\n\t\t\t\t\tregistry: info.registryUrl,\n\t\t\t\t\tversion: info.revision,\n\t\t\t\t\tinstalledAt: undefined, // V2 receipt doesn't track installedAt\n\t\t\t\t}))\n\n\t\t\t\tif (options.json) {\n\t\t\t\t\toutputJson({ success: true, data: { components: installed } })\n\t\t\t\t} else {\n\t\t\t\t\tlogger.info(`Installed components (${installed.length}):`)\n\t\t\t\t\tfor (const comp of installed) {\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t` ${kleur.cyan(comp.name)} ${kleur.dim(`v${comp.version}`)} from ${comp.registry}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Search using ConfigResolver (supports --profile) or LocalConfigProvider\n\t\t\tlet provider: ConfigProvider\n\n\t\t\tif (options.profile) {\n\t\t\t\t// Use ConfigResolver with profile\n\t\t\t\tconst resolver = await ConfigResolver.create(options.cwd, { profile: options.profile })\n\t\t\t\tprovider = {\n\t\t\t\t\tcwd: resolver.getCwd(),\n\t\t\t\t\tgetRegistries: () => resolver.getRegistries(),\n\t\t\t\t\tgetComponentPath: () => resolver.getComponentPath(),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tprovider = await LocalConfigProvider.requireInitialized(options.cwd)\n\t\t\t}\n\n\t\t\tawait runSearchCore(query, options, provider)\n\t\t} catch (error) {\n\t\t\thandleError(error, { json: options.json })\n\t\t}\n\t})\n}\n\n/**\n * Core search logic that accepts a ConfigProvider.\n * This enables reuse across both standard and profile modes.\n */\nexport async function runSearchCore(\n\tquery: string | undefined,\n\toptions: { limit: number; json?: boolean; quiet?: boolean; verbose?: boolean },\n\tprovider: ConfigProvider,\n): Promise<void> {\n\tconst registries = provider.getRegistries()\n\n\tif (options.verbose) {\n\t\tlogger.info(`Searching in ${Object.keys(registries).length} registries...`)\n\t}\n\n\tconst allComponents: Array<{\n\t\tname: string\n\t\tdescription: string\n\t\ttype: string\n\t\tregistry: string\n\t}> = []\n\n\tconst spinner = createSpinner({\n\t\ttext: \"Searching registries...\",\n\t\tquiet: options.quiet || options.verbose,\n\t})\n\n\tif (!options.json && !options.verbose) {\n\t\tspinner.start()\n\t}\n\n\tfor (const [registryName, registryConfig] of Object.entries(registries)) {\n\t\ttry {\n\t\t\tif (options.verbose) {\n\t\t\t\tlogger.info(`Fetching index from ${registryName} (${registryConfig.url})...`)\n\t\t\t}\n\t\t\tconst index = await fetchRegistryIndex(registryConfig.url)\n\t\t\tif (options.verbose) {\n\t\t\t\tlogger.info(`Found ${index.components.length} components in ${registryName}`)\n\t\t\t}\n\t\t\tfor (const comp of index.components) {\n\t\t\t\tallComponents.push({\n\t\t\t\t\tname: `${registryName}/${comp.name}`,\n\t\t\t\t\tdescription: comp.description,\n\t\t\t\t\ttype: comp.type,\n\t\t\t\t\tregistry: registryName,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (options.verbose) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`Failed to fetch registry ${registryName}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\t// Skip failed registries\n\t\t}\n\t}\n\n\tif (!options.json && !options.verbose) {\n\t\tspinner.stop()\n\t}\n\n\t// Filter by query if provided\n\tlet results = allComponents\n\tif (query) {\n\t\tconst fuzzyResults = fuzzysort.go(query, allComponents, {\n\t\t\tkeys: [\"name\", \"description\"],\n\t\t\tlimit: options.limit,\n\t\t})\n\t\tresults = fuzzyResults.map((r) => r.obj)\n\t} else {\n\t\tresults = results.slice(0, options.limit)\n\t}\n\n\tif (options.json) {\n\t\toutputJson({ success: true, data: { components: results } })\n\t} else {\n\t\tif (results.length === 0) {\n\t\t\tlogger.info(\"No components found.\")\n\t\t} else {\n\t\t\tlogger.info(`Found ${results.length} components:`)\n\t\t\tfor (const comp of results) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t` ${kleur.cyan(comp.name)} ${kleur.dim(`(${comp.type})`)} - ${comp.description}`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n",
122
- "/**\n * Schemas Barrel Export\n *\n * Exports all schemas and Bun-specific I/O helpers.\n */\n\n// Common schemas (reusable validation patterns)\nexport { safeRelativePathSchema } from \"./common\"\n\n// Config & lockfile schemas + I/O helpers\nexport {\n\ttype InstalledComponent,\n\tinstalledComponentSchema,\n\ttype OcxConfig,\n\ttype OcxLock,\n\tocxConfigSchema,\n\tocxLockSchema,\n\t// Receipt types (V2)\n\ttype Receipt,\n\t// Types\n\ttype RegistryConfig,\n\t// I/O helpers\n\treadOcxConfig,\n\treadOcxLock,\n\treadReceipt,\n\treceiptSchema,\n\t// Schemas\n\tregistryConfigSchema,\n\twriteOcxConfig,\n\twriteOcxLock,\n\twriteReceipt,\n} from \"./config\"\n\n// OCX profile schemas\nexport { type ProfileOcxConfig, profileOcxConfigSchema } from \"./ocx\"\n\n// Registry & component schemas\nexport {\n\ttype AgentConfig,\n\tagentConfigSchema,\n\taliasSchema,\n\ttype ComponentFile,\n\ttype ComponentFileObject,\n\ttype ComponentManifest,\n\t// Types\n\ttype ComponentType,\n\tcomponentFileObjectSchema,\n\tcomponentFileSchema,\n\tcomponentManifestSchema,\n\t// Component schemas\n\tcomponentTypeSchema,\n\tcreateQualifiedComponent,\n\tdependencyRefSchema,\n\t// Normalizer functions\n\tinferTargetPath,\n\ttype McpServer,\n\ttype McpServerRef,\n\tmcpServerObjectSchema,\n\tmcpServerRefSchema,\n\ttype NormalizedComponentManifest,\n\ttype NormalizedOpencodeConfig,\n\tnamespaceSchema,\n\tnormalizeComponentManifest,\n\tnormalizeFile,\n\tnormalizeMcpServer,\n\ttype OpencodeConfig,\n\t// Name schemas\n\topenCodeNameSchema,\n\topencodeConfigSchema,\n\ttype Packument,\n\ttype PermissionConfig,\n\tpackumentSchema,\n\t// Helper functions\n\tparseQualifiedComponent,\n\tpermissionConfigSchema,\n\tqualifiedComponentSchema,\n\ttype Registry,\n\ttype RegistryIndex,\n\tregistryIndexSchema,\n\t// Registry schemas\n\tregistrySchema,\n\ttargetPathSchema,\n} from \"./registry\"\n",
123
- "/**\n * Self Uninstall Command\n *\n * Safely removes OCX global configuration files and binary.\n * Follows the rustup uninstall model for a clean removal experience.\n *\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Guard clauses for safety checks at top of functions\n * - Parse Don't Validate: Path/target types are structured from the start\n * - Atomic Predictability: Each removal operation is independent and pure\n * - Fail Fast: Safety violations exit immediately with descriptive errors\n * - Intentional Naming: tildify, isLexicallyInside, classifyTargetSafety\n */\n\nimport { existsSync, lstatSync, readdirSync, realpathSync, rmSync, unlinkSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport path from \"node:path\"\nimport type { Command } from \"commander\"\nimport { getGlobalConfig, getProfilesDir } from \"../../profile/paths\"\nimport {\n\tdetectInstallMethod,\n\tgetExecutablePath,\n\ttype InstallMethod,\n} from \"../../self-update/detect-method\"\nimport { type DryRunAction, type DryRunResult, outputDryRun } from \"../../utils/dry-run\"\nimport { handleError } from \"../../utils/handle-error\"\nimport { outputJson } from \"../../utils/json-output\"\nimport { highlight, logger } from \"../../utils/logger\"\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\n/** Exit codes specific to uninstall operations */\nexport const UNINSTALL_EXIT_CODES = {\n\tSUCCESS: 0,\n\tERROR: 1, // Permission denied, package-managed install\n\tSAFETY_ERROR: 2, // Containment violation, symlink root\n} as const\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/** Represents a target for removal with safety classification */\ninterface UninstallTarget {\n\trootPath: string\n\trelativePath: string\n\tabsolutePath: string\n\tdisplayPath: string // tildified\n\t// Note: \"junction\" omitted - Node's lstat doesn't reliably detect Windows junctions\n\tkind: \"file\" | \"directory\" | \"symlink\" | \"missing\"\n\tdeleteIfEmpty: boolean\n\tsafetyStatus: \"safe\" | \"forbidden\" | \"error\"\n}\n\n/** Result of validating the root directory */\ninterface RootValidationResult {\n\tvalid: boolean\n\treason?: \"symlink\" | \"not-directory\" | \"not-found\" | \"permission\"\n}\n\n/** Result of checking realpath containment */\ninterface RealpathContainmentResult {\n\tcontained: boolean\n\terror?: \"permission\" | \"io\"\n}\n\n/** Result of attempting to delete a target */\ninterface DeletionResult {\n\ttarget: UninstallTarget\n\tsuccess: boolean\n\tskipped: boolean\n\treason?: \"not found\" | \"not empty\" | \"permission denied\" | \"containment violation\"\n\terror?: Error\n}\n\n/** Command options for uninstall */\ninterface UninstallOptions {\n\tdryRun?: boolean\n\tjson?: boolean\n}\n\ninterface JsonErrorOutput {\n\tsuccess: false\n\terror: {\n\t\tcode: string\n\t\tmessage: string\n\t\tdetails?: Record<string, unknown>\n\t}\n\texitCode: number\n\tmeta: {\n\t\ttimestamp: string\n\t}\n}\n\nfunction exitWithJsonSuccess(data: Record<string, unknown>, exitCode = 0): never {\n\toutputJson({ success: true, data })\n\tprocess.exit(exitCode)\n}\n\nfunction exitWithJsonFailure(\n\tcode: string,\n\tmessage: string,\n\texitCode: number,\n\tdetails?: Record<string, unknown>,\n): never {\n\tconst payload: JsonErrorOutput = {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage,\n\t\t\t...(details && { details }),\n\t\t},\n\t\texitCode,\n\t\tmeta: {\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t},\n\t}\n\n\toutputJson(payload)\n\tprocess.exit(exitCode)\n}\n\n// =============================================================================\n// PATH HELPERS (Law 5: Intentional Naming)\n// =============================================================================\n\n/**\n * Type guard to check if an error is a Node.js errno exception.\n * @param err - The error to check\n * @returns True if the error has a code property\n */\nfunction isNodeError(err: unknown): err is NodeJS.ErrnoException {\n\treturn err instanceof Error && \"code\" in err\n}\n\n/**\n * Convert absolute path to ~/relative format for display.\n * @param absolutePath - The absolute path to tildify\n * @returns Path with home directory replaced by ~\n */\nfunction tildify(absolutePath: string): string {\n\tconst home = homedir()\n\tif (!home) return absolutePath\n\n\t// Exact match or proper child path\n\tif (absolutePath === home) return \"~\"\n\tif (absolutePath.startsWith(home + path.sep)) {\n\t\treturn `~${absolutePath.slice(home.length)}`\n\t}\n\treturn absolutePath\n}\n\n/**\n * Get the relative path from parent to child if child is contained within parent.\n * Returns null if child would escape parent (e.g., via ..).\n * @param parent - The parent directory\n * @param child - The potential child path\n * @returns Relative path if contained, null otherwise\n */\nfunction getRelativePathIfContained(parent: string, child: string): string | null {\n\tconst normalizedParent = path.normalize(parent)\n\tconst normalizedChild = path.normalize(child)\n\n\t// Get relative path\n\tconst relative = path.relative(normalizedParent, normalizedChild)\n\n\t// Check for escape: starts with .. or is absolute\n\tif (relative.startsWith(\"..\") || path.isAbsolute(relative)) {\n\t\treturn null\n\t}\n\n\treturn relative\n}\n\n/**\n * Check if target is lexically inside root (no symlink resolution).\n * Safe for symlink containment checks.\n * @param root - The root directory\n * @param target - The target path to check\n * @returns True if target is lexically inside root\n */\nfunction isLexicallyInside(root: string, target: string): boolean {\n\treturn getRelativePathIfContained(root, target) !== null\n}\n\n/**\n * Check if target's realpath is inside root's realpath.\n * Used for file/directory containment checks.\n * @param root - The root directory (must exist)\n * @param target - The target path to check\n * @returns Result object with containment status and any error\n */\nfunction isRealpathInside(root: string, target: string): RealpathContainmentResult {\n\t// Early exit: if target doesn't exist, can't resolve realpath\n\tif (!existsSync(target)) {\n\t\treturn { contained: true } // Missing targets are safe to \"delete\"\n\t}\n\n\ttry {\n\t\tconst realRoot = realpathSync(root)\n\t\tconst realTarget = realpathSync(target)\n\t\treturn { contained: getRelativePathIfContained(realRoot, realTarget) !== null }\n\t} catch (err) {\n\t\t// Distinguish permission errors from other IO errors\n\t\tif (isNodeError(err) && (err.code === \"EACCES\" || err.code === \"EPERM\")) {\n\t\t\treturn { contained: false, error: \"permission\" }\n\t\t}\n\t\treturn { contained: false, error: \"io\" }\n\t}\n}\n\n/**\n * Validate that root directory exists, is a directory, and is not a symlink.\n * @param rootPath - The root path to validate\n * @returns Validation result with reason if invalid\n */\nfunction validateRootDirectory(rootPath: string): RootValidationResult {\n\ttry {\n\t\tconst stats = lstatSync(rootPath)\n\t\tif (stats.isSymbolicLink()) {\n\t\t\treturn { valid: false, reason: \"symlink\" }\n\t\t}\n\t\tif (!stats.isDirectory()) {\n\t\t\treturn { valid: false, reason: \"not-directory\" }\n\t\t}\n\t\treturn { valid: true }\n\t} catch (err) {\n\t\tif (isNodeError(err)) {\n\t\t\tif (err.code === \"ENOENT\") {\n\t\t\t\treturn { valid: false, reason: \"not-found\" }\n\t\t\t}\n\t\t\tif (err.code === \"EACCES\" || err.code === \"EPERM\") {\n\t\t\t\treturn { valid: false, reason: \"permission\" }\n\t\t\t}\n\t\t}\n\t\t// Default to permission error for unknown failures (operational error)\n\t\treturn { valid: false, reason: \"permission\" }\n\t}\n}\n\n/**\n * Determine the kind of filesystem entry at path.\n * @param targetPath - The path to check\n * @returns The kind of entry\n */\nfunction getPathKind(targetPath: string): UninstallTarget[\"kind\"] {\n\tif (!existsSync(targetPath)) {\n\t\treturn \"missing\"\n\t}\n\n\ttry {\n\t\tconst stats = lstatSync(targetPath)\n\t\tif (stats.isSymbolicLink()) {\n\t\t\treturn \"symlink\"\n\t\t}\n\t\tif (stats.isDirectory()) {\n\t\t\treturn \"directory\"\n\t\t}\n\t\treturn \"file\"\n\t} catch {\n\t\treturn \"missing\"\n\t}\n}\n\n/**\n * Check if a directory is empty.\n * @param dirPath - Path to the directory\n * @returns True if empty, false if not empty or not a directory\n */\nfunction isDirectoryEmpty(dirPath: string): boolean {\n\tif (!existsSync(dirPath)) {\n\t\treturn true\n\t}\n\n\ttry {\n\t\tconst entries = readdirSync(dirPath)\n\t\treturn entries.length === 0\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/**\n * Classify the safety status of a target.\n * @param target - Partial target with path info\n * @returns Safety status: \"safe\", \"forbidden\", or \"error\" (for operational failures)\n */\nfunction classifyTargetSafety(\n\ttarget: Pick<UninstallTarget, \"rootPath\" | \"absolutePath\" | \"kind\">,\n): \"safe\" | \"forbidden\" | \"error\" {\n\t// Missing targets are always safe\n\tif (target.kind === \"missing\") {\n\t\treturn \"safe\"\n\t}\n\n\t// Symlinks use lexical containment only (don't follow)\n\tif (target.kind === \"symlink\") {\n\t\treturn isLexicallyInside(target.rootPath, target.absolutePath) ? \"safe\" : \"forbidden\"\n\t}\n\n\t// Files/directories use realpath containment\n\tconst result = isRealpathInside(target.rootPath, target.absolutePath)\n\tif (result.error) {\n\t\treturn \"error\" // Operational failure (permission/IO)\n\t}\n\treturn result.contained ? \"safe\" : \"forbidden\"\n}\n\n// =============================================================================\n// BINARY DETECTION (Law 1: Early Exit for edge cases)\n// =============================================================================\n\n/**\n * Check if install method is package-managed.\n * @param method - The install method\n * @returns True if managed by npm/pnpm/bun/yarn\n */\nfunction isPackageManaged(method: InstallMethod): boolean {\n\treturn method === \"npm\" || method === \"pnpm\" || method === \"bun\" || method === \"yarn\"\n}\n\n/**\n * Get the uninstall command for a package manager.\n * @param method - The package manager\n * @returns The command string to run\n */\nfunction getPackageManagerCommand(method: InstallMethod): string {\n\tswitch (method) {\n\t\tcase \"npm\":\n\t\t\treturn \"npm uninstall -g ocx\"\n\t\tcase \"pnpm\":\n\t\t\treturn \"pnpm remove -g ocx\"\n\t\tcase \"bun\":\n\t\t\treturn \"bun remove -g ocx\"\n\t\tcase \"yarn\":\n\t\t\treturn \"yarn global remove ocx\"\n\t\tdefault:\n\t\t\treturn \"npm uninstall -g ocx\"\n\t}\n}\n\n// =============================================================================\n// TARGET BUILDING (Law 2: Parse Don't Validate)\n// =============================================================================\n\n/**\n * Get the OCX global config root directory.\n * @returns Path to ~/.config/opencode/\n */\nfunction getGlobalConfigRoot(): string {\n\tconst base = process.env.XDG_CONFIG_HOME || path.join(homedir(), \".config\")\n\treturn path.join(base, \"opencode\")\n}\n\n/**\n * Build targets for config removal.\n * @returns Array of config targets\n */\nfunction buildConfigTargets(): UninstallTarget[] {\n\tconst rootPath = getGlobalConfigRoot()\n\tconst targets: UninstallTarget[] = []\n\n\t// Profiles directory\n\tconst profilesDir = getProfilesDir()\n\tconst profilesRelative = getRelativePathIfContained(rootPath, profilesDir)\n\tif (profilesRelative) {\n\t\tconst kind = getPathKind(profilesDir)\n\t\ttargets.push({\n\t\t\trootPath,\n\t\t\trelativePath: profilesRelative,\n\t\t\tabsolutePath: profilesDir,\n\t\t\tdisplayPath: tildify(profilesDir),\n\t\t\tkind,\n\t\t\tdeleteIfEmpty: false,\n\t\t\tsafetyStatus: classifyTargetSafety({ rootPath, absolutePath: profilesDir, kind }),\n\t\t})\n\t}\n\n\t// ocx.jsonc file\n\tconst globalConfig = getGlobalConfig()\n\tconst configRelative = getRelativePathIfContained(rootPath, globalConfig)\n\tif (configRelative) {\n\t\tconst kind = getPathKind(globalConfig)\n\t\ttargets.push({\n\t\t\trootPath,\n\t\t\trelativePath: configRelative,\n\t\t\tabsolutePath: globalConfig,\n\t\t\tdisplayPath: tildify(globalConfig),\n\t\t\tkind,\n\t\t\tdeleteIfEmpty: false,\n\t\t\tsafetyStatus: classifyTargetSafety({ rootPath, absolutePath: globalConfig, kind }),\n\t\t})\n\t}\n\n\t// Root directory (only delete if empty after other removals)\n\tconst rootKind = getPathKind(rootPath)\n\ttargets.push({\n\t\trootPath,\n\t\trelativePath: \".\",\n\t\tabsolutePath: rootPath,\n\t\tdisplayPath: tildify(rootPath),\n\t\tkind: rootKind,\n\t\tdeleteIfEmpty: true,\n\t\tsafetyStatus: rootKind === \"missing\" ? \"safe\" : \"safe\", // Root is always safe if it exists\n\t})\n\n\treturn targets\n}\n\n/**\n * Build target for binary removal.\n * @returns Binary target or null if package-managed\n */\nfunction buildBinaryTarget(): UninstallTarget | null {\n\tconst method = detectInstallMethod()\n\n\t// Package-managed installs should use their own uninstall\n\tif (isPackageManaged(method)) {\n\t\treturn null\n\t}\n\n\t// For curl installs, get the executable path\n\tif (method === \"curl\") {\n\t\tconst binaryPath = getExecutablePath()\n\t\tconst kind = getPathKind(binaryPath)\n\t\tconst parentDir = path.dirname(binaryPath)\n\n\t\treturn {\n\t\t\trootPath: parentDir,\n\t\t\trelativePath: path.basename(binaryPath),\n\t\t\tabsolutePath: binaryPath,\n\t\t\tdisplayPath: tildify(binaryPath),\n\t\t\tkind,\n\t\t\tdeleteIfEmpty: false,\n\t\t\tsafetyStatus: kind === \"missing\" ? \"safe\" : \"safe\", // Binary path is trusted\n\t\t}\n\t}\n\n\t// Unknown method - can't determine binary location\n\treturn null\n}\n\n// =============================================================================\n// DELETION EXECUTION (Law 3: Atomic Predictability)\n// =============================================================================\n\n/**\n * Execute removal of a single target.\n * @param target - The target to remove\n * @returns Result of the deletion attempt\n */\nfunction executeRemoval(target: UninstallTarget): DeletionResult {\n\t// Early exit: missing targets are already \"deleted\"\n\tif (target.kind === \"missing\") {\n\t\treturn { target, success: true, skipped: true, reason: \"not found\" }\n\t}\n\n\t// Early exit: forbidden targets are skipped with containment violation\n\tif (target.safetyStatus === \"forbidden\") {\n\t\treturn {\n\t\t\ttarget,\n\t\t\tsuccess: false,\n\t\t\tskipped: true,\n\t\t\treason: \"containment violation\",\n\t\t\terror: new Error(\"Target escapes containment boundary\"),\n\t\t}\n\t}\n\n\t// Handle deleteIfEmpty directories\n\tif (target.deleteIfEmpty && target.kind === \"directory\") {\n\t\tif (!isDirectoryEmpty(target.absolutePath)) {\n\t\t\treturn { target, success: true, skipped: true, reason: \"not empty\" }\n\t\t}\n\t}\n\n\ttry {\n\t\tif (target.kind === \"directory\") {\n\t\t\trmSync(target.absolutePath, { recursive: true, force: true })\n\t\t} else {\n\t\t\tunlinkSync(target.absolutePath)\n\t\t}\n\t\treturn { target, success: true, skipped: false }\n\t} catch (err) {\n\t\tconst error = err instanceof Error ? err : new Error(String(err))\n\t\tconst reason =\n\t\t\tisNodeError(err) && (err.code === \"EACCES\" || err.code === \"EPERM\")\n\t\t\t\t? \"permission denied\"\n\t\t\t\t: undefined\n\t\treturn { target, success: false, skipped: false, reason, error }\n\t}\n}\n\n/**\n * Execute removal of all targets.\n * @param targets - Array of targets to remove\n * @returns Array of results\n */\nfunction executeRemovals(targets: UninstallTarget[]): DeletionResult[] {\n\treturn targets.map(executeRemoval)\n}\n\n/**\n * Remove binary file (platform-specific).\n * @param binaryPath - Path to the binary\n * @returns Deletion result\n */\nfunction removeBinary(\n\tbinaryPath: string,\n\toptions: { suppressOutput?: boolean } = {},\n): DeletionResult {\n\tconst target: UninstallTarget = {\n\t\trootPath: path.dirname(binaryPath),\n\t\trelativePath: path.basename(binaryPath),\n\t\tabsolutePath: binaryPath,\n\t\tdisplayPath: tildify(binaryPath),\n\t\tkind: getPathKind(binaryPath),\n\t\tdeleteIfEmpty: false,\n\t\tsafetyStatus: \"safe\",\n\t}\n\n\t// Early exit: missing binary\n\tif (target.kind === \"missing\") {\n\t\treturn { target, success: true, skipped: true, reason: \"not found\" }\n\t}\n\n\t// On Windows, print instructions for v1 (binary may be locked)\n\tif (process.platform === \"win32\") {\n\t\tif (!options.suppressOutput) {\n\t\t\tlogger.info(`To complete uninstall, manually delete: ${target.displayPath}`)\n\t\t}\n\t\treturn { target, success: true, skipped: true }\n\t}\n\n\ttry {\n\t\tunlinkSync(binaryPath)\n\t\treturn { target, success: true, skipped: false }\n\t} catch (error) {\n\t\tconst err = error instanceof Error ? error : new Error(String(error))\n\t\treturn { target, success: false, skipped: false, reason: \"permission denied\", error: err }\n\t}\n}\n\n// =============================================================================\n// OUTPUT HELPERS (Law 5: Intentional Naming)\n// =============================================================================\n\n/**\n * Print what would be removed in dry-run mode.\n * @param configTargets - Config targets\n * @param binaryTarget - Binary target (null if package-managed)\n * @param installMethod - Detected install method\n */\nfunction printDryRun(\n\tconfigTargets: UninstallTarget[],\n\tbinaryTarget: UninstallTarget | null,\n\tinstallMethod: InstallMethod,\n): void {\n\tconst { dryRunResult, hints } = createUninstallDryRunResult(\n\t\tconfigTargets,\n\t\tbinaryTarget,\n\t\tinstallMethod,\n\t)\n\n\toutputDryRun(dryRunResult, { hints })\n}\n\nfunction createUninstallDryRunResult(\n\tconfigTargets: UninstallTarget[],\n\tbinaryTarget: UninstallTarget | null,\n\tinstallMethod: InstallMethod,\n): { dryRunResult: DryRunResult; hints: string[] } {\n\tconst existingConfigTargets = configTargets.filter((t) => t.kind !== \"missing\")\n\tconst actions: DryRunAction[] = []\n\n\t// Add config targets to actions\n\tfor (const target of existingConfigTargets) {\n\t\tactions.push({\n\t\t\taction: \"delete\",\n\t\t\ttarget: target.displayPath,\n\t\t\tdetails: {\n\t\t\t\tkind: target.kind,\n\t\t\t\t...(target.deleteIfEmpty && { deleteIfEmpty: true }),\n\t\t\t},\n\t\t})\n\t}\n\n\t// Add binary target if exists\n\tif (binaryTarget && binaryTarget.kind !== \"missing\") {\n\t\tactions.push({\n\t\t\taction: \"delete\",\n\t\t\ttarget: binaryTarget.displayPath,\n\t\t\tdetails: { kind: \"binary\" },\n\t\t})\n\t}\n\n\tconst hints: string[] = []\n\tif (isPackageManaged(installMethod)) {\n\t\thints.push(\n\t\t\t`Binary is managed by ${installMethod}. Run: ${getPackageManagerCommand(installMethod)}`,\n\t\t)\n\t}\n\n\tconst dryRunResult: DryRunResult = {\n\t\tdryRun: true,\n\t\tcommand: \"self uninstall\",\n\t\twouldPerform: actions,\n\t\tvalidation: { passed: true },\n\t\tsummary: actions.length > 0 ? `Would remove ${actions.length} item(s)` : \"Nothing to remove\",\n\t}\n\n\treturn { dryRunResult, hints }\n}\n\n/**\n * Print the removal plan before execution.\n * @param configTargets - Config targets\n * @param binaryTarget - Binary target\n */\nfunction printRemovalPlan(\n\tconfigTargets: UninstallTarget[],\n\tbinaryTarget: UninstallTarget | null,\n): void {\n\tconst existingConfigTargets = configTargets.filter((t) => t.kind !== \"missing\")\n\n\tif (existingConfigTargets.length > 0 || (binaryTarget && binaryTarget.kind !== \"missing\")) {\n\t\tlogger.info(\"Removing OCX files...\")\n\t}\n}\n\n/**\n * Print results of removal operations.\n * @param results - Deletion results\n * @param binaryResult - Binary deletion result\n * @param installMethod - Install method for package manager message\n */\nfunction printResults(\n\tresults: DeletionResult[],\n\tbinaryResult: DeletionResult | null,\n\tinstallMethod: InstallMethod,\n): void {\n\tlogger.break()\n\n\t// Print config results\n\tfor (const result of results) {\n\t\tif (result.skipped) {\n\t\t\tif (result.reason === \"not found\") {\n\t\t\t\t// Skip silent - already gone\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (result.reason === \"not empty\") {\n\t\t\t\tlogger.info(`Kept ${highlight.path(result.target.displayPath)} (not empty)`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (result.reason === \"permission denied\") {\n\t\t\t\tlogger.warn(`Skipped ${highlight.path(result.target.displayPath)} (permission denied)`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (result.reason === \"containment violation\") {\n\t\t\t\tlogger.warn(`Skipped ${highlight.path(result.target.displayPath)} (containment violation)`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif (result.success) {\n\t\t\tlogger.success(`Removed ${highlight.path(result.target.displayPath)}`)\n\t\t} else {\n\t\t\tlogger.error(`Failed to remove ${result.target.displayPath}: ${result.error?.message}`)\n\t\t}\n\t}\n\n\t// Print binary result\n\tif (binaryResult) {\n\t\tif (binaryResult.skipped && binaryResult.reason === \"not found\") {\n\t\t\t// Skip silent\n\t\t} else if (binaryResult.success && !binaryResult.skipped) {\n\t\t\tlogger.success(`Removed binary ${highlight.path(binaryResult.target.displayPath)}`)\n\t\t} else if (!binaryResult.success) {\n\t\t\tlogger.error(\n\t\t\t\t`Failed to remove binary ${binaryResult.target.displayPath}: ${binaryResult.error?.message}`,\n\t\t\t)\n\t\t}\n\t}\n\n\t// Package manager message\n\tif (isPackageManaged(installMethod)) {\n\t\tlogger.break()\n\t\tlogger.info(`Binary is managed by ${installMethod}. To complete uninstall, run:`)\n\t\tlogger.log(` ${highlight.command(getPackageManagerCommand(installMethod))}`)\n\t}\n}\n\n/**\n * Print message when nothing to remove.\n */\nfunction printNothingToRemove(): void {\n\tlogger.info(\"Nothing to remove. OCX is not installed globally.\")\n}\n\nfunction serializeDeletionResult(result: DeletionResult): Record<string, unknown> {\n\treturn {\n\t\tpath: result.target.displayPath,\n\t\tkind: result.target.kind,\n\t\tsuccess: result.success,\n\t\tskipped: result.skipped,\n\t\t...(result.reason && { reason: result.reason }),\n\t\t...(result.error && { error: result.error.message }),\n\t}\n}\n\nasync function runUninstallJson(options: UninstallOptions): Promise<never> {\n\tconst rootPath = getGlobalConfigRoot()\n\n\tconst rootValidation = validateRootDirectory(rootPath)\n\tif (!rootValidation.valid) {\n\t\tswitch (rootValidation.reason) {\n\t\t\tcase \"not-found\":\n\t\t\t\tbreak\n\t\t\tcase \"symlink\":\n\t\t\t\treturn exitWithJsonFailure(\n\t\t\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\t\t\"Safety error: Global config root is a symlink. Aborting.\",\n\t\t\t\t\tUNINSTALL_EXIT_CODES.SAFETY_ERROR,\n\t\t\t\t)\n\t\t\tcase \"not-directory\":\n\t\t\t\treturn exitWithJsonFailure(\n\t\t\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\t\t\"Safety error: Global config root is not a directory. Aborting.\",\n\t\t\t\t\tUNINSTALL_EXIT_CODES.SAFETY_ERROR,\n\t\t\t\t)\n\t\t\tcase \"permission\":\n\t\t\t\treturn exitWithJsonFailure(\n\t\t\t\t\t\"PERMISSION_ERROR\",\n\t\t\t\t\t\"Error: Cannot access global config root (permission denied).\",\n\t\t\t\t\tUNINSTALL_EXIT_CODES.ERROR,\n\t\t\t\t)\n\t\t}\n\t}\n\n\tconst configTargets = buildConfigTargets()\n\n\tconst forbiddenTargets = configTargets.filter((t) => t.safetyStatus === \"forbidden\")\n\tif (forbiddenTargets.length > 0) {\n\t\treturn exitWithJsonFailure(\n\t\t\t\"VALIDATION_ERROR\",\n\t\t\t\"Safety error: Target escapes containment boundary.\",\n\t\t\tUNINSTALL_EXIT_CODES.SAFETY_ERROR,\n\t\t\t{\n\t\t\t\ttargets: forbiddenTargets.map((target) => target.displayPath),\n\t\t\t},\n\t\t)\n\t}\n\n\tconst errorTargets = configTargets.filter((t) => t.safetyStatus === \"error\")\n\tif (errorTargets.length > 0) {\n\t\treturn exitWithJsonFailure(\n\t\t\t\"PERMISSION_ERROR\",\n\t\t\t\"Error: Cannot verify containment for targets (permission/IO error).\",\n\t\t\tUNINSTALL_EXIT_CODES.ERROR,\n\t\t\t{\n\t\t\t\ttargets: errorTargets.map((target) => target.displayPath),\n\t\t\t},\n\t\t)\n\t}\n\n\tconst installMethod = detectInstallMethod()\n\tconst binaryTarget = buildBinaryTarget()\n\n\tconst existingConfigTargets = configTargets.filter((t) => t.kind !== \"missing\")\n\tconst hasBinary = Boolean(binaryTarget && binaryTarget.kind !== \"missing\")\n\tconst hasPackageManager = isPackageManaged(installMethod)\n\n\tif (existingConfigTargets.length === 0 && !hasBinary && !hasPackageManager) {\n\t\treturn exitWithJsonSuccess(\n\t\t\t{\n\t\t\t\tmessage: \"Nothing to remove. OCX is not installed globally.\",\n\t\t\t\tremoved: [],\n\t\t\t\tskipped: [],\n\t\t\t},\n\t\t\tUNINSTALL_EXIT_CODES.SUCCESS,\n\t\t)\n\t}\n\n\tif (options.dryRun) {\n\t\tconst { dryRunResult, hints } = createUninstallDryRunResult(\n\t\t\tconfigTargets,\n\t\t\tbinaryTarget,\n\t\t\tinstallMethod,\n\t\t)\n\n\t\treturn exitWithJsonSuccess(\n\t\t\t{\n\t\t\t\t...dryRunResult,\n\t\t\t\t...(hints.length > 0 && { hints }),\n\t\t\t},\n\t\t\tUNINSTALL_EXIT_CODES.SUCCESS,\n\t\t)\n\t}\n\n\tconst configResults = executeRemovals(configTargets)\n\n\tlet binaryResult: DeletionResult | null = null\n\tif (binaryTarget) {\n\t\tbinaryResult = removeBinary(binaryTarget.absolutePath, { suppressOutput: true })\n\t}\n\n\tconst hasFailures = configResults.some((r) => !r.success && !r.skipped)\n\tconst binaryFailed = Boolean(binaryResult && !binaryResult.success && !binaryResult.skipped)\n\n\tif (hasFailures || binaryFailed) {\n\t\treturn exitWithJsonFailure(\n\t\t\t\"PERMISSION_ERROR\",\n\t\t\t\"Failed to remove one or more uninstall targets.\",\n\t\t\tUNINSTALL_EXIT_CODES.ERROR,\n\t\t\t{\n\t\t\t\tconfigResults: configResults.map(serializeDeletionResult),\n\t\t\t\t...(binaryResult && { binaryResult: serializeDeletionResult(binaryResult) }),\n\t\t\t},\n\t\t)\n\t}\n\n\tif (isPackageManaged(installMethod)) {\n\t\treturn exitWithJsonFailure(\n\t\t\t\"UPDATE_ERROR\",\n\t\t\t`Binary is managed by ${installMethod}. Run: ${getPackageManagerCommand(installMethod)}`,\n\t\t\tUNINSTALL_EXIT_CODES.ERROR,\n\t\t\t{\n\t\t\t\tinstallMethod,\n\t\t\t\tcommand: getPackageManagerCommand(installMethod),\n\t\t\t\tconfigResults: configResults.map(serializeDeletionResult),\n\t\t\t\t...(binaryResult && { binaryResult: serializeDeletionResult(binaryResult) }),\n\t\t\t},\n\t\t)\n\t}\n\n\tconst removed = configResults\n\t\t.filter((result) => result.success && !result.skipped)\n\t\t.map((result) => result.target.displayPath)\n\tconst skipped = configResults\n\t\t.filter((result) => result.skipped)\n\t\t.map((result) => ({\n\t\t\tpath: result.target.displayPath,\n\t\t\treason: result.reason ?? \"skipped\",\n\t\t}))\n\n\tif (binaryResult) {\n\t\tif (binaryResult.success && !binaryResult.skipped) {\n\t\t\tremoved.push(binaryResult.target.displayPath)\n\t\t} else if (binaryResult.skipped) {\n\t\t\tskipped.push({\n\t\t\t\tpath: binaryResult.target.displayPath,\n\t\t\t\treason: binaryResult.reason ?? \"skipped\",\n\t\t\t})\n\t\t}\n\t}\n\n\treturn exitWithJsonSuccess(\n\t\t{\n\t\t\tremoved,\n\t\t\tskipped,\n\t\t\tinstallMethod,\n\t\t},\n\t\tUNINSTALL_EXIT_CODES.SUCCESS,\n\t)\n}\n\n// =============================================================================\n// MAIN LOGIC (Law 1: Early Exit for all edge cases at top)\n// =============================================================================\n\n/**\n * Run the uninstall command.\n * @param options - Command options\n */\nexport async function runUninstall(options: UninstallOptions): Promise<void> {\n\tif (options.json) {\n\t\tawait runUninstallJson(options)\n\t\treturn\n\t}\n\n\tconst rootPath = getGlobalConfigRoot()\n\n\t// 1. Validate root directory\n\tconst rootValidation = validateRootDirectory(rootPath)\n\tif (!rootValidation.valid) {\n\t\tswitch (rootValidation.reason) {\n\t\t\tcase \"not-found\":\n\t\t\t\t// Non-existent root is valid - nothing to delete, check binary\n\t\t\t\tbreak\n\t\t\tcase \"symlink\":\n\t\t\t\tlogger.error(\"Safety error: Global config root is a symlink. Aborting.\")\n\t\t\t\tprocess.exit(UNINSTALL_EXIT_CODES.SAFETY_ERROR)\n\t\t\t\tbreak\n\t\t\tcase \"not-directory\":\n\t\t\t\tlogger.error(\"Safety error: Global config root is not a directory. Aborting.\")\n\t\t\t\tprocess.exit(UNINSTALL_EXIT_CODES.SAFETY_ERROR)\n\t\t\t\tbreak\n\t\t\tcase \"permission\":\n\t\t\t\tlogger.error(\"Error: Cannot access global config root (permission denied).\")\n\t\t\t\tprocess.exit(UNINSTALL_EXIT_CODES.ERROR)\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\t// 2. Build config targets\n\tconst configTargets = buildConfigTargets()\n\n\t// 3. Check for containment violations and operational errors (Law 4: Fail Fast)\n\tconst forbiddenTargets = configTargets.filter((t) => t.safetyStatus === \"forbidden\")\n\tif (forbiddenTargets.length > 0) {\n\t\tlogger.error(\"Safety error: Target escapes containment boundary:\")\n\t\tfor (const target of forbiddenTargets) {\n\t\t\tlogger.error(` ${target.displayPath}`)\n\t\t}\n\t\tprocess.exit(UNINSTALL_EXIT_CODES.SAFETY_ERROR)\n\t}\n\n\tconst errorTargets = configTargets.filter((t) => t.safetyStatus === \"error\")\n\tif (errorTargets.length > 0) {\n\t\tlogger.error(\"Error: Cannot verify containment for targets (permission/IO error):\")\n\t\tfor (const target of errorTargets) {\n\t\t\tlogger.error(` ${target.displayPath}`)\n\t\t}\n\t\tprocess.exit(UNINSTALL_EXIT_CODES.ERROR)\n\t}\n\n\t// 4. Detect install method, build binary target\n\tconst installMethod = detectInstallMethod()\n\tconst binaryTarget = buildBinaryTarget()\n\n\t// 5. Check if nothing to remove\n\tconst existingConfigTargets = configTargets.filter((t) => t.kind !== \"missing\")\n\tconst hasBinary = binaryTarget && binaryTarget.kind !== \"missing\"\n\tconst hasPackageManager = isPackageManaged(installMethod)\n\n\tif (existingConfigTargets.length === 0 && !hasBinary && !hasPackageManager) {\n\t\tprintNothingToRemove()\n\t\tprocess.exit(UNINSTALL_EXIT_CODES.SUCCESS)\n\t}\n\n\t// 6. Dry-run mode: show what would be removed\n\tif (options.dryRun) {\n\t\tprintDryRun(configTargets, binaryTarget, installMethod)\n\t\tprocess.exit(UNINSTALL_EXIT_CODES.SUCCESS)\n\t}\n\n\t// 7. Print removal plan\n\tprintRemovalPlan(configTargets, binaryTarget)\n\n\t// 8. Execute config removals (order matters: children before parents)\n\tconst configResults = executeRemovals(configTargets)\n\n\t// 9. Execute binary removal OR print package manager command\n\tlet binaryResult: DeletionResult | null = null\n\tif (binaryTarget) {\n\t\tbinaryResult = removeBinary(binaryTarget.absolutePath)\n\t}\n\n\t// 10. Print results\n\tprintResults(configResults, binaryResult, installMethod)\n\n\t// 11. Determine exit code\n\tconst hasFailures = configResults.some((r) => !r.success && !r.skipped)\n\tconst binaryFailed = binaryResult && !binaryResult.success && !binaryResult.skipped\n\n\tif (hasFailures || binaryFailed) {\n\t\tprocess.exit(UNINSTALL_EXIT_CODES.ERROR)\n\t}\n\n\t// Package-managed installs exit with 1 to indicate manual step needed\n\tif (isPackageManaged(installMethod)) {\n\t\tprocess.exit(UNINSTALL_EXIT_CODES.ERROR)\n\t}\n\n\tprocess.exit(UNINSTALL_EXIT_CODES.SUCCESS)\n}\n\n// =============================================================================\n// COMMAND REGISTRATION\n// =============================================================================\n\n/**\n * Register the self uninstall command.\n * @param parent - Parent command (self)\n */\nexport function registerSelfUninstallCommand(parent: Command): void {\n\tparent\n\t\t.command(\"uninstall\")\n\t\t.description(\"Remove OCX global configuration and binary\")\n\t\t.option(\"--dry-run\", \"Preview what would be removed\")\n\t\t.option(\"--json\", \"Output as JSON\")\n\t\t.action(async (options: UninstallOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runUninstall(options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n",
124
- "/**\n * Installation Method Detection\n *\n * Detects how OCX was installed to determine the appropriate update mechanism.\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Check compiled binary first (most common case)\n * - Parse Don't Validate: Returns typed InstallMethod union\n * - Atomic Predictability: Pure functions based only on process state\n * - Fail Fast: N/A (always returns a valid method)\n * - Intentional Naming: Self-documenting function names\n */\n\nimport { SelfUpdateError } from \"../utils/errors\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/**\n * Possible installation methods for OCX.\n * - \"curl\": Standalone compiled binary (installed via curl script)\n * - \"npm\": Installed globally via `npm install -g`\n * - \"yarn\": Installed globally via `yarn global add`\n * - \"pnpm\": Installed globally via `pnpm add -g`\n * - \"bun\": Installed globally via `bun add -g`\n * - \"unknown\": Unable to determine installation method\n */\nexport type InstallMethod = \"curl\" | \"npm\" | \"yarn\" | \"pnpm\" | \"bun\" | \"unknown\"\n\n// =============================================================================\n// PARSING (Law 2: Parse, Don't Validate)\n// =============================================================================\n\n/**\n * Parse and validate an install method string.\n * @param input - The method string to parse\n * @returns A valid InstallMethod\n * @throws SelfUpdateError if input is invalid\n */\nexport function parseInstallMethod(input: string): InstallMethod {\n\tconst VALID_METHODS = [\"curl\", \"npm\", \"yarn\", \"pnpm\", \"bun\"] as const\n\tconst method = VALID_METHODS.find((m) => m === input)\n\tif (!method) {\n\t\tthrow new SelfUpdateError(\n\t\t\t`Invalid install method: \"${input}\"\\nValid methods: ${VALID_METHODS.join(\", \")}`,\n\t\t)\n\t}\n\treturn method\n}\n\n// =============================================================================\n// DETECTION PREDICATES (Law 5: Intentional Naming)\n// Most specific patterns first to avoid false positives\n// =============================================================================\n\n/** Check if running as compiled binary (Bun single-file executable) */\nconst isCompiledBinary = () => Bun.main.startsWith(\"/$bunfs/\")\n\n/** Check if running via npx/bunx/pnpx temp execution (not a persistent install) */\nconst isTempExecution = (path: string) =>\n\tpath.includes(\"/_npx/\") || path.includes(\"/.cache/bunx/\") || path.includes(\"/.pnpm/_temp/\")\n\n/** Check if installed via Yarn global */\nconst isYarnGlobalInstall = (path: string) =>\n\tpath.includes(\"/.yarn/global\") || path.includes(\"/.config/yarn/global\")\n\n/** Check if installed via pnpm global */\nconst isPnpmGlobalInstall = (path: string) =>\n\tpath.includes(\"/.pnpm/\") || path.includes(\"/pnpm/global\")\n\n/** Check if installed via Bun global */\nconst isBunGlobalInstall = (path: string) =>\n\tpath.includes(\"/.bun/bin\") || path.includes(\"/.bun/install/global\")\n\n/** Check if installed via npm global (generic node_modules - least specific) */\nconst isNpmGlobalInstall = (path: string) =>\n\tpath.includes(\"/.npm/\") || path.includes(\"/node_modules/\")\n\n// =============================================================================\n// INSTALLATION DETECTION\n// =============================================================================\n\n/**\n * Detect how OCX was installed by analyzing paths.\n * Uses O(1) path analysis instead of slow shell commands.\n *\n * Detection priority (MOST SPECIFIC FIRST):\n * 1. Compiled binary: Bun.main starts with `/$bunfs/` (bun's virtual filesystem)\n * 2. Temp execution: npx/bunx/pnpx temp paths (not a persistent install)\n * 3. Yarn global: `/.yarn/global` or `/.config/yarn/global` paths\n * 4. pnpm global: `/.pnpm/` or `/pnpm/global` paths\n * 5. Bun global: `/.bun/bin` or `/.bun/install/global` paths\n * 6. npm global: Generic `/node_modules/` (least specific, checked last)\n * 7. npm_config_user_agent: Fallback for package manager invocations\n * 8. Default: \"unknown\" if no patterns match\n *\n * @returns The detected installation method\n */\nexport function detectInstallMethod(): InstallMethod {\n\t// Compiled binary detection (curl install)\n\tif (isCompiledBinary()) {\n\t\treturn \"curl\"\n\t}\n\n\tconst scriptPath = process.argv[1] ?? \"\"\n\n\t// Package manager detection - MOST SPECIFIC FIRST\n\t// Temp execution paths (npx/bunx/pnpx) - not a persistent install\n\tif (isTempExecution(scriptPath)) return \"unknown\"\n\n\t// Yarn global - must check before generic node_modules\n\tif (isYarnGlobalInstall(scriptPath)) return \"yarn\"\n\n\t// pnpm global - specific pnpm paths\n\tif (isPnpmGlobalInstall(scriptPath)) return \"pnpm\"\n\n\t// Bun global - specific bun paths\n\tif (isBunGlobalInstall(scriptPath)) return \"bun\"\n\n\t// npm global - generic node_modules (LEAST SPECIFIC, checked last)\n\tif (isNpmGlobalInstall(scriptPath)) return \"npm\"\n\n\t// Fallback: check npm_config_user_agent\n\tconst userAgent = process.env.npm_config_user_agent ?? \"\"\n\tif (userAgent.includes(\"yarn\")) return \"yarn\"\n\tif (userAgent.includes(\"pnpm\")) return \"pnpm\"\n\tif (userAgent.includes(\"bun\")) return \"bun\"\n\tif (userAgent.includes(\"npm\")) return \"npm\"\n\n\t// Unknown - will show helpful message to user\n\treturn \"unknown\"\n}\n\n// =============================================================================\n// EXECUTABLE PATH UTILITIES\n// =============================================================================\n\n/**\n * Get the path to the current OCX executable.\n *\n * For compiled binaries, returns `process.execPath` (the binary itself).\n * For npm/bun installs, returns `process.argv[1]` (the script path).\n *\n * @returns Absolute path to the OCX executable or script\n */\nexport function getExecutablePath(): string {\n\t// For compiled binaries, use process.execPath\n\t// For npm/bun, process.execPath returns the node/bun binary, not ocx\n\tif (typeof Bun !== \"undefined\" && Bun.main.startsWith(\"/$bunfs/\")) {\n\t\treturn process.execPath\n\t}\n\n\t// Script path for non-compiled (npm/bun global installs)\n\treturn process.argv[1] ?? process.execPath\n}\n",
125
- "/**\n * Check for available updates to the OCX CLI.\n * Returns a discriminated union: { ok: true, ... } for success,\n * { ok: false, reason: '...' } for failure with typed reason.\n *\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Return failure reason immediately on error\n * - Parse Don't Validate: Use typed CheckResult discriminated union\n * - Atomic Predictability: Pure comparison logic\n * - Fail Fast: Abort on timeout, don't block UX\n * - Intentional Naming: Self-documenting function names\n */\n\nimport { NetworkError } from \"../utils/errors\"\nimport { fetchPackageVersion } from \"../utils/npm-registry\"\nimport type { VersionProvider } from \"./types\"\nimport { defaultVersionProvider } from \"./version-provider\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/**\n * Result of checking for available updates.\n * Contains current version, latest version, and whether an update is available.\n */\nexport interface VersionCheckResult {\n\tcurrent: string\n\tlatest: string\n\tupdateAvailable: boolean\n}\n\n/**\n * Result of checking for available updates.\n * Discriminated union: ok=true for success, ok=false with reason for failure.\n */\nexport type CheckResult =\n\t| { ok: true; current: string; latest: string; updateAvailable: boolean }\n\t| { ok: false; reason: \"dev-version\" | \"timeout\" | \"network-error\" | \"invalid-response\" }\n\n/** Extract failure type for error message mapping */\nexport type CheckFailure = Extract<CheckResult, { ok: false }>\n\n// Re-export for convenience\nexport type { VersionProvider } from \"./types\"\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\n/** Timeout for version check - non-blocking UX is priority */\nconst VERSION_CHECK_TIMEOUT_MS = 200\n\n/** Timeout for explicit update commands (user is willing to wait) */\nexport const EXPLICIT_UPDATE_TIMEOUT_MS = 10_000\n\n/** Package name on npm registry */\nconst PACKAGE_NAME = \"ocx\"\n\n// =============================================================================\n// VERSION UTILITIES\n// =============================================================================\n\n/**\n * Parse a semver string into components.\n * Returns null if invalid.\n *\n * @param v - Version string (e.g., \"1.2.3\" or \"1.2.3-beta.1\")\n * @returns Parsed version or null if invalid\n */\nfunction parseVersion(v: string): { major: number; minor: number; patch: number } | null {\n\tconst [main = \"\"] = v.split(\"-\") // Ignore prerelease for comparison\n\tconst parts = main.split(\".\")\n\tconst major = parseInt(parts[0] ?? \"\", 10)\n\tconst minor = parseInt(parts[1] ?? \"\", 10)\n\tconst patch = parseInt(parts[2] ?? \"\", 10)\n\n\t// Early exit: invalid version components\n\tif (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) {\n\t\treturn null\n\t}\n\n\treturn { major, minor, patch }\n}\n\n/**\n * Compare two semver versions.\n * Returns null if either version is invalid (cannot compare).\n *\n * @param a - First version string (e.g., \"1.2.3\")\n * @param b - Second version string (e.g., \"1.0.0\")\n * @returns Negative if a < b, 0 if equal, positive if a > b, null if invalid\n */\nfunction compareSemver(a: string, b: string): number | null {\n\tconst vA = parseVersion(a)\n\tconst vB = parseVersion(b)\n\n\t// Early exit: can't compare invalid versions\n\tif (!vA || !vB) {\n\t\treturn null\n\t}\n\n\tif (vA.major !== vB.major) return vA.major - vB.major\n\tif (vA.minor !== vB.minor) return vA.minor - vB.minor\n\treturn vA.patch - vB.patch\n}\n\n// =============================================================================\n// VERSION CHECK\n// =============================================================================\n\n/**\n * Check if a newer version of OCX is available.\n *\n * Uses npm registry with configurable timeout for different contexts:\n * - Background checks: 200ms (non-blocking UX priority)\n * - Explicit update command: 10s (user is willing to wait)\n *\n * Returns discriminated union: ok=true for success, ok=false with reason for failure.\n *\n * @param versionProvider - Optional version provider for dependency injection (testing)\n * @param timeoutMs - Timeout in milliseconds (default: 200ms for background checks)\n * @returns CheckResult with success data or failure reason\n */\nexport async function checkForUpdate(\n\tversionProvider?: VersionProvider,\n\ttimeoutMs: number = VERSION_CHECK_TIMEOUT_MS,\n): Promise<CheckResult> {\n\tconst provider = versionProvider ?? defaultVersionProvider\n\tconst current = provider.version || \"0.0.0-dev\"\n\n\t// Early exit: dev version, don't check\n\tif (current === \"0.0.0-dev\") {\n\t\treturn { ok: false, reason: \"dev-version\" }\n\t}\n\n\ttry {\n\t\t// Fetch with timeout signal - aborts the actual HTTP request on timeout\n\t\tconst result = await fetchPackageVersion(\n\t\t\tPACKAGE_NAME,\n\t\t\tundefined,\n\t\t\tAbortSignal.timeout(timeoutMs),\n\t\t)\n\n\t\tconst latest = result.version\n\n\t\t// Compare versions\n\t\tconst comparison = compareSemver(latest, current)\n\n\t\t// Early exit: can't compare (invalid versions)\n\t\tif (comparison === null) {\n\t\t\treturn { ok: false, reason: \"invalid-response\" }\n\t\t}\n\n\t\treturn {\n\t\t\tok: true,\n\t\t\tcurrent,\n\t\t\tlatest,\n\t\t\tupdateAvailable: comparison > 0,\n\t\t}\n\t} catch (error) {\n\t\t// Categorize the failure reason for caller to handle appropriately\n\t\tif (error instanceof Error) {\n\t\t\t// Timeout/AbortError - request was aborted\n\t\t\tif (error.name === \"AbortError\" || error.name === \"TimeoutError\") {\n\t\t\t\treturn { ok: false, reason: \"timeout\" }\n\t\t\t}\n\n\t\t\t// Network-level failures\n\t\t\tif (error instanceof NetworkError || error.name === \"NetworkError\") {\n\t\t\t\treturn { ok: false, reason: \"network-error\" }\n\t\t\t}\n\t\t}\n\n\t\t// Parse errors or unexpected response shapes\n\t\treturn { ok: false, reason: \"invalid-response\" }\n\t}\n}\n",
126
- "/**\n * Build-Time Version Provider\n *\n * Provides version from build-time constant for production use.\n * @module\n */\n\nimport type { VersionProvider } from \"./types\"\n\n// =============================================================================\n// BUILD-TIME VERSION\n// =============================================================================\n\n/** Version injected at build time by bundler */\ndeclare const __VERSION__: string | undefined\n\n/**\n * Provides version from build-time constant.\n * Falls back to empty string if not defined (development mode).\n */\nexport class BuildTimeVersionProvider implements VersionProvider {\n\treadonly version = typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"\"\n}\n\n/** Default version provider instance for production use */\nexport const defaultVersionProvider = new BuildTimeVersionProvider()\n",
127
- "/**\n * Self-Update Binary Download\n *\n * Downloads and replaces the OCX binary with atomic swap and rollback.\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Guard clauses for unsupported platforms\n * - Parse Don't Validate: Platform resolved to typed download URL\n * - Atomic Predictability: Temp file -> backup -> swap pattern\n * - Fail Fast: Throw SelfUpdateError on any failure\n * - Intentional Naming: downloadWithProgress, downloadAndReplace\n */\n\nimport { chmodSync, existsSync, renameSync, unlinkSync } from \"node:fs\"\nimport { SelfUpdateError } from \"../utils/errors\"\nimport { createSpinner } from \"../utils/spinner\"\nimport { getExecutablePath } from \"./detect-method\"\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\n/** GitHub repository for OCX releases */\nconst GITHUB_REPO = \"kdcokenny/ocx\"\n\n/** Default base URL for downloading OCX releases from GitHub */\nconst DEFAULT_DOWNLOAD_BASE_URL = `https://github.com/${GITHUB_REPO}/releases/download`\n\n/**\n * Platform map matching build-binary.ts targets.\n * Maps `${process.arch}-${process.platform}` to binary filename.\n *\n * Note: Baseline and musl variants are not auto-detected.\n * Users on those platforms should use the curl installer with explicit target.\n */\nconst PLATFORM_MAP: Record<string, string> = {\n\t// macOS\n\t\"arm64-darwin\": \"ocx-darwin-arm64\",\n\t\"x64-darwin\": \"ocx-darwin-x64\",\n\t// Linux (glibc - standard)\n\t\"arm64-linux\": \"ocx-linux-arm64\",\n\t\"x64-linux\": \"ocx-linux-x64\",\n\t// Windows\n\t\"x64-win32\": \"ocx-windows-x64.exe\",\n} as const\n\n// =============================================================================\n// URL GENERATION\n// =============================================================================\n\n/**\n * Get the base URL for downloading OCX releases.\n * Supports OCX_DOWNLOAD_URL for enterprise/air-gapped environments.\n *\n * @returns Base URL for release downloads (without trailing slash)\n */\nexport function getDownloadBaseUrl(): string {\n\tconst envUrl = process.env.OCX_DOWNLOAD_URL\n\n\tif (envUrl) {\n\t\t// Normalize: remove trailing slash(es)\n\t\treturn envUrl.replace(/\\/+$/, \"\")\n\t}\n\n\treturn DEFAULT_DOWNLOAD_BASE_URL\n}\n\n/**\n * Get download URL for a specific version.\n *\n * @param version - Version to download (without 'v' prefix)\n * @returns Release download URL (from GitHub or OCX_DOWNLOAD_URL override)\n * @throws SelfUpdateError if platform is unsupported\n */\nexport function getDownloadUrl(version: string): string {\n\tconst platform = `${process.arch}-${process.platform}`\n\tconst target = PLATFORM_MAP[platform]\n\n\t// Early exit: unsupported platform\n\tif (!target) {\n\t\tconst supported = Object.keys(PLATFORM_MAP).join(\", \")\n\t\tthrow new SelfUpdateError(\n\t\t\t`Unsupported platform: ${platform}\\n` + `Supported platforms: ${supported}`,\n\t\t)\n\t}\n\n\tconst baseUrl = getDownloadBaseUrl()\n\treturn `${baseUrl}/v${version}/${target}`\n}\n\n// =============================================================================\n// DOWNLOAD\n// =============================================================================\n\n/**\n * Download binary with progress indicator.\n *\n * @param url - URL to download from\n * @param dest - Destination path for the downloaded file\n * @param options - Download output options\n * @throws SelfUpdateError if download fails\n */\nasync function downloadWithProgress(\n\turl: string,\n\tdest: string,\n\toptions: { quiet?: boolean } = {},\n): Promise<void> {\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Downloading update...\" })\n\tspin?.start()\n\n\tlet response: Response\n\ttry {\n\t\tresponse = await fetch(url, { redirect: \"follow\" })\n\t} catch (error) {\n\t\tspin?.fail(\"Download failed\")\n\t\tthrow new SelfUpdateError(\n\t\t\t`Network error: ${error instanceof Error ? error.message : String(error)}`,\n\t\t)\n\t}\n\n\t// Early exit: HTTP error\n\tif (!response.ok) {\n\t\tspin?.fail(\"Download failed\")\n\t\tthrow new SelfUpdateError(`Failed to download: HTTP ${response.status} ${response.statusText}`)\n\t}\n\n\t// Early exit: no response body\n\tif (!response.body) {\n\t\tspin?.fail(\"Download failed\")\n\t\tthrow new SelfUpdateError(\"Download failed: Empty response body\")\n\t}\n\n\tconst reader = response.body.getReader()\n\tconst writer = Bun.file(dest).writer()\n\tconst total = Number(response.headers.get(\"content-length\") || 0)\n\tlet received = 0\n\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read()\n\t\t\tif (done) break\n\t\t\tawait writer.write(value)\n\t\t\treceived += value.length\n\n\t\t\t// Update progress if we know total size\n\t\t\tif (total > 0 && spin) {\n\t\t\t\tconst pct = Math.round((received / total) * 100)\n\t\t\t\tspin.text = `Downloading... ${pct}%`\n\t\t\t}\n\t\t}\n\t\tawait writer.end()\n\t\tspin?.succeed(\"Download complete\")\n\t} catch (error) {\n\t\tspin?.fail(\"Download failed\")\n\t\tawait writer.end()\n\t\tthrow new SelfUpdateError(\n\t\t\t`Download interrupted: ${error instanceof Error ? error.message : String(error)}`,\n\t\t)\n\t}\n}\n\n// =============================================================================\n// ATOMIC REPLACEMENT\n// =============================================================================\n\n/**\n * Result of downloading binary to temp location.\n * Contains paths needed for verification and atomic swap.\n */\nexport interface DownloadResult {\n\t/** Path to the downloaded temp file */\n\ttempPath: string\n\t/** Path to current executable (swap target) */\n\texecPath: string\n}\n\n/**\n * Download binary to a temp file for verification before replacement.\n *\n * Strategy:\n * 1. Download to temp file (execPath.new.{timestamp})\n * 2. Set executable permissions\n * 3. Return paths for caller to verify before swap\n *\n * @param version - Version to download (without 'v' prefix)\n * @param options - Download output options\n * @returns Paths for temp file and executable\n * @throws SelfUpdateError if download fails\n */\nexport async function downloadToTemp(\n\tversion: string,\n\toptions: { quiet?: boolean } = {},\n): Promise<DownloadResult> {\n\tconst execPath = getExecutablePath()\n\tconst tempPath = `${execPath}.new.${Date.now()}`\n\n\tconst url = getDownloadUrl(version)\n\n\t// 1. Download to temp file\n\tawait downloadWithProgress(url, tempPath, options)\n\n\t// 2. Set executable permissions (rwxr-xr-x)\n\ttry {\n\t\tchmodSync(tempPath, 0o755)\n\t} catch (error) {\n\t\t// Clean up temp file\n\t\tif (existsSync(tempPath)) {\n\t\t\tunlinkSync(tempPath)\n\t\t}\n\t\tthrow new SelfUpdateError(\n\t\t\t`Failed to set permissions: ${error instanceof Error ? error.message : String(error)}`,\n\t\t)\n\t}\n\n\treturn { tempPath, execPath }\n}\n\n/**\n * Atomically replace the current binary with a verified temp file.\n *\n * Strategy:\n * 1. Backup current binary (execPath.backup)\n * 2. Atomic rename temp -> execPath\n * 3. Remove backup on success\n * 4. Rollback from backup on failure\n *\n * SECURITY: Only call this AFTER verifying the temp file's checksum.\n *\n * @param tempPath - Path to the verified temp binary\n * @param execPath - Path to the current executable\n * @throws SelfUpdateError if replacement fails\n */\nexport function atomicReplace(tempPath: string, execPath: string): void {\n\tconst backupPath = `${execPath}.backup`\n\n\ttry {\n\t\t// Backup existing binary\n\t\tif (existsSync(execPath)) {\n\t\t\trenameSync(execPath, backupPath)\n\t\t}\n\n\t\t// Move new binary into place\n\t\trenameSync(tempPath, execPath)\n\n\t\t// Success - remove backup\n\t\tif (existsSync(backupPath)) {\n\t\t\tunlinkSync(backupPath)\n\t\t}\n\t} catch (error) {\n\t\t// Rollback: restore backup if it exists and execPath is missing\n\t\tif (existsSync(backupPath) && !existsSync(execPath)) {\n\t\t\ttry {\n\t\t\t\trenameSync(backupPath, execPath)\n\t\t\t} catch {\n\t\t\t\t// Rollback failed - leave backup in place for manual recovery\n\t\t\t}\n\t\t}\n\n\t\t// Clean up temp file if it still exists\n\t\tif (existsSync(tempPath)) {\n\t\t\ttry {\n\t\t\t\tunlinkSync(tempPath)\n\t\t\t} catch {\n\t\t\t\t// Ignore cleanup errors\n\t\t\t}\n\t\t}\n\n\t\tthrow new SelfUpdateError(\n\t\t\t`Update failed: ${error instanceof Error ? error.message : String(error)}`,\n\t\t)\n\t}\n}\n\n/**\n * Clean up a temp file after verification failure.\n *\n * @param tempPath - Path to the temp file to remove\n */\nexport function cleanupTempFile(tempPath: string): void {\n\tif (existsSync(tempPath)) {\n\t\ttry {\n\t\t\tunlinkSync(tempPath)\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t}\n}\n",
128
- "// Copyright 2024-2026 the OCX authors. MIT license.\n\n/**\n * Self-update notification display for terminal output.\n *\n * Provides Rustup-style update notifications with terminal-aware formatting.\n * Follows the 5 Laws of Elegant Defense:\n *\n * - **Early Exit**: TTY check before output\n * - **Intentional Naming**: {@linkcode notifyUpdate}, {@linkcode notifyUpdated}, {@linkcode notifyUpToDate}\n *\n * @example\n * ```ts\n * import { notifyUpdate } from \"./notify\"\n *\n * notifyUpdate(\"1.0.0\", \"1.1.0\")\n * // Prints: \"info: update available - 1.1.0 (current: 1.0.0)\"\n * ```\n *\n * @module\n */\n\nimport kleur from \"kleur\"\n\n/**\n * Display update notification in Rustup style.\n * Only displays if stdout is a TTY.\n *\n * Output format:\n * info: update available - 1.3.0 (current: 1.2.2)\n * run `ocx self update` to upgrade\n */\nexport function notifyUpdate(current: string, latest: string): void {\n\tif (!process.stdout.isTTY) return\n\n\tconsole.error(\n\t\t`${kleur.cyan(\"info\")}: update available - ${kleur.green(latest)} (current: ${kleur.dim(current)})`,\n\t)\n\tconsole.error(` run ${kleur.cyan(\"`ocx self update`\")} to upgrade`)\n}\n\n/**\n * Display \"already up to date\" message.\n *\n * Output format:\n * info: ocx unchanged - 1.2.2\n */\nexport function notifyUpToDate(version: string): void {\n\tconsole.error(`${kleur.cyan(\"info\")}: ocx unchanged - ${kleur.dim(version)}`)\n}\n\n/**\n * Display successful update message.\n *\n * Output format:\n * ocx updated - 1.3.0 (from 1.2.2)\n */\nexport function notifyUpdated(from: string, to: string): void {\n\tconsole.error(` ${kleur.green(\"ocx updated\")} - ${to} (from ${from})`)\n}\n",
129
- "/**\n * SHA256 verification for self-update downloads.\n *\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Guard clauses in parseSha256Sums for empty/invalid lines\n * - Parse Don't Validate: Checksums parsed into Map at boundary\n * - Atomic Predictability: Pure hash functions with no side effects\n * - Fail Fast: IntegrityError thrown immediately on mismatch\n * - Intentional Naming: parseSha256Sums, hashContent, verifyChecksum\n */\n\nimport { createHash } from \"node:crypto\"\nimport { IntegrityError, SelfUpdateError } from \"../utils/errors\"\n\nconst GITHUB_REPO = \"kdcokenny/ocx\"\n\n// =============================================================================\n// CHECKSUM PARSING\n// =============================================================================\n\n/**\n * Parse SHA256SUMS.txt content into a Map.\n * Supports GNU format: \"<hash> <filename>\" (two spaces)\n * Supports BSD format: \"<hash> *<filename>\" (asterisk prefix)\n *\n * @param content - Raw content of SHA256SUMS.txt\n * @returns Map of filename to lowercase hash\n */\nexport function parseSha256Sums(content: string): Map<string, string> {\n\tconst checksums = new Map<string, string>()\n\tfor (const line of content.split(\"\\n\")) {\n\t\tconst match = line.match(/^([a-fA-F0-9]{64})\\s+\\*?(.+)$/)\n\t\tif (match?.[1] && match[2]) {\n\t\t\tchecksums.set(match[2].trim(), match[1].toLowerCase())\n\t\t}\n\t}\n\treturn checksums\n}\n\n// =============================================================================\n// HASHING\n// =============================================================================\n\n/**\n * Hash content using SHA256.\n *\n * @param content - Buffer or string to hash\n * @returns Lowercase hex-encoded SHA256 hash\n */\nexport function hashContent(content: Buffer | string): string {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\")\n}\n\n// =============================================================================\n// CHECKSUM FETCHING\n// =============================================================================\n\n/**\n * Download and parse SHA256SUMS.txt for a version.\n *\n * @param version - Version string (without 'v' prefix)\n * @returns Map of filename to expected hash\n * @throws SelfUpdateError if checksums cannot be fetched\n */\nexport async function fetchChecksums(version: string): Promise<Map<string, string>> {\n\tconst url = `https://github.com/${GITHUB_REPO}/releases/download/v${version}/SHA256SUMS.txt`\n\tconst response = await fetch(url)\n\tif (!response.ok) {\n\t\tthrow new SelfUpdateError(`Failed to fetch checksums: ${response.status}`)\n\t}\n\tconst content = await response.text()\n\treturn parseSha256Sums(content)\n}\n\n// =============================================================================\n// VERIFICATION\n// =============================================================================\n\n/**\n * Verify a downloaded file against expected checksum.\n *\n * @param filePath - Path to file to verify\n * @param expectedHash - Expected SHA256 hash (lowercase hex)\n * @param filename - Display name for error messages\n * @throws IntegrityError if checksum does not match\n */\nexport async function verifyChecksum(\n\tfilePath: string,\n\texpectedHash: string,\n\tfilename: string,\n): Promise<void> {\n\tconst file = Bun.file(filePath)\n\tconst content = await file.arrayBuffer()\n\tconst actualHash = hashContent(Buffer.from(content))\n\n\tif (actualHash !== expectedHash) {\n\t\tthrow new IntegrityError(filename, expectedHash, actualHash)\n\t}\n}\n",
130
- "/**\n * Self Update Command\n *\n * Updates OCX to the latest version using the appropriate method:\n * - curl: Download binary directly and replace\n * - npm: Run `npm install -g ocx@version`\n * - pnpm: Run `pnpm install -g ocx@version`\n * - bun: Run `bun install -g ocx@version`\n *\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Return early if already up to date (unless --force)\n * - Parse Don't Validate: Version check returns typed VersionCheckResult\n * - Atomic Predictability: Each install method is a focused switch case\n * - Fail Fast: Throw SelfUpdateError on any failure\n * - Intentional Naming: updateCommand, notifyUpdated, detectInstallMethod\n */\n\nimport type { Command } from \"commander\"\nimport {\n\ttype CheckFailure,\n\tcheckForUpdate,\n\tEXPLICIT_UPDATE_TIMEOUT_MS,\n} from \"../../self-update/check\"\nimport {\n\tdetectInstallMethod,\n\ttype InstallMethod,\n\tparseInstallMethod,\n} from \"../../self-update/detect-method\"\nimport {\n\tatomicReplace,\n\tcleanupTempFile,\n\tdownloadToTemp,\n\tgetDownloadUrl,\n} from \"../../self-update/download\"\nimport { notifyUpdated, notifyUpToDate } from \"../../self-update/notify\"\nimport { fetchChecksums, verifyChecksum } from \"../../self-update/verify\"\nimport { SelfUpdateError } from \"../../utils/errors\"\nimport { handleError } from \"../../utils/handle-error\"\nimport { outputJson } from \"../../utils/json-output\"\nimport { createSpinner } from \"../../utils/spinner\"\n\n// =============================================================================\n// CONSTANTS\n// =============================================================================\n\n/** Semver pattern to validate version format before package manager invocation */\nconst SEMVER_PATTERN = /^\\d+\\.\\d+\\.\\d+(-[\\w.]+)?$/\n\n/** Error messages for each failure reason (Law 5: Intentional Naming) */\nconst UPDATE_ERROR_MESSAGES: Record<CheckFailure[\"reason\"], string> = {\n\t\"dev-version\":\n\t\t\"Cannot check for updates in development mode. Install via npm for update support.\",\n\ttimeout: \"Update check timed out after 10s. Try again or check your network.\",\n\t\"network-error\": \"Cannot reach npm registry. Verify your internet connection.\",\n\t\"invalid-response\": \"Received invalid response from npm registry. Try again later.\",\n}\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\ninterface UpdateOptions {\n\tforce?: boolean\n\tmethod?: string\n\tjson?: boolean\n}\n\ninterface SelfUpdateResult {\n\tcurrent: string\n\tlatest: string\n\tmethod: InstallMethod\n\tupdated: boolean\n}\n\n// =============================================================================\n// COMMAND IMPLEMENTATION\n// =============================================================================\n\n/**\n * Execute the self-update command.\n *\n * @param options - Command options (--force, --method)\n */\nasync function updateCommand(options: UpdateOptions): Promise<void> {\n\tconst method = options.method ? parseInstallMethod(options.method) : detectInstallMethod()\n\tconst jsonOutput = options.json === true\n\n\t// Check current version with explicit timeout (user is willing to wait)\n\tconst result = await checkForUpdate(undefined, EXPLICIT_UPDATE_TIMEOUT_MS)\n\n\t// Law 1: Early exit for failure\n\tif (!result.ok) {\n\t\tthrow new SelfUpdateError(UPDATE_ERROR_MESSAGES[result.reason])\n\t}\n\n\t// Law 2: After guard, result is typed as success\n\tconst { current, latest, updateAvailable } = result\n\n\t// Early exit: already up to date (unless forced)\n\tif (!updateAvailable && !options.force) {\n\t\tif (jsonOutput) {\n\t\t\toutputJson({\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: {\n\t\t\t\t\tcurrent,\n\t\t\t\t\tlatest,\n\t\t\t\t\tmethod,\n\t\t\t\t\tupdated: false,\n\t\t\t\t} satisfies SelfUpdateResult,\n\t\t\t})\n\t\t} else {\n\t\t\tnotifyUpToDate(current)\n\t\t}\n\t\treturn\n\t}\n\n\tconst targetVersion = latest\n\n\tswitch (method) {\n\t\tcase \"curl\": {\n\t\t\tawait updateViaCurl(current, targetVersion, jsonOutput)\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"npm\":\n\t\tcase \"pnpm\":\n\t\tcase \"bun\":\n\t\tcase \"yarn\":\n\t\tcase \"unknown\": {\n\t\t\tawait updateViaPackageManager(method, current, targetVersion, jsonOutput)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif (jsonOutput) {\n\t\toutputJson({\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tcurrent,\n\t\t\t\tlatest: targetVersion,\n\t\t\t\tmethod,\n\t\t\t\tupdated: true,\n\t\t\t} satisfies SelfUpdateResult,\n\t\t})\n\t}\n}\n\n// =============================================================================\n// UPDATE STRATEGIES\n// =============================================================================\n\n/**\n * Update via direct binary download (curl install method).\n *\n * SECURITY: Verifies checksum BEFORE replacing the binary.\n * Flow: Download -> Verify -> Swap (atomic)\n */\nasync function updateViaCurl(\n\tcurrent: string,\n\ttargetVersion: string,\n\tjsonOutput: boolean,\n): Promise<void> {\n\t// Get platform target name for checksum lookup\n\tconst url = getDownloadUrl(targetVersion)\n\tconst filename = url.split(\"/\").pop()\n\n\t// Early exit: invalid URL (shouldn't happen, but guard)\n\tif (!filename) {\n\t\tthrow new SelfUpdateError(\"Failed to determine binary filename from download URL\")\n\t}\n\n\t// Fetch checksums for verification\n\tconst checksums = await fetchChecksums(targetVersion)\n\n\t// SECURITY: Fail loudly if no checksum available\n\tconst expectedHash = checksums.get(filename)\n\tif (!expectedHash) {\n\t\tthrow new SelfUpdateError(`Security error: No checksum found for ${filename}. Update aborted.`)\n\t}\n\n\t// Download to temp file (does NOT replace binary yet)\n\tconst { tempPath, execPath } = await downloadToTemp(targetVersion, { quiet: jsonOutput })\n\n\t// SECURITY: Verify checksum BEFORE replacing the binary\n\ttry {\n\t\tawait verifyChecksum(tempPath, expectedHash, filename)\n\t} catch (error) {\n\t\t// Checksum failed - clean up temp file and abort\n\t\tcleanupTempFile(tempPath)\n\t\tthrow error\n\t}\n\n\t// Checksum verified - now safe to atomically swap\n\tatomicReplace(tempPath, execPath)\n\n\tif (!jsonOutput) {\n\t\tnotifyUpdated(current, targetVersion)\n\t}\n}\n\n/**\n * Run a package manager command using Bun.spawn.\n * Throws SelfUpdateError on failure.\n */\nasync function runPackageManager(cmd: string[]): Promise<void> {\n\tconst proc = Bun.spawn(cmd, { stdout: \"pipe\", stderr: \"pipe\" })\n\tconst exitCode = await proc.exited\n\tif (exitCode !== 0) {\n\t\tconst stderr = await new Response(proc.stderr).text()\n\t\tthrow new SelfUpdateError(`Package manager command failed: ${stderr.trim()}`)\n\t}\n}\n\n/**\n * Update via package manager.\n * Shells out to the package manager's global install command.\n *\n * SECURITY: Validates version format before invoking package manager.\n */\nasync function updateViaPackageManager(\n\tmethod: Exclude<InstallMethod, \"curl\">,\n\tcurrent: string,\n\ttargetVersion: string,\n\tjsonOutput: boolean,\n): Promise<void> {\n\t// SECURITY: Validate version format to prevent command injection\n\tif (!SEMVER_PATTERN.test(targetVersion)) {\n\t\tthrow new SelfUpdateError(`Invalid version format: ${targetVersion}`)\n\t}\n\n\tconst spin = jsonOutput ? null : createSpinner({ text: `Updating via ${method}...` })\n\tspin?.start()\n\n\ttry {\n\t\tswitch (method) {\n\t\t\tcase \"npm\": {\n\t\t\t\tawait runPackageManager([\"npm\", \"install\", \"-g\", `ocx@${targetVersion}`])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"yarn\": {\n\t\t\t\tawait runPackageManager([\"yarn\", \"global\", \"add\", `ocx@${targetVersion}`])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"pnpm\": {\n\t\t\t\tawait runPackageManager([\"pnpm\", \"install\", \"-g\", `ocx@${targetVersion}`])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"bun\": {\n\t\t\t\tawait runPackageManager([\"bun\", \"install\", \"-g\", `ocx@${targetVersion}`])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"unknown\": {\n\t\t\t\tthrow new SelfUpdateError(\n\t\t\t\t\t\"Could not detect install method. Update manually with one of:\\n\" +\n\t\t\t\t\t\t\" npm install -g ocx@latest\\n\" +\n\t\t\t\t\t\t\" pnpm install -g ocx@latest\\n\" +\n\t\t\t\t\t\t\" bun install -g ocx@latest\",\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tspin?.succeed(`Updated via ${method}`)\n\t\tif (!jsonOutput) {\n\t\t\tnotifyUpdated(current, targetVersion)\n\t\t}\n\t} catch (error) {\n\t\t// Re-throw SelfUpdateError as-is\n\t\tif (error instanceof SelfUpdateError) {\n\t\t\tspin?.fail(`Update failed`)\n\t\t\tthrow error\n\t\t}\n\n\t\tspin?.fail(`Update failed`)\n\t\tthrow new SelfUpdateError(\n\t\t\t`Failed to run ${method}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t)\n\t}\n}\n\n// =============================================================================\n// COMMAND REGISTRATION\n// =============================================================================\n\n/**\n * Register the self update command.\n *\n * @param parent - Parent command (self)\n */\nexport function registerSelfUpdateCommand(parent: Command): void {\n\tparent\n\t\t.command(\"update\")\n\t\t.description(\"Update OCX to the latest version\")\n\t\t.option(\"-f, --force\", \"Reinstall even if already up to date\")\n\t\t.option(\"--method <method>\", \"Override install method detection (curl|npm|pnpm|bun)\")\n\t\t.option(\"--json\", \"Output as JSON\")\n\t\t.action(async (options: UpdateOptions) => {\n\t\t\ttry {\n\t\t\t\tawait updateCommand(options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n",
131
- "/**\n * Self Command Group\n *\n * Parent command for OCX CLI self-management operations.\n * Provides commands for updating and managing the CLI itself.\n */\n\nimport type { Command } from \"commander\"\nimport { registerSelfUninstallCommand } from \"./uninstall\"\nimport { registerSelfUpdateCommand } from \"./update\"\n\nexport function registerSelfCommand(program: Command): void {\n\tconst self = program.command(\"self\").description(\"Manage the OCX CLI\")\n\n\t// Register subcommands\n\tregisterSelfUninstallCommand(self)\n\tregisterSelfUpdateCommand(self)\n}\n",
132
- "/**\n * OCX CLI - update command\n * Update installed components from registries\n */\n\nimport { randomUUID } from \"node:crypto\"\nimport { existsSync } from \"node:fs\"\nimport { mkdir, rename, rm, stat, writeFile } from \"node:fs/promises\"\nimport { dirname, join } from \"node:path\"\n\nimport type { Command } from \"commander\"\nimport { type ConfigProvider, GlobalConfigProvider, LocalConfigProvider } from \"../config/provider\"\nimport { fetchComponentVersion, fetchFileContent } from \"../registry/fetcher\"\nimport { parseCanonicalId, type Receipt, readReceipt, writeReceipt } from \"../schemas/config\"\nimport {\n\ttype ComponentFileObject,\n\tnormalizeComponentManifest,\n\tparseQualifiedComponent,\n} from \"../schemas/registry\"\nimport { type DryRunAction, type DryRunResult, outputDryRun } from \"../utils/dry-run\"\nimport { ConfigError, NotFoundError, ValidationError } from \"../utils/errors\"\nimport { createSpinner, handleError, logger } from \"../utils/index\"\nimport { resolveTargetPath } from \"../utils/paths\"\nimport { registerPlannedWriteOrThrow } from \"../utils/planned-writes\"\nimport { hashBundle, hashContent } from \"../utils/receipt\"\nimport { addCommonOptions, addGlobalOption, addVerboseOption } from \"../utils/shared-options\"\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface UpdateOptions {\n\tall?: boolean\n\tregistry?: string\n\tdryRun?: boolean\n\tglobal?: boolean\n\tcwd?: string\n\tquiet?: boolean\n\tverbose?: boolean\n\tjson?: boolean\n}\n\ninterface ComponentSpec {\n\tcomponent: string\n}\n\ninterface UpdateResult {\n\tqualifiedName: string\n\toldVersion: string\n\tnewVersion: string\n\tstatus: \"updated\" | \"up-to-date\" | \"would-update\"\n}\n\ninterface PreparedUpdateFile {\n\tresolvedTarget: string\n\ttargetPath: string\n\tcontent: Buffer\n}\n\ninterface PendingUpdate {\n\tcanonicalId: string\n\tcomponent: ReturnType<typeof normalizeComponentManifest>\n\tfiles: { path: string; content: Buffer }[]\n\tnewHash: string\n\tnewVersion: string\n\tbaseUrl: string\n\tregistryName: string\n\tname: string\n}\n\ninterface PreparedUpdate {\n\tupdate: PendingUpdate\n\tpreparedFiles: PreparedUpdateFile[]\n}\n\ninterface AppliedWrite {\n\ttargetPath: string\n\tbackupPath: string | null\n}\n\ninterface AppliedWriteTransaction {\n\tcommit: () => Promise<void>\n\trollback: () => Promise<void>\n}\n\ninterface UpdateFileOps {\n\trename?: (oldPath: string, newPath: string) => Promise<void>\n}\n\ntype UpdateFailurePhase = \"check\" | \"apply\"\n\nfunction formatAddCommandHint(component: string, options: UpdateOptions): string {\n\treturn `ocx add${options.global ? \" --global\" : \"\"} ${component}`\n}\n\nexport function resolveUpdateFailureMessage(phase: UpdateFailurePhase): string {\n\treturn phase === \"apply\" ? \"Failed to update components\" : \"Failed to check for updates\"\n}\n\n// =============================================================================\n// COMMAND REGISTRATION\n// =============================================================================\n\nexport function registerUpdateCommand(program: Command): void {\n\tconst cmd = program.command(\"update [components...]\").description(\"Update installed components\")\n\n\taddCommonOptions(cmd)\n\taddVerboseOption(cmd)\n\taddGlobalOption(cmd)\n\n\tcmd\n\t\t.option(\"--all\", \"Update all installed components\")\n\t\t.option(\"--registry <name>\", \"Update all components from a specific registry\")\n\t\t.option(\"--dry-run\", \"Preview changes without applying\")\n\t\t.action(async (components: string[], options: UpdateOptions) => {\n\t\t\ttry {\n\t\t\t\tawait runUpdate(components, options)\n\t\t\t} catch (error) {\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n\n// =============================================================================\n// MAIN UPDATE LOGIC\n// =============================================================================\n\nasync function runUpdate(componentNames: string[], options: UpdateOptions): Promise<void> {\n\tconst cwd = options.cwd ?? process.cwd()\n\tconst provider = options.global\n\t\t? await GlobalConfigProvider.requireInitialized()\n\t\t: await LocalConfigProvider.requireInitialized(cwd)\n\tawait runUpdateCore(componentNames, options, provider)\n}\n\n/**\n * Core update logic shared between local and profile modes.\n * Accepts a ConfigProvider to abstract config source.\n */\nexport async function runUpdateCore(\n\tcomponentNames: string[],\n\toptions: UpdateOptions,\n\tprovider: ConfigProvider,\n\tfileOps?: UpdateFileOps,\n): Promise<void> {\n\tconst registries = provider.getRegistries()\n\tconst componentPath = provider.getComponentPath()\n\tconst isFlattened = componentPath === \"\" || componentPath === \".\"\n\n\t// -------------------------------------------------------------------------\n\t// Parse component specs (Law 2: Parse at boundary before any logic)\n\t// -------------------------------------------------------------------------\n\n\tconst parsedComponents = componentNames.map(parseComponentSpec)\n\n\t// -------------------------------------------------------------------------\n\t// Guard clauses (Law 1: Early Exit)\n\t// -------------------------------------------------------------------------\n\n\t// Guard: No receipt file (nothing installed yet)\n\tconst receipt = await readReceipt(provider.cwd)\n\tif (!receipt || Object.keys(receipt.installed).length === 0) {\n\t\t// If user specified components, give specific error\n\t\tif (componentNames.length > 0) {\n\t\t\tconst requestedComponent = componentNames[0]\n\t\t\tif (!requestedComponent) {\n\t\t\t\tthrow new Error(\"Unexpected: component name missing despite non-empty componentNames\")\n\t\t\t}\n\t\t\tthrow new NotFoundError(\n\t\t\t\t`Component '${requestedComponent}' is not installed. Run '${formatAddCommandHint(requestedComponent, options)}' first.`,\n\t\t\t)\n\t\t}\n\t\t// Generic case for --all or --registry\n\t\tthrow new NotFoundError(\n\t\t\t`No components installed. Run '${formatAddCommandHint(\"<component>\", options)}' first.`,\n\t\t)\n\t}\n\n\t// Guard: No args and no flags\n\tconst hasComponents = componentNames.length > 0\n\tconst hasAll = options.all === true\n\tconst hasRegistry = options.registry !== undefined\n\tif (!hasComponents && !hasAll && !hasRegistry) {\n\t\tthrow new ValidationError(\n\t\t\t\"Specify components, use --all, or use --registry <name>.\\n\\n\" +\n\t\t\t\t\"Examples:\\n\" +\n\t\t\t\t\" ocx update alias/component # Update specific component\\n\" +\n\t\t\t\t\" ocx update --all # Update all installed components\\n\" +\n\t\t\t\t\" ocx update --registry my-alias # Update all from a registry\",\n\t\t)\n\t}\n\n\t// Guard: --all with components\n\tif (hasAll && hasComponents) {\n\t\tthrow new ValidationError(\n\t\t\t\"Cannot specify components with --all.\\n\" +\n\t\t\t\t\"Use either 'ocx update --all' or 'ocx update <components>'.\",\n\t\t)\n\t}\n\n\t// Guard: --registry with components\n\tif (hasRegistry && hasComponents) {\n\t\tthrow new ValidationError(\n\t\t\t\"Cannot specify components with --registry.\\n\" +\n\t\t\t\t\"Use either 'ocx update --registry <name>' or 'ocx update <components>'.\",\n\t\t)\n\t}\n\n\t// Guard: --all with --registry\n\tif (hasAll && hasRegistry) {\n\t\tthrow new ValidationError(\n\t\t\t\"Cannot use --all with --registry.\\n\" +\n\t\t\t\t\"Use either 'ocx update --all' or 'ocx update --registry <name>'.\",\n\t\t)\n\t}\n\n\t// -------------------------------------------------------------------------\n\t// Determine which components to update\n\t// -------------------------------------------------------------------------\n\n\tconst componentsToUpdate = resolveComponentsToUpdate(receipt, parsedComponents, options)\n\n\t// Guard: No matching components\n\tif (componentsToUpdate.length === 0) {\n\t\tif (hasRegistry) {\n\t\t\tthrow new NotFoundError(`No installed components from registry '${options.registry}'.`)\n\t\t}\n\t\tthrow new NotFoundError(\"No matching components found to update.\")\n\t}\n\n\t// -------------------------------------------------------------------------\n\t// Fetch and compare\n\t// -------------------------------------------------------------------------\n\n\tconst spin = options.quiet ? null : createSpinner({ text: \"Checking for updates...\" })\n\tspin?.start()\n\tlet installSpin: ReturnType<typeof createSpinner> | null = null\n\tlet failurePhase: UpdateFailurePhase = \"check\"\n\tlet appliedWriteTransaction: AppliedWriteTransaction | null = null\n\n\tconst results: UpdateResult[] = []\n\tconst updates: PendingUpdate[] = []\n\n\ttry {\n\t\tfor (const spec of componentsToUpdate) {\n\t\t\tconst canonicalId = spec.component\n\t\t\tconst entry = receipt.installed[canonicalId]\n\t\t\t// Guard: component must exist in receipt (already validated in resolveComponentsToUpdate)\n\t\t\tif (!entry) {\n\t\t\t\tthrow new NotFoundError(`Component '${canonicalId}' not found in receipt.`)\n\t\t\t}\n\n\t\t\tconst registryName = entry.registryName\n\t\t\tconst componentName = entry.name\n\n\t\t\t// Get registry config by alias\n\t\t\tconst regConfig = registries[registryName]\n\t\t\tif (!regConfig) {\n\t\t\t\tthrow new ConfigError(\n\t\t\t\t\t`Registry alias '${registryName}' not configured. Component '${canonicalId}' cannot be updated.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Fetch component (latest version)\n\t\t\tconst fetchResult = await fetchComponentVersion(regConfig.url, componentName, undefined)\n\t\t\tconst manifest = fetchResult.manifest\n\n\t\t\tconst normalizedManifest = normalizeComponentManifest(manifest)\n\n\t\t\t// Fetch all files and compute hash\n\t\t\tconst files: { path: string; content: Buffer }[] = []\n\t\t\tfor (const file of normalizedManifest.files) {\n\t\t\t\tconst content = await fetchFileContent(regConfig.url, componentName, file.path)\n\t\t\t\tfiles.push({ path: file.path, content: Buffer.from(content) })\n\t\t\t}\n\n\t\t\tconst newHash = await hashBundle(files)\n\t\t\tconst newVersion = `sha256:${newHash}` // Use hash as version/revision\n\n\t\t\t// Compare hashes\n\t\t\tif (newHash === entry.hash) {\n\t\t\t\tresults.push({\n\t\t\t\t\tqualifiedName: canonicalId,\n\t\t\t\t\toldVersion: entry.revision,\n\t\t\t\t\tnewVersion: newVersion,\n\t\t\t\t\tstatus: \"up-to-date\",\n\t\t\t\t})\n\t\t\t} else if (options.dryRun) {\n\t\t\t\tresults.push({\n\t\t\t\t\tqualifiedName: canonicalId,\n\t\t\t\t\toldVersion: entry.revision,\n\t\t\t\t\tnewVersion: newVersion,\n\t\t\t\t\tstatus: \"would-update\",\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tresults.push({\n\t\t\t\t\tqualifiedName: canonicalId,\n\t\t\t\t\toldVersion: entry.revision,\n\t\t\t\t\tnewVersion: newVersion,\n\t\t\t\t\tstatus: \"updated\",\n\t\t\t\t})\n\t\t\t\tupdates.push({\n\t\t\t\t\tcanonicalId,\n\t\t\t\t\tcomponent: normalizedManifest,\n\t\t\t\t\tfiles,\n\t\t\t\t\tnewHash,\n\t\t\t\t\tnewVersion: newVersion,\n\t\t\t\t\tbaseUrl: regConfig.url,\n\t\t\t\t\tregistryName,\n\t\t\t\t\tname: componentName,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tspin?.succeed(`Checked ${componentsToUpdate.length} component(s)`)\n\n\t\t// -------------------------------------------------------------------------\n\t\t// Dry-run output\n\t\t// -------------------------------------------------------------------------\n\n\t\tif (options.dryRun) {\n\t\t\toutputUpdateDryRun(results, options)\n\t\t\treturn\n\t\t}\n\n\t\t// -------------------------------------------------------------------------\n\t\t// Apply updates\n\t\t// -------------------------------------------------------------------------\n\n\t\tif (updates.length === 0) {\n\t\t\tif (!options.quiet && !options.json) {\n\t\t\t\tlogger.info(\"\")\n\t\t\t\tlogger.success(\"All components are up to date.\")\n\t\t\t}\n\t\t\tif (options.json) {\n\t\t\t\tconsole.log(JSON.stringify({ success: true, updated: [], upToDate: results }, null, 2))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tfailurePhase = \"apply\"\n\t\tinstallSpin = options.quiet ? null : createSpinner({ text: \"Updating components...\" })\n\t\tinstallSpin?.start()\n\n\t\tconst plannedWrites = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tabsolutePath: string\n\t\t\t\trelativePath: string\n\t\t\t\tcontent: Buffer\n\t\t\t\tsource: string\n\t\t\t}\n\t\t>()\n\n\t\tconst preparedUpdates: PreparedUpdate[] = []\n\n\t\tfor (const update of updates) {\n\t\t\tconst preparedFiles: PreparedUpdateFile[] = []\n\n\t\t\tfor (const file of update.files) {\n\t\t\t\tconst fileObj = update.component.files.find(\n\t\t\t\t\t(f: ComponentFileObject) => f.path === file.path,\n\t\t\t\t)\n\t\t\t\tif (!fileObj) {\n\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t`File \"${file.path}\" not found in component manifest for \"${update.registryName}/${update.name}\".`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tconst resolvedTarget = resolveTargetPath(fileObj.target, isFlattened, provider.cwd)\n\t\t\t\tconst targetPath = join(provider.cwd, resolvedTarget)\n\n\t\t\t\tregisterPlannedWriteOrThrow(plannedWrites, {\n\t\t\t\t\tabsolutePath: targetPath,\n\t\t\t\t\trelativePath: resolvedTarget,\n\t\t\t\t\tcontent: file.content,\n\t\t\t\t\tsource: `${update.registryName}/${update.name}:${fileObj.path}`,\n\t\t\t\t})\n\n\t\t\t\tpreparedFiles.push({\n\t\t\t\t\tresolvedTarget,\n\t\t\t\t\ttargetPath,\n\t\t\t\t\tcontent: file.content,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tpreparedUpdates.push({ update, preparedFiles })\n\t\t}\n\n\t\tappliedWriteTransaction = await applyPreparedUpdatesAtomically(preparedUpdates, {\n\t\t\tverbose: options.verbose,\n\t\t\tquiet: options.quiet,\n\t\t\tfileOps,\n\t\t})\n\n\t\tfor (const prepared of preparedUpdates) {\n\t\t\tconst { update, preparedFiles } = prepared\n\n\t\t\t// Update receipt entry - we know it exists because we validated in resolveComponentsToUpdate\n\t\t\tconst existingEntry = receipt.installed[update.canonicalId]\n\t\t\tif (!existingEntry) {\n\t\t\t\tthrow new NotFoundError(`Component '${update.canonicalId}' not found in receipt.`)\n\t\t\t}\n\n\t\t\t// Compute individual file hashes\n\t\t\tconst fileHashes: Array<{ path: string; hash: string }> = []\n\t\t\tfor (const preparedFile of preparedFiles) {\n\t\t\t\tfileHashes.push({\n\t\t\t\t\tpath: preparedFile.resolvedTarget,\n\t\t\t\t\thash: hashContent(preparedFile.content),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treceipt.installed[update.canonicalId] = {\n\t\t\t\tregistryUrl: existingEntry.registryUrl,\n\t\t\t\tregistryName: existingEntry.registryName,\n\t\t\t\tname: existingEntry.name,\n\t\t\t\trevision: update.newVersion,\n\t\t\t\thash: update.newHash,\n\t\t\t\tfiles: fileHashes,\n\t\t\t\tinstalledAt: existingEntry.installedAt,\n\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t\t// Update opencode config if component provides it\n\t\t\t\t...(update.component.opencode && {\n\t\t\t\t\topencode: update.component.opencode as Record<string, unknown>,\n\t\t\t\t}),\n\t\t\t}\n\t\t}\n\n\t\t// Save receipt file\n\t\tawait writeReceipt(provider.cwd, receipt)\n\t\tif (!appliedWriteTransaction) {\n\t\t\tthrow new Error(\"Internal error: missing applied write transaction after update apply phase.\")\n\t\t}\n\t\tawait appliedWriteTransaction.commit()\n\t\tappliedWriteTransaction = null\n\n\t\tinstallSpin?.succeed(`Updated ${updates.length} component(s)`)\n\n\t\t// -------------------------------------------------------------------------\n\t\t// Output results\n\t\t// -------------------------------------------------------------------------\n\n\t\tif (options.json) {\n\t\t\tconsole.log(\n\t\t\t\tJSON.stringify(\n\t\t\t\t\t{\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tupdated: results.filter((r) => r.status === \"updated\"),\n\t\t\t\t\t\tupToDate: results.filter((r) => r.status === \"up-to-date\"),\n\t\t\t\t\t},\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t)\n\t\t} else if (!options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tfor (const result of results) {\n\t\t\t\tif (result.status === \"updated\") {\n\t\t\t\t\tlogger.info(` ✓ ${result.qualifiedName} (${result.oldVersion} → ${result.newVersion})`)\n\t\t\t\t} else if (result.status === \"up-to-date\" && options.verbose) {\n\t\t\t\t\tlogger.info(` ○ ${result.qualifiedName} (already up to date)`)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.success(`Done! Updated ${updates.length} component(s).`)\n\t\t}\n\t} catch (error) {\n\t\tif (failurePhase === \"apply\") {\n\t\t\tif (appliedWriteTransaction) {\n\t\t\t\tawait appliedWriteTransaction.rollback()\n\t\t\t\tappliedWriteTransaction = null\n\t\t\t}\n\t\t\tinstallSpin?.fail(resolveUpdateFailureMessage(\"apply\"))\n\t\t} else {\n\t\t\tspin?.fail(resolveUpdateFailureMessage(\"check\"))\n\t\t}\n\t\tthrow error\n\t}\n}\n\n// =============================================================================\n// HELPER FUNCTIONS\n// =============================================================================\n\nasync function applyPreparedUpdatesAtomically(\n\tpreparedUpdates: PreparedUpdate[],\n\toptions: { verbose?: boolean; quiet?: boolean; fileOps?: UpdateFileOps },\n): Promise<AppliedWriteTransaction> {\n\tconst appliedWrites: AppliedWrite[] = []\n\tconst tempPaths = new Set<string>()\n\tlet finalized = false\n\tconst renameFile = options.fileOps?.rename ?? rename\n\n\tconst rollback = async (): Promise<void> => {\n\t\tif (finalized) {\n\t\t\treturn\n\t\t}\n\n\t\tfinalized = true\n\n\t\tfor (const tempPath of tempPaths) {\n\t\t\ttry {\n\t\t\t\tawait rm(tempPath, { force: true })\n\t\t\t} catch {\n\t\t\t\t// best-effort cleanup\n\t\t\t}\n\t\t}\n\n\t\tfor (const appliedWrite of [...appliedWrites].reverse()) {\n\t\t\ttry {\n\t\t\t\tif (appliedWrite.backupPath) {\n\t\t\t\t\tif (existsSync(appliedWrite.targetPath)) {\n\t\t\t\t\t\tawait rm(appliedWrite.targetPath, { force: true, recursive: true })\n\t\t\t\t\t}\n\t\t\t\t\tif (existsSync(appliedWrite.backupPath)) {\n\t\t\t\t\t\tawait renameFile(appliedWrite.backupPath, appliedWrite.targetPath)\n\t\t\t\t\t}\n\t\t\t\t} else if (existsSync(appliedWrite.targetPath)) {\n\t\t\t\t\tawait rm(appliedWrite.targetPath, { force: true, recursive: true })\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// best-effort rollback\n\t\t\t}\n\t\t}\n\t}\n\n\tconst commit = async (): Promise<void> => {\n\t\tif (finalized) {\n\t\t\treturn\n\t\t}\n\n\t\tfinalized = true\n\n\t\tfor (const appliedWrite of appliedWrites) {\n\t\t\tif (!appliedWrite.backupPath) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (existsSync(appliedWrite.backupPath)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait rm(appliedWrite.backupPath, { force: true })\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!options.quiet) {\n\t\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\t\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t\t`Post-update cleanup warning: failed to remove backup \"${appliedWrite.backupPath}\" (${errorMessage})`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\tfor (const prepared of preparedUpdates) {\n\t\t\tfor (const preparedFile of prepared.preparedFiles) {\n\t\t\t\tconst targetDir = dirname(preparedFile.targetPath)\n\n\t\t\t\tif (!existsSync(targetDir)) {\n\t\t\t\t\tawait mkdir(targetDir, { recursive: true })\n\t\t\t\t}\n\n\t\t\t\tif (existsSync(preparedFile.targetPath)) {\n\t\t\t\t\tconst currentTargetStats = await stat(preparedFile.targetPath)\n\t\t\t\t\tif (currentTargetStats.isDirectory()) {\n\t\t\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t\t\t`Cannot update \"${preparedFile.resolvedTarget}\": target path is a directory.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst tempPath = `${preparedFile.targetPath}.ocx-update-tmp-${randomUUID()}`\n\t\t\t\tawait writeFile(tempPath, preparedFile.content)\n\t\t\t\ttempPaths.add(tempPath)\n\n\t\t\t\tlet backupPath: string | null = null\n\t\t\t\tif (existsSync(preparedFile.targetPath)) {\n\t\t\t\t\tbackupPath = `${preparedFile.targetPath}.ocx-update-backup-${randomUUID()}`\n\t\t\t\t\tawait renameFile(preparedFile.targetPath, backupPath)\n\t\t\t\t\tappliedWrites.push({\n\t\t\t\t\t\ttargetPath: preparedFile.targetPath,\n\t\t\t\t\t\tbackupPath,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tawait renameFile(tempPath, preparedFile.targetPath)\n\t\t\t\ttempPaths.delete(tempPath)\n\n\t\t\t\tif (!backupPath) {\n\t\t\t\t\tappliedWrites.push({\n\t\t\t\t\t\ttargetPath: preparedFile.targetPath,\n\t\t\t\t\t\tbackupPath: null,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif (options.verbose) {\n\t\t\t\t\tlogger.info(` ✓ Updated ${preparedFile.resolvedTarget}`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { commit, rollback }\n\t} catch (error) {\n\t\tawait rollback()\n\t\tthrow error\n\t}\n}\n\n/**\n * Parse and validate a component specifier.\n * Law 2: Parse at boundary, trust internally.\n * Law 4: Fail fast on malformed specifiers before receipt lookup.\n *\n * Rejects trailing `@` (empty version) since update always fetches latest.\n *\n * @example\n * parseComponentSpec(\"kdco/agents\") // { component: \"kdco/agents\" }\n * parseComponentSpec(\"kdco/agents@\") // throws ConfigError\n */\nfunction parseComponentSpec(spec: string): ComponentSpec {\n\tif (spec.endsWith(\"@\")) {\n\t\tthrow new ConfigError(\n\t\t\t`Invalid version specifier '${spec}'. The trailing '@' has no version.\\n` +\n\t\t\t\t`Use '${spec.slice(0, -1)}' to update to the latest version.`,\n\t\t)\n\t}\n\n\treturn { component: spec }\n}\n\n/**\n * Resolve which components to update based on args and flags.\n * Law 4: Fail fast if component not found in receipt.\n */\nfunction resolveComponentsToUpdate(\n\treceipt: Receipt,\n\tparsedComponents: ComponentSpec[],\n\toptions: UpdateOptions,\n): ComponentSpec[] {\n\tconst installedComponents = Object.keys(receipt.installed)\n\n\t// --all: update all installed components (no version override)\n\tif (options.all) {\n\t\treturn installedComponents.map((c) => ({ component: c }))\n\t}\n\n\t// --registry: filter by registry alias (no version override)\n\tif (options.registry) {\n\t\treturn installedComponents\n\t\t\t.filter((canonicalId) => {\n\t\t\t\tconst entry = receipt.installed[canonicalId]\n\t\t\t\treturn entry?.registryName === options.registry\n\t\t\t})\n\t\t\t.map((c) => ({ component: c }))\n\t}\n\n\t// Specific components: validate they exist\n\t// User provides qualified names like \"alias/component\"\n\t// We need to find the matching canonical ID in the receipt\n\tconst result: ComponentSpec[] = []\n\tfor (const spec of parsedComponents) {\n\t\tconst name = spec.component\n\t\t// Validate format (must be qualified)\n\t\tif (!name.includes(\"/\")) {\n\t\t\tconst suggestions = installedComponents\n\t\t\t\t.map((id) => {\n\t\t\t\t\tconst parsed = parseCanonicalId(id)\n\t\t\t\t\treturn `${parsed.registryName}/${parsed.name}`\n\t\t\t\t})\n\t\t\t\t.filter((qualified) => qualified.endsWith(`/${name}`))\n\t\t\tif (suggestions.length === 1) {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Ambiguous component '${name}'. Did you mean '${suggestions[0]}'?`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (suggestions.length > 1) {\n\t\t\t\tthrow new ValidationError(\n\t\t\t\t\t`Ambiguous component '${name}'. Found in multiple registries:\\n` +\n\t\t\t\t\t\tsuggestions.map((s) => ` - ${s}`).join(\"\\n\") +\n\t\t\t\t\t\t\"\\n\\nPlease use a fully qualified name (alias/component).\",\n\t\t\t\t)\n\t\t\t}\n\t\t\tthrow new ValidationError(\n\t\t\t\t`Component '${name}' must include a registry alias (e.g., 'kdco/${name}').`,\n\t\t\t)\n\t\t}\n\n\t\t// Find matching canonical ID\n\t\tconst { namespace: prefix, component } = parseQualifiedComponent(name)\n\t\tconst matchingIds = installedComponents.filter((id) => {\n\t\t\tconst parsed = parseCanonicalId(id)\n\t\t\treturn parsed.registryName === prefix && parsed.name === component\n\t\t})\n\n\t\tif (matchingIds.length === 0) {\n\t\t\tthrow new NotFoundError(\n\t\t\t\t`Component '${name}' is not installed.\\nRun '${formatAddCommandHint(name, options)}' to install it first.`,\n\t\t\t)\n\t\t}\n\n\t\t// Use the first matching canonical ID (there should only be one per alias/name pair)\n\t\tconst canonicalId = matchingIds[0]\n\t\tif (!canonicalId) {\n\t\t\tthrow new Error(`Unexpected: matchingIds has length but first element is undefined`)\n\t\t}\n\t\tresult.push({ component: canonicalId })\n\t}\n\n\treturn result\n}\n\n/**\n * Output dry-run results using shared utility.\n */\nfunction outputUpdateDryRun(results: UpdateResult[], options: UpdateOptions): void {\n\tconst wouldUpdate = results.filter((r) => r.status === \"would-update\")\n\n\tconst actions: DryRunAction[] = wouldUpdate.map((result) => ({\n\t\taction: \"update\",\n\t\ttarget: result.qualifiedName,\n\t\tdetails: { from: result.oldVersion, to: result.newVersion },\n\t}))\n\n\tconst dryRunResult: DryRunResult = {\n\t\tdryRun: true,\n\t\tcommand: \"update\",\n\t\twouldPerform: actions,\n\t\tvalidation: { passed: true },\n\t\tsummary:\n\t\t\twouldUpdate.length > 0\n\t\t\t\t? `Would update ${wouldUpdate.length} component(s)`\n\t\t\t\t: \"All components are up to date\",\n\t}\n\n\toutputDryRun(dryRunResult, { json: options.json, quiet: options.quiet })\n}\n",
133
- "/**\n * Validate Command (for Registry Authors)\n *\n * Validates a registry source without building it.\n */\n\nimport { resolve } from \"node:path\"\nimport type { Command } from \"commander\"\nimport kleur from \"kleur\"\nimport { runCompleteValidation } from \"../lib/validation-runner\"\nimport type { LoadRegistryErrorKind } from \"../lib/validators\"\nimport {\n\tEXIT_CODES,\n\tNotFoundError,\n\tOCXError,\n\tValidationFailedError,\n\ttype ValidationFailureDetails,\n} from \"../utils/errors\"\nimport { handleError, logger, outputJson } from \"../utils/index\"\nimport { summarizeValidationErrors } from \"../utils/validation-errors\"\n\ninterface ValidateOptions {\n\tcwd: string\n\tjson: boolean\n\tquiet: boolean\n\tduplicateTargets: boolean\n}\n\nfunction createLoadValidationError(message: string, errorKind?: LoadRegistryErrorKind): Error {\n\tif (errorKind === \"not_found\") {\n\t\treturn new NotFoundError(message)\n\t}\n\n\tif (errorKind === \"parse_error\") {\n\t\treturn new OCXError(message, \"CONFIG_ERROR\", EXIT_CODES.CONFIG)\n\t}\n\n\treturn new OCXError(message, \"CONFIG_ERROR\", EXIT_CODES.CONFIG)\n}\n\nfunction createValidationFailureError(\n\terrors: string[],\n\tfailureType: \"schema\" | \"rules\",\n): ValidationFailedError {\n\tconst summary = summarizeValidationErrors(errors, {\n\t\tschemaErrors: failureType === \"schema\" ? errors.length : 0,\n\t})\n\n\tconst details: ValidationFailureDetails = {\n\t\tvalid: false,\n\t\terrors,\n\t\tsummary: {\n\t\t\tvalid: false,\n\t\t\ttotalErrors: summary.totalErrors,\n\t\t\tschemaErrors: summary.schemaErrors,\n\t\t\tsourceFileErrors: summary.sourceFileErrors,\n\t\t\tcircularDependencyErrors: summary.circularDependencyErrors,\n\t\t\tduplicateTargetErrors: summary.duplicateTargetErrors,\n\t\t\totherErrors: summary.otherErrors,\n\t\t},\n\t}\n\n\treturn new ValidationFailedError(details)\n}\n\nfunction outputValidationErrors(errors: string[]): void {\n\tfor (const error of errors) {\n\t\tconsole.log(kleur.red(` ${error}`))\n\t}\n}\n\nexport function registerValidateCommand(program: Command): void {\n\tprogram\n\t\t.command(\"validate\")\n\t\t.description(\"Validate a registry source (for registry authors)\")\n\t\t.argument(\"[path]\", \"Registry source directory\", \".\")\n\t\t.option(\"--cwd <path>\", \"Working directory\", process.cwd())\n\t\t.option(\"--json\", \"Output as JSON\", false)\n\t\t.option(\"-q, --quiet\", \"Suppress output\", false)\n\t\t.option(\"--no-duplicate-targets\", \"Skip duplicate target validation\")\n\t\t.action(async (path: string, options: ValidateOptions) => {\n\t\t\ttry {\n\t\t\t\tconst sourcePath = resolve(options.cwd, path)\n\n\t\t\t\tconst validationResult = await runCompleteValidation(sourcePath, {\n\t\t\t\t\tskipDuplicateTargets: options.duplicateTargets === false,\n\t\t\t\t})\n\n\t\t\t\tif (!validationResult.success) {\n\t\t\t\t\tconst [firstError = \"Registry validation failed\"] = validationResult.errors\n\n\t\t\t\t\tif (validationResult.failureType === \"load\") {\n\t\t\t\t\t\tconst loadError = createLoadValidationError(firstError, validationResult.loadErrorKind)\n\t\t\t\t\t\tif (!options.json && options.quiet) {\n\t\t\t\t\t\t\tconst exitCode =\n\t\t\t\t\t\t\t\tloadError instanceof OCXError ? loadError.exitCode : EXIT_CODES.GENERAL\n\t\t\t\t\t\t\tprocess.exit(exitCode)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow loadError\n\t\t\t\t\t}\n\n\t\t\t\t\tconst validationError = createValidationFailureError(\n\t\t\t\t\t\tvalidationResult.errors,\n\t\t\t\t\t\tvalidationResult.failureType === \"schema\" ? \"schema\" : \"rules\",\n\t\t\t\t\t)\n\n\t\t\t\t\tif (options.json) {\n\t\t\t\t\t\tthrow validationError\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.quiet) {\n\t\t\t\t\t\tlogger.error(validationError.message)\n\t\t\t\t\t\toutputValidationErrors(validationResult.errors)\n\t\t\t\t\t}\n\n\t\t\t\t\tprocess.exit(validationError.exitCode)\n\t\t\t\t}\n\n\t\t\t\t// All validations passed\n\t\t\t\tif (!options.quiet && !options.json) {\n\t\t\t\t\tlogger.success(\"✓ Registry source is valid\")\n\t\t\t\t}\n\n\t\t\t\tif (options.json) {\n\t\t\t\t\toutputJson({\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tvalid: true,\n\t\t\t\t\t\t\terrors: [],\n\t\t\t\t\t\t\tsummary: summarizeValidationErrors([]),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (!options.json && options.quiet) {\n\t\t\t\t\tconst exitCode = error instanceof OCXError ? error.exitCode : EXIT_CODES.GENERAL\n\t\t\t\t\tprocess.exit(exitCode)\n\t\t\t\t}\n\n\t\t\t\thandleError(error, { json: options.json })\n\t\t\t}\n\t\t})\n}\n",
134
- "/**\n * OCX CLI - verify command\n * Verify file integrity of installed components\n */\n\nimport type { Command } from \"commander\"\nimport { LocalConfigProvider } from \"../config/provider\"\nimport { readReceipt } from \"../schemas/config\"\nimport { resolveInstalledComponentRefs } from \"../utils/component-ref-resolver\"\nimport { ConflictError, EXIT_CODES } from \"../utils/errors\"\nimport { createSpinner, handleError, logger } from \"../utils/index\"\nimport { checkFileIntegrity } from \"../utils/receipt\"\nimport { addCommonOptions, addVerboseOption } from \"../utils/shared-options\"\n\nexport interface VerifyOptions {\n\tcwd?: string\n\tquiet?: boolean\n\tverbose?: boolean\n\tjson?: boolean\n}\n\nexport function registerVerifyCommand(program: Command): void {\n\tconst cmd = program\n\t\t.command(\"verify\")\n\t\t.description(\"Verify integrity of installed components\")\n\t\t.argument(\"[components...]\", \"Components to verify (optional, verifies all if omitted)\")\n\n\taddCommonOptions(cmd)\n\taddVerboseOption(cmd)\n\n\tcmd.action(async (components: string[], options: VerifyOptions) => {\n\t\ttry {\n\t\t\tawait runVerify(components, options)\n\t\t} catch (error) {\n\t\t\thandleError(error, { json: options.json })\n\t\t}\n\t})\n}\n\nasync function runVerify(componentNames: string[], options: VerifyOptions): Promise<void> {\n\tconst cwd = options.cwd ?? process.cwd()\n\tconst provider = await LocalConfigProvider.requireInitialized(cwd)\n\n\t// V1: Read receipt\n\tconst receipt = await readReceipt(provider.cwd)\n\tif (!receipt || Object.keys(receipt.installed).length === 0) {\n\t\tif (options.json) {\n\t\t\tconsole.log(JSON.stringify({ success: true, verified: [], errors: [] }, null, 2))\n\t\t} else if (!options.quiet) {\n\t\t\tlogger.info(\"No components installed.\")\n\t\t}\n\t\treturn\n\t}\n\n\t// Determine which components to verify\n\t// Resolve shorthand refs (e.g., \"kdco/researcher\") to canonical receipt IDs\n\tlet toVerify: string[]\n\tif (componentNames.length > 0) {\n\t\ttoVerify = resolveInstalledComponentRefs(componentNames, receipt)\n\t} else {\n\t\ttoVerify = Object.keys(receipt.installed)\n\t}\n\n\tconst spin =\n\t\toptions.quiet || options.json ? null : createSpinner({ text: \"Verifying components...\" })\n\tspin?.start()\n\n\tconst results: Array<{\n\t\tcanonicalId: string\n\t\tintact: boolean\n\t\tmodified: string[]\n\t\tmissing: string[]\n\t}> = []\n\n\tlet hasIssues = false\n\n\tfor (const canonicalId of toVerify) {\n\t\tconst entry = receipt.installed[canonicalId]\n\t\tif (!entry) {\n\t\t\t// Should not reach here after resolution, but guard defensively\n\t\t\tif (componentNames.length > 0) {\n\t\t\t\tlogger.warn(`Component '${canonicalId}' not found in receipt.`)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst integrity = await checkFileIntegrity(provider.cwd, entry)\n\n\t\tif (!integrity.intact) {\n\t\t\thasIssues = true\n\t\t}\n\n\t\tresults.push({\n\t\t\tcanonicalId,\n\t\t\tintact: integrity.intact,\n\t\t\tmodified: integrity.modified,\n\t\t\tmissing: integrity.missing,\n\t\t})\n\t}\n\n\tspin?.succeed(`Verified ${results.length} component(s)`)\n\n\t// Output results\n\tif (options.json) {\n\t\tconsole.log(\n\t\t\tJSON.stringify(\n\t\t\t\t{\n\t\t\t\t\tsuccess: !hasIssues,\n\t\t\t\t\tverified: results.filter((r) => r.intact),\n\t\t\t\t\terrors: results.filter((r) => !r.intact),\n\t\t\t\t},\n\t\t\t\tnull,\n\t\t\t\t2,\n\t\t\t),\n\t\t)\n\t\t// Exit with non-zero if there are issues (consistent with non-JSON mode)\n\t\tif (hasIssues) {\n\t\t\tprocess.exit(EXIT_CODES.CONFLICT)\n\t\t}\n\t\treturn\n\t}\n\n\tif (!options.quiet) {\n\t\tlogger.info(\"\")\n\t\tfor (const result of results) {\n\t\t\tif (result.intact) {\n\t\t\t\tif (options.verbose) {\n\t\t\t\t\tlogger.success(`✓ ${result.canonicalId} - all files intact`)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogger.error(`✗ ${result.canonicalId} - integrity check failed`)\n\t\t\t\tfor (const path of result.modified) {\n\t\t\t\t\tlogger.error(` Modified: ${path}`)\n\t\t\t\t}\n\t\t\t\tfor (const path of result.missing) {\n\t\t\t\t\tlogger.error(` Missing: ${path}`)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (hasIssues) {\n\t\tif (!options.quiet) {\n\t\t\tlogger.info(\"\")\n\t\t\tlogger.warn(\n\t\t\t\t\"Some files have been modified or are missing. \" +\n\t\t\t\t\t\"Review local changes with git, then run 'ocx update <alias/component>' or 'ocx update --all' to restore.\",\n\t\t\t)\n\t\t}\n\n\t\tthrow new ConflictError(\"File integrity check failed for one or more components.\")\n\t}\n\n\tif (!options.quiet) {\n\t\tlogger.info(\"\")\n\t\tlogger.success(\"All components verified successfully.\")\n\t}\n}\n",
135
- "/**\n * Self-Update Hook Integration\n *\n * Registers a post-action hook to check for updates after CLI commands.\n * Follows the 5 Laws of Elegant Defense:\n * - Early Exit: Multiple guard clauses for skip conditions\n * - Parse Don't Validate: Uses typed VersionCheckResult from check module\n * - Atomic Predictability: Pure shouldCheckForUpdate function\n * - Fail Fast: Silent failure on any error (non-blocking UX)\n * - Intentional Naming: Self-documenting function names\n */\n\nimport type { Command } from \"commander\"\nimport { parseEnvBool } from \"../utils/env\"\nimport { checkForUpdate } from \"./check\"\nimport { notifyUpdate } from \"./notify\"\n\n// =============================================================================\n// UPDATE CHECK CONDITIONS\n// =============================================================================\n\n/**\n * Check environment conditions for running update check.\n * Returns false if any condition indicates we should skip.\n */\nfunction shouldCheckForUpdate(): boolean {\n\t// Skip if explicitly disabled via env\n\tif (process.env.OCX_SELF_UPDATE === \"off\") return false\n\tif (parseEnvBool(process.env.OCX_NO_UPDATE_CHECK, false)) return false\n\n\t// Skip in CI environments\n\tif (process.env.CI) return false\n\n\t// Skip if not a TTY (can't display notification anyway)\n\tif (!process.stdout.isTTY) return false\n\n\treturn true\n}\n\n// =============================================================================\n// HOOK REGISTRATION\n// =============================================================================\n\n/**\n * Register post-action hook for update checks.\n * Call this on the root program to check after every command.\n *\n * The hook runs after each command completes and silently checks for updates.\n * If a newer version is available, it displays a notification to stderr.\n *\n * @param program - The root Commander program instance\n */\nexport function registerUpdateCheckHook(program: Command): void {\n\tprogram.hook(\"postAction\", async (_thisCommand, actionCommand) => {\n\t\t// Skip if running self update command itself\n\t\tif (actionCommand.name() === \"update\" && actionCommand.parent?.name() === \"self\") {\n\t\t\treturn\n\t\t}\n\n\t\t// Skip for JSON-mode and quiet-mode commands (strict output contract)\n\t\tconst actionOptions = actionCommand.opts<{ json?: boolean; quiet?: boolean }>()\n\t\tif (actionOptions.json || actionOptions.quiet) {\n\t\t\treturn\n\t\t}\n\n\t\t// Check environment conditions\n\t\tif (!shouldCheckForUpdate()) return\n\n\t\t// Non-blocking check with silent failure\n\t\ttry {\n\t\t\tconst result = await checkForUpdate()\n\t\t\tif (result.ok && result.updateAvailable) {\n\t\t\t\tnotifyUpdate(result.current, result.latest)\n\t\t\t}\n\t\t} catch {\n\t\t\t// Silent failure - never interrupt user workflow\n\t\t}\n\t})\n}\n\n// =============================================================================\n// RE-EXPORTS\n// =============================================================================\n\nexport type { CheckFailure, CheckResult, VersionCheckResult, VersionProvider } from \"./check\"\nexport { checkForUpdate, EXPLICIT_UPDATE_TIMEOUT_MS } from \"./check\"\nexport { getDownloadBaseUrl, getDownloadUrl } from \"./download\"\nexport { notifyUpdate, notifyUpdated, notifyUpToDate } from \"./notify\"\nexport type { VersionProvider as IVersionProvider } from \"./types\"\nexport { BuildTimeVersionProvider, defaultVersionProvider } from \"./version-provider\"\n",
136
- "#!/usr/bin/env -S bun --no-env-file\n/**\n * OCX CLI - OpenCode Extensions\n *\n * A ShadCN-style CLI for installing agents, skills, plugins, and commands\n * into OpenCode projects.\n */\n\nimport { Command } from \"commander\"\nimport { registerAddCommand } from \"./commands/add\"\nimport { registerBuildCommand } from \"./commands/build\"\nimport { registerConfigCommand } from \"./commands/config/index\"\nimport { registerInitCommand } from \"./commands/init\"\nimport { registerMigrateCommand } from \"./commands/migrate/index\"\nimport { registerOpencodeCommand } from \"./commands/opencode\"\nimport { registerProfileCommand } from \"./commands/profile/index\"\nimport { registerRegistryCommand } from \"./commands/registry\"\nimport { registerRemoveCommand } from \"./commands/remove\"\nimport { registerSearchCommand } from \"./commands/search\"\nimport { registerSelfCommand } from \"./commands/self/index\"\nimport { registerUpdateCommand } from \"./commands/update\"\nimport { registerValidateCommand } from \"./commands/validate\"\nimport { registerVerifyCommand } from \"./commands/verify\"\nimport { registerUpdateCheckHook } from \"./self-update/index\"\nimport { handleError } from \"./utils/index\"\n\n// Version injected at build time\ndeclare const __VERSION__: string\nconst version = typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"0.0.0-dev\"\n\nasync function main() {\n\tconst program = new Command()\n\t\t.name(\"ocx\")\n\t\t.description(\"OpenCode Extensions - Install agents, skills, plugins, and commands\")\n\t\t.version(version)\n\n\t// Register all commands using the registration pattern\n\tregisterInitCommand(program)\n\tregisterAddCommand(program)\n\tregisterUpdateCommand(program)\n\tregisterSearchCommand(program)\n\tregisterRegistryCommand(program)\n\tregisterBuildCommand(program)\n\tregisterValidateCommand(program)\n\tregisterSelfCommand(program)\n\n\t// V2: Receipt-based component management\n\tregisterVerifyCommand(program)\n\tregisterRemoveCommand(program)\n\n\t// Migration\n\tregisterMigrateCommand(program)\n\n\t// New top-level commands (Phase 5)\n\tregisterProfileCommand(program)\n\tregisterConfigCommand(program)\n\tregisterOpencodeCommand(program)\n\n\t// Register update check hook (runs after each command)\n\tregisterUpdateCheckHook(program)\n\n\t// Parse and handle errors\n\tawait program.parseAsync(process.argv)\n}\n\n// Only run CLI when executed directly, not when imported as a library\nif (import.meta.main) {\n\tmain().catch((err) => {\n\t\thandleError(err)\n\t})\n}\n\n// Library exports - for programmatic use\nexport { type BuildRegistryOptions, type BuildRegistryResult, buildRegistry } from \"./lib/index\"\n\n// Schema exports - for validation\nexport {\n\ttype ComponentManifest,\n\tcomponentManifestSchema,\n\ttype OcxConfig,\n\ttype OcxLock,\n\t// Config schemas\n\tocxConfigSchema,\n\tocxLockSchema,\n\ttype Packument,\n\tpackumentSchema,\n\ttype Registry,\n\t// Registry schemas\n\tregistrySchema,\n} from \"./schemas/index\"\n"
137
- ],
138
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA,MAAM,uBAAuB,MAAM;AAAA,IAOjC,WAAW,CAAC,UAAU,MAAM,SAAS;AAAA,MACnC,MAAM,OAAO;AAAA,MAEb,MAAM,kBAAkB,MAAM,KAAK,WAAW;AAAA,MAC9C,KAAK,OAAO,KAAK,YAAY;AAAA,MAC7B,KAAK,OAAO;AAAA,MACZ,KAAK,WAAW;AAAA,MAChB,KAAK,cAAc;AAAA;AAAA,EAEvB;AAAA;AAAA,EAKA,MAAM,6BAA6B,eAAe;AAAA,IAKhD,WAAW,CAAC,SAAS;AAAA,MACnB,MAAM,GAAG,6BAA6B,OAAO;AAAA,MAE7C,MAAM,kBAAkB,MAAM,KAAK,WAAW;AAAA,MAC9C,KAAK,OAAO,KAAK,YAAY;AAAA;AAAA,EAEjC;AAAA,EAEQ,yBAAiB;AAAA,EACjB,+BAAuB;AAAA;;;;ECtC/B,MAAQ;AAAA;AAAA,EAER,MAAM,SAAS;AAAA,IAUb,WAAW,CA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