simple-scaffold 2.3.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold-Ce-rIwy9.js","names":["AsyncLocalStorage","AsyncResource","AsyncResource","process","NO_TRUNCATION","fastStringTruncatedWidth","ESC","stringWidth","#isTTY","#destSrc","#proxy","process","#process","#sigListeners","#emitter","#hupSig","#originalProcessReallyExit","#originalProcessEmit","#loaded","#processEmit","#processReallyExit","MuteStream","readline","onSignalExit","AsyncResource"],"sources":["../src/colors.ts","../src/utils.ts","../src/types.ts","../__vite-browser-external","../src/logger.ts","../src/parser.ts","../src/fs-utils.ts","../src/path-utils.ts","../src/file.ts","../src/git.ts","../src/before-write.ts","../src/config.ts","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/key.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/errors.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/hook-engine.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/use-state.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/use-effect.js","../node_modules/.pnpm/@inquirer+figures@2.0.4/node_modules/@inquirer/figures/dist/index.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/theme.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/make-theme.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/use-prefix.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/use-memo.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/use-ref.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/use-keypress.js","../node_modules/.pnpm/cli-width@4.1.0/node_modules/cli-width/index.js","../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js","../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js","../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js","../node_modules/.pnpm/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/utils.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js","../node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js","../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js","../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js","../node_modules/.pnpm/@inquirer+ansi@2.0.4/node_modules/@inquirer/ansi/dist/index.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/screen-manager.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/create-prompt.js","../node_modules/.pnpm/@inquirer+core@11.1.7_@types+node@25.5.0/node_modules/@inquirer/core/dist/lib/Separator.js","../node_modules/.pnpm/@inquirer+input@5.0.10_@types+node@25.5.0/node_modules/@inquirer/input/dist/index.js","../node_modules/.pnpm/@inquirer+select@5.1.2_@types+node@25.5.0/node_modules/@inquirer/select/dist/index.js","../src/prompts.ts","../src/scaffold.ts"],"sourcesContent":["/** ANSI color code mapping for terminal output. */\nconst colorMap = {\n reset: 0,\n dim: 2,\n bold: 1,\n italic: 3,\n underline: 4,\n red: 31,\n green: 32,\n yellow: 33,\n blue: 34,\n magenta: 35,\n cyan: 36,\n white: 37,\n gray: 90,\n} as const\n\n/** Available terminal color names. */\nexport type TermColor = keyof typeof colorMap\n\nfunction _colorize(text: string, color: TermColor): string {\n const c = colorMap[color]!\n let r = 0\n\n if (c > 1 && c < 30) {\n r = c + 20\n } else if (c === 1) {\n r = 23\n } else {\n r = 0\n }\n\n return `\\x1b[${c}m${text}\\x1b[${r}m`\n}\n\nfunction isTemplateStringArray(template: TemplateStringsArray | unknown): template is TemplateStringsArray {\n return Array.isArray(template) && typeof template[0] === \"string\"\n}\n\nconst createColorize =\n (color: TermColor) =>\n (template: TemplateStringsArray | unknown, ...params: unknown[]): string => {\n return isTemplateStringArray(template)\n ? _colorize(\n (template as TemplateStringsArray).reduce((acc, str, i) => acc + str + (params[i] ?? \"\"), \"\"),\n color,\n )\n : _colorize(String(template), color)\n }\n\ntype TemplateStringsFn = ReturnType<typeof createColorize> & ((text: string) => string)\ntype TemplateStringsFns = { [key in TermColor]: TemplateStringsFn }\n\n/**\n * Colorize text for terminal output.\n *\n * Can be used as a function: `colorize(\"text\", \"red\")`\n * Or via named helpers: `colorize.red(\"text\")` / `colorize.red\\`template\\``\n */\nexport const colorize: typeof _colorize & TemplateStringsFns = Object.assign(\n _colorize,\n Object.entries(colorMap).reduce(\n (acc, [key]) => {\n acc[key as TermColor] = createColorize(key as TermColor)\n return acc\n },\n {} as Record<TermColor, TemplateStringsFn>,\n ),\n)\n","import { Resolver } from \"./types\"\n\n// Re-export colors for backward compatibility\nexport { colorize, type TermColor } from \"./colors\"\n\n/** Throws the error if non-null, no-ops otherwise. */\nexport function handleErr(err: NodeJS.ErrnoException | null): void {\n if (err) throw err\n}\n\n/** Resolves a value that may be either a static value or a function that produces one. */\nexport function resolve<T, R = T>(resolver: Resolver<T, R>, arg: T): R {\n return typeof resolver === \"function\" ? (resolver as (value: T) => R)(arg) : (resolver as R)\n}\n\n/** Wraps a static value in a resolver function. If already a function, returns as-is. */\nexport function wrapNoopResolver<T, R = T>(value: Resolver<T, R>): Resolver<T, R> {\n if (typeof value === \"function\") {\n return value\n }\n\n return (_) => value\n}\n","import { HelperDelegate } from \"handlebars/runtime\"\n\n/**\n * The config object for defining a scaffolding group.\n *\n * @see {@link https://chenasraf.github.io/simple-scaffold/docs/usage/node| Node.js usage}\n * @see {@link https://chenasraf.github.io/simple-scaffold/docs/usage/cli| CLI usage}\n * @see {@link DefaultHelpers}\n * @see {@link CaseHelpers}\n * @see {@link DateHelpers}\n *\n * @category Config\n */\nexport interface ScaffoldConfig {\n /**\n * Name to be passed to the generated files. `{{name}}` and `{{Name}}` inside contents and file names will be replaced\n * accordingly.\n */\n name: string\n\n /**\n * Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path,\n * or a glob pattern for multiple file matching easily.\n *\n * You may omit files from output by prepending a `!` to their glob pattern.\n *\n * For example, `[\"components/**\", \"!components/README.md\"]` will include everything in the directory `components`\n * except the `README.md` file inside.\n *\n * @default Current working directory\n */\n templates: string[]\n\n /**\n * Path to output to. If `subdir` is `true`, the subdir will be created inside this path.\n *\n * May also be a {@link FileResponseHandler} which returns a new output path to override the default one.\n *\n * @see {@link FileResponse}\n * @see {@link FileResponseHandler}\n */\n output: FileResponse<string>\n\n /**\n * Whether to create subdir with the input name.\n *\n * When `true`, you may also use {@link subdirHelper} to determine a pre-process helper on\n * the directory name.\n *\n * @default `false`\n */\n subdir?: boolean\n\n /**\n * Add custom data to the templates. By default, only your app name is included as `{{name}}` and `{{Name}}`.\n *\n * This can be any object that will be usable by Handlebars.\n */\n data?: Record<string, unknown>\n\n /**\n * Enable to override output files, even if they already exist.\n *\n * You may supply a function to this option, which can take the arguments `(fullPath, baseDir, baseName)` and returns\n * a boolean for each file.\n *\n * May also be a {@link FileResponseHandler} which returns a boolean value per file.\n *\n * @see {@link FileResponse}\n * @see {@link FileResponseHandler}\n *\n * @default `false`\n */\n overwrite?: FileResponse<boolean>\n\n /**\n * Determine amount of logs to display.\n *\n * The values are: `0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`. The provided level will display messages\n * of the same level or higher.\n *\n * @see {@link LogLevel}\n *\n * @default `2 (info)`\n */\n logLevel?: LogLevel\n\n /**\n * Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write\n * actual file contents or create directories.\n *\n * @default `false`\n */\n dryRun?: boolean\n\n /**\n * Additional helpers to add to the template parser. Provide an object whose keys are the name of the function to add,\n * and the value is the helper function itself. The signature of helpers is as follows:\n * ```typescript\n * (text: string, ...args: any[]) => string\n * ```\n *\n * A full example might be:\n *\n * ```typescript\n * Scaffold({\n * //...\n * helpers: {\n * upperKebabCase: (text) => kebabCase(text).toUpperCase()\n * }\n * })\n * ```\n *\n * Which will allow:\n *\n * ```\n * {{ upperKebabCase \"my value\" }}\n * ```\n *\n * To transform to:\n *\n * ```\n * MY-VALUE\n * ```\n *\n * See {@link DefaultHelpers} for a list of all the built-in available helpers.\n *\n * Simple Scaffold uses Handlebars.js, so all the syntax from there is supported. See\n * [their docs](https://handlebarsjs.com/guide/#custom-helpers) for more information.\n *\n * @see {@link DefaultHelpers}\n * @see {@link CaseHelpers}\n * @see {@link DateHelpers}\n * @see {@link https://chenasraf.github.io/simple-scaffold/docs/usage/templates| Templates}\n * */\n helpers?: Record<string, Helper>\n\n /**\n * Default transformer to apply to subdir name when using `subdir: true`. Can be one of the default\n * capitalization helpers, or a custom one you provide to `helpers`. Defaults to `undefined`, which means no\n * transformation is done.\n *\n * @see {@link subdir}\n * @see {@link CaseHelpers}\n * @see {@link DefaultHelpers}\n */\n subdirHelper?: DefaultHelpers | string\n\n /**\n * This callback runs right before content is being written to the disk. If you supply this function, you may return\n * a string that represents the final content of your file, you may process the content as you see fit. For example,\n * you may run formatters on a file, fix output in edge-cases not supported by helpers or data, etc.\n *\n * If the return value of this function is `undefined`, the original content will be used.\n *\n * @param content The original template after token replacement\n * @param rawContent The original template before token replacement\n * @param outputPath The final output path of the processed file\n *\n * @returns {Promise<String | Buffer | undefined> | String | Buffer | undefined} The final output of the file\n * contents-only, after further modifications - or `undefined` to use the original content (i.e. `content.toString()`)\n */\n beforeWrite?(\n content: Buffer,\n rawContent: Buffer,\n outputPath: string,\n ): string | Buffer | undefined | Promise<string | Buffer | undefined>\n\n /**\n * Defines interactive inputs for the template. Each input becomes a template data variable.\n *\n * When running interactively, required inputs that are not already provided via `data` or CLI args\n * will be prompted for. Optional inputs without a value will use their `default` if defined.\n *\n * @example\n * ```typescript\n * Scaffold({\n * // ...\n * inputs: {\n * author: { message: \"Author name\", required: true },\n * license: { message: \"License\", default: \"MIT\" },\n * },\n * })\n * ```\n *\n * In templates: `{{ author }}`, `{{ license }}`\n *\n * @see {@link ScaffoldInput}\n */\n inputs?: Record<string, ScaffoldInput>\n\n /** @internal */\n tmpDir?: string\n}\n\n/**\n * Defines a single interactive input for a scaffold template.\n *\n * @category Config\n */\nexport interface ScaffoldInput {\n /** The prompt message shown to the user. Defaults to the input key name if omitted. */\n message?: string\n /** Whether this input must be provided. If true and missing, the user will be prompted interactively. */\n required?: boolean\n /** Default value used when the user doesn't provide one. */\n default?: string\n}\n\n/**\n * The names of the available helper functions that relate to text capitalization.\n *\n * These are available for `subdirHelper`.\n *\n * | Helper name | Example code | Example output |\n * | ------------ | ----------------------- | -------------- |\n * | [None] | `{{ name }}` | my name |\n * | `camelCase` | `{{ camelCase name }}` | myName |\n * | `snakeCase` | `{{ snakeCase name }}` | my_name |\n * | `startCase` | `{{ startCase name }}` | My Name |\n * | `kebabCase` | `{{ kebabCase name }}` | my-name |\n * | `hyphenCase` | `{{ hyphenCase name }}` | my-name |\n * | `pascalCase` | `{{ pascalCase name }}` | MyName |\n * | `upperCase` | `{{ upperCase name }}` | MY NAME |\n * | `lowerCase` | `{{ lowerCase name }}` | my name |\n *\n * @see {@link DefaultHelpers}\n * @see {@link DateHelpers}\n * @see {@link ScaffoldConfig}\n * @see {@link ScaffoldConfig.subdirHelper}\n *\n * @category Helpers\n */\nexport type CaseHelpers =\n | \"camelCase\"\n | \"hyphenCase\"\n | \"kebabCase\"\n | \"lowerCase\"\n | \"pascalCase\"\n | \"snakeCase\"\n | \"startCase\"\n | \"upperCase\"\n\n/**\n * The names of the available helper functions that relate to dates.\n *\n * | Helper name | Description | Example code | Example output |\n * | -------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------ |\n * | `now` | Current date with format | `{{ now \"yyyy-MM-dd HH:mm\" }}` | `2042-01-01 15:00` |\n * | `now` (with offset) | Current date with format, and with offset | `{{ now \"yyyy-MM-dd HH:mm\" -1 \"hours\" }}` | `2042-01-01 14:00` |\n * | `date` | Custom date with format | `{{ date \"2042-01-01T15:00:00Z\" \"yyyy-MM-dd HH:mm\" }}` | `2042-01-01 15:00` |\n * | `date` (with offset) | Custom date with format, and with offset | `{{ date \"2042-01-01T15:00:00Z\" \"yyyy-MM-dd HH:mm\" -1 \"days\" }}` | `2041-31-12 15:00` |\n * | `date` (with date from `--data`) | Custom date with format, with data from the `data` config option | `{{ date myCustomDate \"yyyy-MM-dd HH:mm\" }}` | `2042-01-01 12:00` |\n *\n * Further details:\n *\n * - We use [`date-fns`](https://date-fns.org/docs/) for parsing/manipulating the dates. If you want\n * more information on the date tokens to use, refer to\n * [their format documentation](https://date-fns.org/docs/format).\n *\n * - The date helper format takes the following arguments:\n *\n * ```typescript\n * (\n * date: string,\n * format: string,\n * offsetAmount?: number,\n * offsetType?: \"years\" | \"months\" | \"weeks\" | \"days\" | \"hours\" | \"minutes\" | \"seconds\"\n * )\n * ```\n *\n * - **The now helper** (for current time) takes the same arguments, minus the first one (`date`) as it is implicitly\n * the current date.\n *\n * @see {@link DefaultHelpers}\n * @see {@link CaseHelpers}\n * @see {@link ScaffoldConfig}\n *\n * @category Helpers\n */\nexport type DateHelpers = \"date\" | \"now\"\n\n/**\n * The names of all the available helper functions in templates.\n * Simple-Scaffold provides some built-in text transformation filters usable by Handlebars.js.\n *\n * For example, you may use `{{ snakeCase name }}` inside a template file or filename, and it will\n * replace `My Name` with `my_name` when producing the final value.\n *\n * @see {@link CaseHelpers}\n * @see {@link DateHelpers}\n * @see {@link ScaffoldConfig}\n *\n * @category Helpers\n */\nexport type DefaultHelpers = CaseHelpers | DateHelpers\n\n/**\n * Helper function, see https://handlebarsjs.com/guide/#custom-helpers\n *\n * @category Helpers\n */\nexport type Helper = HelperDelegate\n\n/**\n * The amount of information to log when generating scaffold.\n * When not `none`, the selected level will be the lowest level included.\n *\n * For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only\n * show `warning` and `error`, but not `info` or `debug`.\n *\n * @default `info`\n *\n * @category Logging (const)\n */\n\nexport const LogLevel = {\n /** Silent output */\n none: \"none\",\n /** Debugging information. Very verbose and only recommended for troubleshooting. */\n debug: \"debug\",\n /**\n * The regular level of logging. Major actions are logged to show the scaffold progress.\n *\n * @default\n */\n info: \"info\",\n /** Warnings such as when file fails to replace token values properly in template. */\n warning: \"warning\",\n /** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */\n error: \"error\",\n} as const\n\n/**\n * The amount of information to log when generating scaffold.\n * When not `none`, the selected level will be the lowest level included.\n *\n * For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only\n * show `warning` and `error`, but not `info` or `debug`.\n *\n * @default `info`\n *\n * @category Logging (type)\n */\nexport type LogLevel = (typeof LogLevel)[keyof typeof LogLevel]\n\n/**\n * A function that takes path information about file, and returns a value of type `T`\n *\n * @template T The return type for the function\n * @param {string} fullPath The full path of the current file\n * @param {string} basedir The directory containing the current file\n * @param {string} basename The name of the file\n *\n * @returns {T} A return value\n *\n * @category Config\n */\nexport type FileResponseHandler<T> = (fullPath: string, basedir: string, basename: string) => T\n\n/**\n * Represents a response for file path information.\n * Can either be:\n *\n * 1. `T` - static value\n * 2. A function with the following signature which returns `T`:\n * ```typescript\n * (fullPath: string, basedir: string, basename: string) => T\n * ```\n *\n * @see {@link FileResponseHandler}\n *\n * @category Config\n * */\nexport type FileResponse<T> = T | FileResponseHandler<T>\n\n/**\n * The Scaffold config for CLI\n * Contains less and more specific options than {@link ScaffoldConfig}.\n *\n * For more information about each option, see {@link ScaffoldConfig}.\n */\nexport type ScaffoldCmdConfig = {\n /** The name of the scaffold template to use. */\n name: string\n /** The templates to use for generation */\n templates: string[]\n /** The output path to write to */\n output: string\n /** Whether to create subdir with the input name */\n subdir: boolean\n /** Default transformer to apply to subdir name when using `subdir: true` */\n subdirHelper?: string\n /** Add custom data to the templates */\n data?: Record<string, string>\n /** Add custom data to the template in a CLI-friendly syntax (and not JSON) */\n appendData?: Record<string, string>\n /** Enable to override output files, even if they already exist */\n overwrite: boolean\n /** Silence logs, same as `logLevel: \"none\"` */\n quiet: boolean\n /**\n * Determine amount of logs to display.\n *\n * @see {@link LogLevel}\n */\n logLevel: LogLevel\n /** Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write actual file contents or create directories. */\n dryRun: boolean\n /** Config file path to use */\n config?: string\n /** The key of the template to use */\n key?: string\n /** The git repository to use to fetch the config file */\n git?: string\n /** Display version */\n version: boolean\n /** Run a script before writing the files. This can be a command or a path to a file. The file contents will be passed to the given command. */\n beforeWrite?: string\n /** @internal */\n tmpDir?: string\n}\n\n/**\n * A mapping of scaffold template keys to their configurations.\n *\n * Each configuration is a {@link ScaffoldConfig} object.\n *\n * The key is the name of the template, and the value is the configuration for that template.\n *\n * When no template key is provided to the scaffold command, the \"default\" template is used.\n *\n * @see {@link ScaffoldConfig}\n *\n * @category Config\n */\nexport type ScaffoldConfigMap = Record<string, ScaffoldConfig>\n\n/**\n * The scaffold config file is either:\n * - A {@link ScaffoldConfigMap} object\n * - A function that returns a {@link ScaffoldConfigMap} object\n * - A promise that resolves to a {@link ScaffoldConfigMap} object\n * - A function that returns a promise that resolves to a {@link ScaffoldConfigMap} object\n *\n * @category Config\n */\nexport type ScaffoldConfigFile = AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>\n\n/** @internal */\nexport type Resolver<T, R = T> = R | ((_value: T) => R)\n\n/** @internal */\nexport type AsyncResolver<T, R = T> = Resolver<T, Promise<R> | R>\n\n/** @internal */\nexport type LogConfig = Pick<ScaffoldConfig, \"logLevel\">\n\n/** @internal */\nexport type ConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, \"config\">\n\n/** @internal */\nexport type RemoteConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, \"config\" | \"git\" | \"tmpDir\">\n\n/** @internal */\nexport type MinimalConfig = Pick<ScaffoldCmdConfig, \"name\" | \"key\">\n\n/** @internal */\nexport type ListCommandCliOptions = Pick<ScaffoldCmdConfig, \"config\" | \"git\" | \"logLevel\" | \"quiet\">\n","module.exports = {}","import util from \"util\"\nimport { LogConfig, LogLevel, ScaffoldConfig } from \"./types\"\nimport { colorize, TermColor } from \"./colors\"\n\n/** Priority ordering for log levels (higher = more severe). */\nconst LOG_PRIORITY: Record<LogLevel, number> = {\n [LogLevel.none]: 0,\n [LogLevel.debug]: 1,\n [LogLevel.info]: 2,\n [LogLevel.warning]: 3,\n [LogLevel.error]: 4,\n}\n\n/** Maps each log level to a terminal color. */\nconst LOG_LEVEL_COLOR: Record<LogLevel, TermColor> = {\n [LogLevel.none]: \"reset\",\n [LogLevel.debug]: \"blue\",\n [LogLevel.info]: \"dim\",\n [LogLevel.warning]: \"yellow\",\n [LogLevel.error]: \"red\",\n}\n\n/** Logs a message at the given level, respecting the configured log level filter. */\nexport function log(config: LogConfig, level: LogLevel, ...obj: unknown[]): void {\n if (config.logLevel === LogLevel.none || LOG_PRIORITY[level] < LOG_PRIORITY[config.logLevel ?? LogLevel.info]) {\n return\n }\n\n const colorFn = colorize[LOG_LEVEL_COLOR[level]]\n const key: \"log\" | \"warn\" | \"error\" = level === LogLevel.error ? \"error\" : level === LogLevel.warning ? \"warn\" : \"log\"\n const logFn: (..._args: unknown[]) => void = console[key]\n logFn(\n ...obj.map((i) =>\n i instanceof Error\n ? colorFn(i, JSON.stringify(i, undefined, 1), i.stack)\n : typeof i === \"object\"\n ? util.inspect(i, { depth: null, colors: true })\n : colorFn(i),\n ),\n )\n}\n\n/**\n * Logs detailed file processing information at debug level.\n * @deprecated Use `log(config, LogLevel.debug, data)` directly instead.\n */\nexport function logInputFile(\n config: ScaffoldConfig,\n data: {\n originalTemplate: string\n relativePath: string\n parsedTemplate: string\n inputFilePath: string\n nonGlobTemplate: string\n basePath: string\n isDirOrGlob: boolean\n isGlob: boolean\n },\n): void {\n log(config, LogLevel.debug, data)\n}\n\n/** Logs the full scaffold configuration at debug level, with a data summary at info level. */\nexport function logInitStep(config: ScaffoldConfig): void {\n log(config, LogLevel.debug, \"Full config:\", {\n name: config.name,\n templates: config.templates,\n output: config.output,\n subdir: config.subdir,\n data: config.data,\n overwrite: config.overwrite,\n subdirHelper: config.subdirHelper,\n helpers: Object.keys(config.helpers ?? {}),\n logLevel: config.logLevel,\n dryRun: config.dryRun,\n beforeWrite: config.beforeWrite,\n } as Record<keyof ScaffoldConfig, unknown>)\n log(config, LogLevel.info, \"Data:\", config.data)\n}\n","import path from \"node:path\"\nimport { DefaultHelpers, Helper, LogLevel, ScaffoldConfig } from \"./types\"\nimport Handlebars from \"handlebars\"\nimport { add, format, parseISO, type Duration } from \"date-fns\"\nimport { log } from \"./logger\"\n\nconst dateFns = { add, format, parseISO }\n\nexport const defaultHelpers: Record<DefaultHelpers, Helper> = {\n camelCase,\n snakeCase,\n startCase,\n kebabCase,\n hyphenCase: kebabCase,\n pascalCase,\n lowerCase: (text) => text.toLowerCase(),\n upperCase: (text) => text.toUpperCase(),\n now: nowHelper,\n date: dateHelper,\n}\n\nfunction _dateHelper(date: Date, formatString: string): string\nfunction _dateHelper(date: Date, formatString: string, durationDifference: number, durationType: keyof Duration): string\nfunction _dateHelper(\n date: Date,\n formatString: string,\n durationDifference?: number,\n durationType?: keyof Duration,\n): string {\n if (durationType && durationDifference !== undefined) {\n return dateFns.format(dateFns.add(date, { [durationType]: durationDifference }), formatString)\n }\n return dateFns.format(date, formatString)\n}\n\nexport function nowHelper(formatString: string): string\nexport function nowHelper(formatString: string, durationDifference: number, durationType: keyof Duration): string\nexport function nowHelper(formatString: string, durationDifference?: number, durationType?: keyof Duration): string {\n return _dateHelper(new Date(), formatString, durationDifference!, durationType!)\n}\n\nexport function dateHelper(date: string, formatString: string): string\nexport function dateHelper(\n date: string,\n formatString: string,\n durationDifference: number,\n durationType: keyof Duration,\n): string\nexport function dateHelper(\n date: string,\n formatString: string,\n durationDifference?: number,\n durationType?: keyof Duration,\n): string {\n return _dateHelper(dateFns.parseISO(date), formatString, durationDifference!, durationType!)\n}\n\n// splits by either non-alphanumeric character or capital letter boundaries\nfunction toWordParts(string: string): string[] {\n // First split on non-alphanumeric characters\n return string\n .split(/[^a-zA-Z0-9]/)\n .flatMap((segment) =>\n // Then split camelCase/PascalCase boundaries, handling consecutive uppercase (e.g. \"HTMLParser\" -> \"HTML\", \"Parser\")\n segment.split(/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/)\n )\n .filter((s) => s.length > 0)\n}\n\nfunction camelCase(s: string): string {\n return toWordParts(s).reduce((acc, part, i) => {\n if (i === 0) {\n return part.toLowerCase()\n }\n return acc + part[0].toUpperCase() + part.slice(1).toLowerCase()\n }, \"\")\n}\n\nfunction snakeCase(s: string): string {\n return toWordParts(s).join(\"_\").toLowerCase()\n}\n\nfunction kebabCase(s: string): string {\n return toWordParts(s).join(\"-\").toLowerCase()\n}\n\nfunction startCase(s: string): string {\n return toWordParts(s)\n .map((part) => part[0].toUpperCase() + part.slice(1).toLowerCase())\n .join(\" \")\n}\n\nfunction pascalCase(s: string): string {\n return startCase(s).replace(/\\s+/g, \"\")\n}\n\nexport function registerHelpers(config: ScaffoldConfig): void {\n const _helpers = { ...defaultHelpers, ...config.helpers }\n for (const helperName in _helpers) {\n log(config, LogLevel.debug, `Registering helper: ${helperName}`)\n Handlebars.registerHelper(helperName, _helpers[helperName as keyof typeof _helpers])\n }\n}\n\nexport function handlebarsParse(\n config: ScaffoldConfig,\n templateBuffer: Buffer | string,\n { asPath = false }: { asPath?: boolean } = {},\n): Buffer {\n const { data } = config\n try {\n let str = templateBuffer.toString()\n if (asPath) {\n str = str.replace(/\\\\/g, \"/\")\n }\n const parser = Handlebars.compile(str, { noEscape: true })\n let outputContents = parser(data)\n if (asPath && path.sep !== \"/\") {\n outputContents = outputContents.replace(/\\//g, \"\\\\\")\n }\n return Buffer.from(outputContents)\n } catch (e) {\n log(config, LogLevel.debug, e)\n log(config, LogLevel.info, \"Couldn't parse file with handlebars, returning original content\")\n return Buffer.from(templateBuffer)\n }\n}\n","import os from \"node:os\"\nimport path from \"node:path\"\nimport fs from \"node:fs/promises\"\nimport { F_OK } from \"node:constants\"\nimport { LogConfig, LogLevel, ScaffoldConfig } from \"./types\"\nimport { log } from \"./logger\"\n\nconst { stat, access, mkdir } = fs\n\n/** Recursively creates a directory and its parents if they don't exist. */\nexport async function createDirIfNotExists(\n dir: string,\n config: LogConfig & Pick<ScaffoldConfig, \"dryRun\">,\n): Promise<void> {\n if (config.dryRun) {\n log(config, LogLevel.info, `Dry Run. Not creating dir ${dir}`)\n return\n }\n const parentDir = path.dirname(dir)\n\n if (!(await pathExists(parentDir))) {\n await createDirIfNotExists(parentDir, config)\n }\n\n if (!(await pathExists(dir))) {\n try {\n log(config, LogLevel.debug, `Creating dir ${dir}`)\n await mkdir(dir)\n return\n } catch (e: unknown) {\n if (e && (e as NodeJS.ErrnoException).code !== \"EEXIST\") {\n throw e\n }\n return\n }\n }\n}\n\n/** Checks whether a file or directory exists at the given path. */\nexport async function pathExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath, F_OK)\n return true\n } catch (e: unknown) {\n if (e && (e as NodeJS.ErrnoException).code === \"ENOENT\") {\n return false\n }\n throw e\n }\n}\n\n/** Returns true if the given path is a directory. */\nexport async function isDir(dirPath: string): Promise<boolean> {\n const tplStat = await stat(dirPath)\n return tplStat.isDirectory()\n}\n\n/** Generates a unique temporary directory path for scaffold operations. @internal */\nexport function getUniqueTmpPath(): string {\n return path.resolve(os.tmpdir(), `scaffold-config-${Date.now()}-${Math.random().toString(36).slice(2)}`)\n}\n","import path from \"node:path\"\n\n/** Strips glob wildcard characters from a template path. */\nexport function removeGlob(template: string): string {\n return path.normalize(template.replace(/\\*/g, \"\"))\n}\n\n/** Removes a leading path separator, making the path relative. */\nexport function makeRelativePath(str: string): string {\n return str.startsWith(path.sep) ? str.slice(1) : str\n}\n\n/** Computes a base path relative to the current working directory. */\nexport function getBasePath(relPath: string): string {\n return path\n .resolve(process.cwd(), relPath)\n .replace(process.cwd() + path.sep, \"\")\n .replace(process.cwd(), \"\")\n}\n","import path from \"node:path\"\nimport fs from \"node:fs/promises\"\nimport { FileResponse, FileResponseHandler, LogLevel, ScaffoldConfig } from \"./types\"\nimport { glob, hasMagic } from \"glob\"\nimport { log } from \"./logger\"\nimport { handlebarsParse } from \"./parser\"\nimport { handleErr } from \"./utils\"\nimport { createDirIfNotExists, pathExists, isDir } from \"./fs-utils\"\nimport { removeGlob } from \"./path-utils\"\n\nconst { readFile, writeFile } = fs\n\n// Re-export extracted utilities for backward compatibility (tests import from here)\nexport { createDirIfNotExists, pathExists, isDir, getUniqueTmpPath } from \"./fs-utils\"\nexport { removeGlob, makeRelativePath, getBasePath } from \"./path-utils\"\n\n/**\n * Resolves a config option that may be either a static value or a per-file function.\n * For function values, the file path is parsed through Handlebars before being passed.\n * @internal\n */\nexport function getOptionValueForFile<T>(\n config: ScaffoldConfig,\n filePath: string,\n fn: FileResponse<T>,\n defaultValue?: T,\n): T {\n if (typeof fn !== \"function\") {\n return defaultValue ?? (fn as T)\n }\n return (fn as FileResponseHandler<T>)(\n filePath,\n path.dirname(handlebarsParse(config, filePath, { asPath: true }).toString()),\n path.basename(handlebarsParse(config, filePath, { asPath: true }).toString()),\n )\n}\n\n/** Information about a template glob pattern and how it was resolved. */\nexport interface GlobInfo {\n /** The template path with glob wildcards stripped. */\n baseTemplatePath: string\n /** The original template string as provided by the user. */\n origTemplate: string\n /** Whether the template is a directory or contains glob patterns. */\n isDirOrGlob: boolean\n /** Whether the template contains glob wildcard characters. */\n isGlob: boolean\n /** The final resolved template path (with `**\\/*` appended for directories). */\n template: string\n}\n\n/** Expands a list of glob patterns into a flat list of matching file paths. */\nexport async function getFileList(config: ScaffoldConfig, templates: string[]): Promise<string[]> {\n log(config, LogLevel.debug, `Getting file list for glob list: ${templates}`)\n return (\n await glob(templates, {\n dot: true,\n nodir: true,\n })\n ).map(path.normalize)\n}\n\n/** Analyzes a template path to determine if it's a glob, directory, or single file. */\nexport async function getTemplateGlobInfo(config: ScaffoldConfig, template: string): Promise<GlobInfo> {\n const _isGlob = hasMagic(template)\n log(config, LogLevel.debug, \"before isDir\", \"isGlob:\", _isGlob, template)\n\n let resolvedTemplate = template\n let baseTemplatePath = _isGlob ? removeGlob(template) : template\n baseTemplatePath = path.normalize(baseTemplatePath)\n const isDirOrGlob = _isGlob ? true : await isDir(template)\n const shouldAddGlob = !_isGlob && isDirOrGlob\n log(config, LogLevel.debug, \"after\", { isDirOrGlob, shouldAddGlob })\n\n if (shouldAddGlob) {\n resolvedTemplate = path.join(template, \"**\", \"*\")\n }\n return { baseTemplatePath, origTemplate: template, isDirOrGlob, isGlob: _isGlob, template: resolvedTemplate }\n}\n\n/** Complete information about a template file's output destination. */\nexport interface OutputFileInfo {\n inputPath: string\n outputPathOpt: string\n outputDir: string\n outputPath: string\n exists: boolean\n}\n\n/** Computes the full output path and metadata for a single template file. */\nexport async function getTemplateFileInfo(\n config: ScaffoldConfig,\n { templatePath, basePath }: { templatePath: string; basePath: string },\n): Promise<OutputFileInfo> {\n const inputPath = path.resolve(process.cwd(), templatePath)\n const outputPathOpt = getOptionValueForFile(config, inputPath, config.output)\n const outputDir = getOutputDir(config, outputPathOpt, basePath.replace(config.tmpDir!, \"./\"))\n const rawOutputPath = path.join(outputDir, path.basename(inputPath))\n const outputPath = handlebarsParse(config, rawOutputPath, { asPath: true }).toString()\n const exists = await pathExists(outputPath)\n return { inputPath, outputPathOpt, outputDir, outputPath, exists }\n}\n\n/**\n * Reads a template file, applies Handlebars parsing, runs the beforeWrite hook,\n * and writes the result to the output path.\n */\nexport async function copyFileTransformed(\n config: ScaffoldConfig,\n {\n exists,\n overwrite,\n outputPath,\n inputPath,\n }: {\n exists: boolean\n overwrite: boolean\n outputPath: string\n inputPath: string\n },\n): Promise<void> {\n if (!exists || overwrite) {\n if (exists && overwrite) {\n log(config, LogLevel.info, `File ${outputPath} exists, overwriting`)\n }\n log(config, LogLevel.debug, `Processing file ${inputPath}`)\n const templateBuffer = await readFile(inputPath)\n const unprocessedOutputContents = handlebarsParse(config, templateBuffer)\n const finalOutputContents =\n (await config.beforeWrite?.(unprocessedOutputContents, templateBuffer, outputPath)) ?? unprocessedOutputContents\n\n if (!config.dryRun) {\n await writeFile(outputPath, finalOutputContents)\n } else {\n log(config, LogLevel.info, \"Dry Run. Output should be:\")\n log(config, LogLevel.info, finalOutputContents.toString())\n }\n } else if (exists) {\n log(config, LogLevel.info, `File ${outputPath} already exists, skipping`)\n }\n log(config, LogLevel.info, \"Done.\")\n}\n\n/** Computes the output directory for a file, combining the output path, base path, and optional subdir. */\nexport function getOutputDir(config: ScaffoldConfig, outputPathOpt: string, basePath: string): string {\n return path.resolve(\n process.cwd(),\n ...([\n outputPathOpt,\n basePath,\n config.subdir\n ? config.subdirHelper\n ? handlebarsParse(config, `{{ ${config.subdirHelper} name }}`).toString()\n : config.name\n : undefined,\n ].filter(Boolean) as string[]),\n )\n}\n\n/**\n * Processes a single template file: resolves output paths, creates directories,\n * and writes the transformed output.\n */\nexport async function handleTemplateFile(\n config: ScaffoldConfig,\n { templatePath, basePath }: { templatePath: string; basePath: string },\n): Promise<void> {\n try {\n const { inputPath, outputPathOpt, outputDir, outputPath, exists } = await getTemplateFileInfo(config, {\n templatePath,\n basePath,\n })\n const overwrite = getOptionValueForFile(config, inputPath, config.overwrite ?? false)\n\n log(\n config,\n LogLevel.debug,\n `\\nParsing ${templatePath}`,\n `\\nBase path: ${basePath}`,\n `\\nFull input path: ${inputPath}`,\n `\\nOutput Path Opt: ${outputPathOpt}`,\n `\\nFull output dir: ${outputDir}`,\n `\\nFull output path: ${outputPath}`,\n `\\n`,\n )\n\n await createDirIfNotExists(path.dirname(outputPath), config)\n\n log(config, LogLevel.info, `Writing to ${outputPath}`)\n await copyFileTransformed(config, { exists, overwrite, outputPath, inputPath })\n } catch (e: unknown) {\n handleErr(e as NodeJS.ErrnoException)\n throw e\n }\n}\n","import path from \"node:path\"\nimport { log } from \"./logger\"\nimport { AsyncResolver, LogConfig, LogLevel, ScaffoldCmdConfig, ScaffoldConfigMap } from \"./types\"\nimport { spawn } from \"node:child_process\"\nimport { resolve, wrapNoopResolver } from \"./utils\"\nimport { findConfigFile } from \"./config\"\n\nexport async function getGitConfig(\n url: URL,\n file: string,\n tmpPath: string,\n logConfig: LogConfig,\n): Promise<AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>> {\n const repoUrl = `${url.protocol}//${url.host}${url.pathname}`\n\n log(logConfig, LogLevel.info, `Cloning git repo ${repoUrl}`)\n\n return new Promise((res, reject) => {\n log(logConfig, LogLevel.debug, `Cloning git repo to ${tmpPath}`)\n const clone = spawn(\"git\", [\"clone\", \"--recurse-submodules\", \"--depth\", \"1\", repoUrl, tmpPath])\n\n clone.on(\"error\", reject)\n clone.on(\"close\", async (code) => {\n if (code === 0) {\n res(await loadGitConfig({ logConfig, url: repoUrl, file, tmpPath }))\n return\n }\n\n reject(new Error(`Git clone failed with code ${code}`))\n })\n })\n}\n\n/** @internal */\nexport async function loadGitConfig({\n logConfig,\n url: repoUrl,\n file,\n tmpPath,\n}: {\n logConfig: LogConfig\n url: string\n file: string\n tmpPath: string\n}): Promise<AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>> {\n log(logConfig, LogLevel.info, `Loading config from git repo: ${repoUrl}`)\n const filename = file || (await findConfigFile(tmpPath))\n const absolutePath = path.resolve(tmpPath, filename)\n log(logConfig, LogLevel.debug, `Resolving config file: ${absolutePath}`)\n const loadedConfig = await resolve(async () => (await import(absolutePath)).default as ScaffoldConfigMap, logConfig)\n\n log(logConfig, LogLevel.info, `Loaded config from git`)\n log(logConfig, LogLevel.debug, `Raw config:`, loadedConfig)\n const fixedConfig: ScaffoldConfigMap = {}\n for (const [k, v] of Object.entries(loadedConfig)) {\n fixedConfig[k] = {\n ...v,\n templates: v.templates.map((t) => path.resolve(tmpPath, t)),\n }\n }\n return wrapNoopResolver(fixedConfig)\n}\n","import path from \"node:path\"\nimport fs from \"node:fs/promises\"\nimport { exec } from \"node:child_process\"\nimport { LogConfig, LogLevel, ScaffoldConfig } from \"./types\"\nimport { log } from \"./logger\"\nimport { createDirIfNotExists, getUniqueTmpPath } from \"./fs-utils\"\n\n/**\n * Wraps a CLI beforeWrite command string into a beforeWrite callback function.\n * The command receives the processed content via a temp file and can return modified content via stdout.\n * @internal\n */\nexport function wrapBeforeWrite(\n config: LogConfig & Pick<ScaffoldConfig, \"dryRun\">,\n beforeWrite: string,\n): ScaffoldConfig[\"beforeWrite\"] {\n return async (content, rawContent, outputFile) => {\n const tmpDir = path.join(getUniqueTmpPath(), path.basename(outputFile))\n await createDirIfNotExists(path.dirname(tmpDir), config)\n const ext = path.extname(outputFile)\n const rawTmpPath = tmpDir.replace(ext, \".raw\" + ext)\n try {\n log(config, LogLevel.debug, \"Parsing beforeWrite command\", beforeWrite)\n const cmd = await prepareBeforeWriteCmd({ beforeWrite, tmpDir, content, rawTmpPath, rawContent })\n const result = await new Promise<string | undefined>((resolve, reject) => {\n log(config, LogLevel.debug, \"Running parsed beforeWrite command:\", cmd)\n const proc = exec(cmd)\n proc.stdout!.on(\"data\", (data) => {\n if (data.trim()) {\n resolve(data.toString())\n } else {\n resolve(undefined)\n }\n })\n proc.stderr!.on(\"data\", (data) => {\n reject(data.toString())\n })\n })\n return result\n } catch (e) {\n log(config, LogLevel.debug, e)\n log(config, LogLevel.warning, \"Error running beforeWrite command, returning original content\")\n return undefined\n } finally {\n await fs.rm(tmpDir, { force: true })\n await fs.rm(rawTmpPath, { force: true })\n }\n }\n}\n\nasync function prepareBeforeWriteCmd({\n beforeWrite,\n tmpDir,\n content,\n rawTmpPath,\n rawContent,\n}: {\n beforeWrite: string\n tmpDir: string\n content: Buffer\n rawTmpPath: string\n rawContent: Buffer\n}): Promise<string> {\n let cmd: string = \"\"\n const pathReg = /\\{\\{\\s*path\\s*\\}\\}/gi\n const rawPathReg = /\\{\\{\\s*rawpath\\s*\\}\\}/gi\n if (pathReg.test(beforeWrite)) {\n await fs.writeFile(tmpDir, content)\n cmd = beforeWrite.replaceAll(pathReg, tmpDir)\n }\n if (rawPathReg.test(beforeWrite)) {\n await fs.writeFile(rawTmpPath, rawContent)\n cmd = beforeWrite.replaceAll(rawPathReg, rawTmpPath)\n }\n if (!cmd) {\n await fs.writeFile(tmpDir, content)\n cmd = [beforeWrite, tmpDir].join(\" \")\n }\n return cmd\n}\n","import path from \"node:path\"\nimport {\n ConfigLoadConfig,\n LogConfig,\n LogLevel,\n RemoteConfigLoadConfig,\n ScaffoldCmdConfig,\n ScaffoldConfig,\n ScaffoldConfigFile,\n ScaffoldConfigMap,\n} from \"./types\"\nimport { log } from \"./logger\"\nimport { resolve, wrapNoopResolver } from \"./utils\"\nimport { getGitConfig } from \"./git\"\nimport { isDir, pathExists } from \"./fs-utils\"\nimport { wrapBeforeWrite } from \"./before-write\"\n\n// Re-export for backward compatibility (tests import from here)\nexport { getOptionValueForFile } from \"./file\"\n\n/** Parses CLI append-data syntax (`key=value` or `key:=jsonValue`) into a data object. @internal */\nexport function parseAppendData(value: string, options: ScaffoldCmdConfig): unknown {\n const data = options.data ?? {}\n const [key, val] = value.split(/:?=/)\n if (value.includes(\":=\") && !val.includes(\":=\")) {\n return { ...data, [key]: JSON.parse(val) }\n }\n return { ...data, [key]: isWrappedWithQuotes(val) ? val.substring(1, val.length - 1) : val }\n}\n\nfunction isWrappedWithQuotes(string: string): boolean {\n return (string.startsWith('\"') && string.endsWith('\"')) || (string.startsWith(\"'\") && string.endsWith(\"'\"))\n}\n\n/** Loads and resolves a config file (local or remote). @internal */\nexport async function getConfigFile(config: ScaffoldCmdConfig): Promise<ScaffoldConfigMap> {\n if (config.git && !config.git.includes(\"://\")) {\n log(config, LogLevel.info, `Loading config from GitHub ${config.git}`)\n config.git = githubPartToUrl(config.git)\n }\n\n const isGit = Boolean(config.git)\n const configFilename = config.config\n const configPath = isGit ? config.git : configFilename\n\n log(config, LogLevel.info, `Loading config from file ${configFilename}`)\n\n const configPromise = await (isGit\n ? getRemoteConfig({ git: configPath, config: configFilename, logLevel: config.logLevel, tmpDir: config.tmpDir! })\n : getLocalConfig({ config: configFilename, logLevel: config.logLevel }))\n\n let configImport = await resolve(configPromise, config)\n\n if (typeof configImport.default === \"function\" || configImport.default instanceof Promise) {\n log(config, LogLevel.debug, \"Config is a function or promise, resolving...\")\n configImport = await resolve(configImport.default, config)\n }\n return configImport\n}\n\n/**\n * Parses a CLI config into a full ScaffoldConfig by merging CLI args, config file values,\n * and append-data overrides. @internal\n */\nexport async function parseConfigFile(config: ScaffoldCmdConfig): Promise<ScaffoldConfig> {\n let output: ScaffoldConfig = {\n name: config.name,\n templates: config.templates ?? [],\n output: config.output,\n logLevel: config.logLevel,\n dryRun: config.dryRun,\n data: config.data,\n subdir: config.subdir,\n overwrite: config.overwrite,\n subdirHelper: config.subdirHelper,\n beforeWrite: undefined,\n tmpDir: config.tmpDir!,\n }\n\n if (config.quiet) {\n config.logLevel = LogLevel.none\n }\n\n const shouldLoadConfig = Boolean(config.config || config.git)\n\n if (shouldLoadConfig) {\n const key = config.key ?? \"default\"\n const configImport = await getConfigFile(config)\n\n if (!configImport[key]) {\n throw new Error(`Template \"${key}\" not found in ${config.config}`)\n }\n\n const imported = configImport[key]\n log(config, LogLevel.debug, \"Imported result\", imported)\n output = {\n ...output,\n ...imported,\n beforeWrite: undefined,\n templates: config.templates || imported.templates,\n output: config.output || imported.output,\n data: {\n ...imported.data,\n ...config.data,\n },\n }\n }\n\n output.data = { ...output.data, ...config.appendData }\n const cmdBeforeWrite = config.beforeWrite ? wrapBeforeWrite(config, config.beforeWrite) : undefined\n output.beforeWrite = cmdBeforeWrite ?? output.beforeWrite\n\n if (!output.name) {\n throw new Error(\"simple-scaffold: Missing required option: name\")\n }\n\n log(output, LogLevel.debug, \"Parsed config\", output)\n return output\n}\n\n/** Converts a GitHub shorthand (user/repo) to a full HTTPS git URL. @internal */\nexport function githubPartToUrl(part: string): string {\n const gitUrl = new URL(`https://github.com/${part}`)\n if (!gitUrl.pathname.endsWith(\".git\")) {\n gitUrl.pathname += \".git\"\n }\n return gitUrl.toString()\n}\n\n/** Loads a scaffold config from a local file or directory. @internal */\nexport async function getLocalConfig(config: ConfigLoadConfig & Partial<LogConfig>): Promise<ScaffoldConfigFile> {\n const { config: configFile, ...logConfig } = config as Required<typeof config>\n\n const absolutePath = path.resolve(process.cwd(), configFile)\n\n const _isDir = await isDir(absolutePath)\n\n if (_isDir) {\n log(logConfig, LogLevel.debug, `Resolving config file from directory ${absolutePath}`)\n const file = await findConfigFile(absolutePath)\n const exists = await pathExists(file)\n if (!exists) {\n throw new Error(`Could not find config file in directory ${absolutePath}`)\n }\n log(logConfig, LogLevel.info, `Loading config from: ${path.resolve(absolutePath, file)}`)\n return wrapNoopResolver(import(path.resolve(absolutePath, file)))\n }\n\n log(logConfig, LogLevel.info, `Loading config from: ${absolutePath}`)\n return wrapNoopResolver(import(absolutePath))\n}\n\n/** Loads a scaffold config from a remote git repository. @internal */\nexport async function getRemoteConfig(\n config: RemoteConfigLoadConfig & Partial<LogConfig>,\n): Promise<ScaffoldConfigFile> {\n const { config: configFile, git, tmpDir, ...logConfig } = config as Required<typeof config>\n\n log(logConfig, LogLevel.info, `Loading config from remote ${git}, config file ${configFile || \"<auto-detect>\"}`)\n\n const url = new URL(git!)\n const isHttp = url.protocol === \"http:\" || url.protocol === \"https:\"\n const isGit = url.protocol === \"git:\" || (isHttp && url.pathname.endsWith(\".git\"))\n\n if (!isGit) {\n throw new Error(`Unsupported protocol ${url.protocol}`)\n }\n\n return getGitConfig(url, configFile, tmpDir, logConfig)\n}\n\n/** Searches for a scaffold config file in the given directory, trying known filenames in order. @internal */\nexport async function findConfigFile(root: string): Promise<string> {\n const allowed = [\"mjs\", \"cjs\", \"js\", \"json\"].reduce((acc, ext) => {\n acc.push(`scaffold.config.${ext}`)\n acc.push(`scaffold.${ext}`)\n acc.push(`.scaffold.${ext}`)\n return acc\n }, [] as string[])\n for (const file of allowed) {\n const exists = await pathExists(path.resolve(root, file))\n if (exists) {\n return file\n }\n }\n throw new Error(`Could not find config file in git repo`)\n}\n","export const isUpKey = (key, keybindings = []) => \n// The up key\nkey.name === 'up' ||\n // Vim keybinding: hjkl keys map to left/down/up/right\n (keybindings.includes('vim') && key.name === 'k') ||\n // Emacs keybinding: Ctrl+P means \"previous\" in Emacs navigation conventions\n (keybindings.includes('emacs') && key.ctrl && key.name === 'p');\nexport const isDownKey = (key, keybindings = []) => \n// The down key\nkey.name === 'down' ||\n // Vim keybinding: hjkl keys map to left/down/up/right\n (keybindings.includes('vim') && key.name === 'j') ||\n // Emacs keybinding: Ctrl+N means \"next\" in Emacs navigation conventions\n (keybindings.includes('emacs') && key.ctrl && key.name === 'n');\nexport const isSpaceKey = (key) => key.name === 'space';\nexport const isBackspaceKey = (key) => key.name === 'backspace';\nexport const isTabKey = (key) => key.name === 'tab';\nexport const isNumberKey = (key) => '1234567890'.includes(key.name);\nexport const isEnterKey = (key) => key.name === 'enter' || key.name === 'return';\nexport const isShiftKey = (key) => key.shift;\n","export class AbortPromptError extends Error {\n name = 'AbortPromptError';\n message = 'Prompt was aborted';\n constructor(options) {\n super();\n this.cause = options?.cause;\n }\n}\nexport class CancelPromptError extends Error {\n name = 'CancelPromptError';\n message = 'Prompt was canceled';\n}\nexport class ExitPromptError extends Error {\n name = 'ExitPromptError';\n}\nexport class HookError extends Error {\n name = 'HookError';\n}\nexport class ValidationError extends Error {\n name = 'ValidationError';\n}\n","/* eslint @typescript-eslint/no-explicit-any: [\"off\"] */\nimport { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';\nimport { HookError, ValidationError } from \"./errors.js\";\nconst hookStorage = new AsyncLocalStorage();\nfunction createStore(rl) {\n const store = {\n rl,\n hooks: [],\n hooksCleanup: [],\n hooksEffect: [],\n index: 0,\n handleChange() { },\n };\n return store;\n}\n// Run callback in with the hook engine setup.\nexport function withHooks(rl, cb) {\n const store = createStore(rl);\n return hookStorage.run(store, () => {\n function cycle(render) {\n store.handleChange = () => {\n store.index = 0;\n render();\n };\n store.handleChange();\n }\n return cb(cycle);\n });\n}\n// Safe getStore utility that'll return the store or throw if undefined.\nfunction getStore() {\n const store = hookStorage.getStore();\n if (!store) {\n throw new HookError('[Inquirer] Hook functions can only be called from within a prompt');\n }\n return store;\n}\nexport function readline() {\n return getStore().rl;\n}\n// Merge state updates happening within the callback function to avoid multiple renders.\nexport function withUpdates(fn) {\n const wrapped = (...args) => {\n const store = getStore();\n let shouldUpdate = false;\n const oldHandleChange = store.handleChange;\n store.handleChange = () => {\n shouldUpdate = true;\n };\n const returnValue = fn(...args);\n if (shouldUpdate) {\n oldHandleChange();\n }\n store.handleChange = oldHandleChange;\n return returnValue;\n };\n return AsyncResource.bind(wrapped);\n}\nexport function withPointer(cb) {\n const store = getStore();\n const { index } = store;\n const pointer = {\n get() {\n return store.hooks[index];\n },\n set(value) {\n store.hooks[index] = value;\n },\n initialized: index in store.hooks,\n };\n const returnValue = cb(pointer);\n store.index++;\n return returnValue;\n}\nexport function handleChange() {\n getStore().handleChange();\n}\nexport const effectScheduler = {\n queue(cb) {\n const store = getStore();\n const { index } = store;\n store.hooksEffect.push(() => {\n store.hooksCleanup[index]?.();\n const cleanFn = cb(readline());\n if (cleanFn != null && typeof cleanFn !== 'function') {\n throw new ValidationError('useEffect return value must be a cleanup function or nothing.');\n }\n store.hooksCleanup[index] = cleanFn;\n });\n },\n run() {\n const store = getStore();\n withUpdates(() => {\n store.hooksEffect.forEach((effect) => {\n effect();\n });\n // Warning: Clean the hooks before exiting the `withUpdates` block.\n // Failure to do so means an updates would hit the same effects again.\n store.hooksEffect.length = 0;\n })();\n },\n clearAll() {\n const store = getStore();\n store.hooksCleanup.forEach((cleanFn) => {\n cleanFn?.();\n });\n store.hooksEffect.length = 0;\n store.hooksCleanup.length = 0;\n },\n};\n","import { AsyncResource } from 'node:async_hooks';\nimport { withPointer, handleChange } from \"./hook-engine.js\";\nexport function useState(defaultValue) {\n return withPointer((pointer) => {\n const setState = AsyncResource.bind(function setState(newValue) {\n // Noop if the value is still the same.\n if (pointer.get() !== newValue) {\n pointer.set(newValue);\n // Trigger re-render\n handleChange();\n }\n });\n if (pointer.initialized) {\n return [pointer.get(), setState];\n }\n const value = typeof defaultValue === 'function' ? defaultValue() : defaultValue;\n pointer.set(value);\n return [value, setState];\n });\n}\n","import { withPointer, effectScheduler } from \"./hook-engine.js\";\nexport function useEffect(cb, depArray) {\n withPointer((pointer) => {\n const oldDeps = pointer.get();\n const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));\n if (hasChanged) {\n effectScheduler.queue(cb);\n }\n pointer.set(depArray);\n });\n}\n","// process.env dot-notation access prints:\n// Property 'TERM' comes from an index signature, so it must be accessed with ['TERM'].ts(4111)\n/* eslint dot-notation: [\"off\"] */\nimport process from 'node:process';\n// Ported from is-unicode-supported\nfunction isUnicodeSupported() {\n if (process.platform !== 'win32') {\n return process.env['TERM'] !== 'linux'; // Linux console (kernel)\n }\n return (Boolean(process.env['WT_SESSION']) || // Windows Terminal\n Boolean(process.env['TERMINUS_SUBLIME']) || // Terminus (<0.2.27)\n process.env['ConEmuTask'] === '{cmd::Cmder}' || // ConEmu and cmder\n process.env['TERM_PROGRAM'] === 'Terminus-Sublime' ||\n process.env['TERM_PROGRAM'] === 'vscode' ||\n process.env['TERM'] === 'xterm-256color' ||\n process.env['TERM'] === 'alacritty' ||\n process.env['TERMINAL_EMULATOR'] === 'JetBrains-JediTerm');\n}\n// Ported from figures\nconst common = {\n circleQuestionMark: '(?)',\n questionMarkPrefix: '(?)',\n square: '█',\n squareDarkShade: '▓',\n squareMediumShade: '▒',\n squareLightShade: '░',\n squareTop: '▀',\n squareBottom: '▄',\n squareLeft: '▌',\n squareRight: '▐',\n squareCenter: '■',\n bullet: '●',\n dot: '․',\n ellipsis: '…',\n pointerSmall: '›',\n triangleUp: '▲',\n triangleUpSmall: '▴',\n triangleDown: '▼',\n triangleDownSmall: '▾',\n triangleLeftSmall: '◂',\n triangleRightSmall: '▸',\n home: '⌂',\n heart: '♥',\n musicNote: '♪',\n musicNoteBeamed: '♫',\n arrowUp: '↑',\n arrowDown: '↓',\n arrowLeft: '←',\n arrowRight: '→',\n arrowLeftRight: '↔',\n arrowUpDown: '↕',\n almostEqual: '≈',\n notEqual: '≠',\n lessOrEqual: '≤',\n greaterOrEqual: '≥',\n identical: '≡',\n infinity: '∞',\n subscriptZero: '₀',\n subscriptOne: '₁',\n subscriptTwo: '₂',\n subscriptThree: '₃',\n subscriptFour: '₄',\n subscriptFive: '₅',\n subscriptSix: '₆',\n subscriptSeven: '₇',\n subscriptEight: '₈',\n subscriptNine: '₉',\n oneHalf: '½',\n oneThird: '⅓',\n oneQuarter: '¼',\n oneFifth: '⅕',\n oneSixth: '⅙',\n oneEighth: '⅛',\n twoThirds: '⅔',\n twoFifths: '⅖',\n threeQuarters: '¾',\n threeFifths: '⅗',\n threeEighths: '⅜',\n fourFifths: '⅘',\n fiveSixths: '⅚',\n fiveEighths: '⅝',\n sevenEighths: '⅞',\n line: '─',\n lineBold: '━',\n lineDouble: '═',\n lineDashed0: '┄',\n lineDashed1: '┅',\n lineDashed2: '┈',\n lineDashed3: '┉',\n lineDashed4: '╌',\n lineDashed5: '╍',\n lineDashed6: '╴',\n lineDashed7: '╶',\n lineDashed8: '╸',\n lineDashed9: '╺',\n lineDashed10: '╼',\n lineDashed11: '╾',\n lineDashed12: '−',\n lineDashed13: '–',\n lineDashed14: '‐',\n lineDashed15: '⁃',\n lineVertical: '│',\n lineVerticalBold: '┃',\n lineVerticalDouble: '║',\n lineVerticalDashed0: '┆',\n lineVerticalDashed1: '┇',\n lineVerticalDashed2: '┊',\n lineVerticalDashed3: '┋',\n lineVerticalDashed4: '╎',\n lineVerticalDashed5: '╏',\n lineVerticalDashed6: '╵',\n lineVerticalDashed7: '╷',\n lineVerticalDashed8: '╹',\n lineVerticalDashed9: '╻',\n lineVerticalDashed10: '╽',\n lineVerticalDashed11: '╿',\n lineDownLeft: '┐',\n lineDownLeftArc: '╮',\n lineDownBoldLeftBold: '┓',\n lineDownBoldLeft: '┒',\n lineDownLeftBold: '┑',\n lineDownDoubleLeftDouble: '╗',\n lineDownDoubleLeft: '╖',\n lineDownLeftDouble: '╕',\n lineDownRight: '┌',\n lineDownRightArc: '╭',\n lineDownBoldRightBold: '┏',\n lineDownBoldRight: '┎',\n lineDownRightBold: '┍',\n lineDownDoubleRightDouble: '╔',\n lineDownDoubleRight: '╓',\n lineDownRightDouble: '╒',\n lineUpLeft: '┘',\n lineUpLeftArc: '╯',\n lineUpBoldLeftBold: '┛',\n lineUpBoldLeft: '┚',\n lineUpLeftBold: '┙',\n lineUpDoubleLeftDouble: '╝',\n lineUpDoubleLeft: '╜',\n lineUpLeftDouble: '╛',\n lineUpRight: '└',\n lineUpRightArc: '╰',\n lineUpBoldRightBold: '┗',\n lineUpBoldRight: '┖',\n lineUpRightBold: '┕',\n lineUpDoubleRightDouble: '╚',\n lineUpDoubleRight: '╙',\n lineUpRightDouble: '╘',\n lineUpDownLeft: '┤',\n lineUpBoldDownBoldLeftBold: '┫',\n lineUpBoldDownBoldLeft: '┨',\n lineUpDownLeftBold: '┥',\n lineUpBoldDownLeftBold: '┩',\n lineUpDownBoldLeftBold: '┪',\n lineUpDownBoldLeft: '┧',\n lineUpBoldDownLeft: '┦',\n lineUpDoubleDownDoubleLeftDouble: '╣',\n lineUpDoubleDownDoubleLeft: '╢',\n lineUpDownLeftDouble: '╡',\n lineUpDownRight: '├',\n lineUpBoldDownBoldRightBold: '┣',\n lineUpBoldDownBoldRight: '┠',\n lineUpDownRightBold: '┝',\n lineUpBoldDownRightBold: '┡',\n lineUpDownBoldRightBold: '┢',\n lineUpDownBoldRight: '┟',\n lineUpBoldDownRight: '┞',\n lineUpDoubleDownDoubleRightDouble: '╠',\n lineUpDoubleDownDoubleRight: '╟',\n lineUpDownRightDouble: '╞',\n lineDownLeftRight: '┬',\n lineDownBoldLeftBoldRightBold: '┳',\n lineDownLeftBoldRightBold: '┯',\n lineDownBoldLeftRight: '┰',\n lineDownBoldLeftBoldRight: '┱',\n lineDownBoldLeftRightBold: '┲',\n lineDownLeftRightBold: '┮',\n lineDownLeftBoldRight: '┭',\n lineDownDoubleLeftDoubleRightDouble: '╦',\n lineDownDoubleLeftRight: '╥',\n lineDownLeftDoubleRightDouble: '╤',\n lineUpLeftRight: '┴',\n lineUpBoldLeftBoldRightBold: '┻',\n lineUpLeftBoldRightBold: '┷',\n lineUpBoldLeftRight: '┸',\n lineUpBoldLeftBoldRight: '┹',\n lineUpBoldLeftRightBold: '┺',\n lineUpLeftRightBold: '┶',\n lineUpLeftBoldRight: '┵',\n lineUpDoubleLeftDoubleRightDouble: '╩',\n lineUpDoubleLeftRight: '╨',\n lineUpLeftDoubleRightDouble: '╧',\n lineUpDownLeftRight: '┼',\n lineUpBoldDownBoldLeftBoldRightBold: '╋',\n lineUpDownBoldLeftBoldRightBold: '╈',\n lineUpBoldDownLeftBoldRightBold: '╇',\n lineUpBoldDownBoldLeftRightBold: '╊',\n lineUpBoldDownBoldLeftBoldRight: '╉',\n lineUpBoldDownLeftRight: '╀',\n lineUpDownBoldLeftRight: '╁',\n lineUpDownLeftBoldRight: '┽',\n lineUpDownLeftRightBold: '┾',\n lineUpBoldDownBoldLeftRight: '╂',\n lineUpDownLeftBoldRightBold: '┿',\n lineUpBoldDownLeftBoldRight: '╃',\n lineUpBoldDownLeftRightBold: '╄',\n lineUpDownBoldLeftBoldRight: '╅',\n lineUpDownBoldLeftRightBold: '╆',\n lineUpDoubleDownDoubleLeftDoubleRightDouble: '╬',\n lineUpDoubleDownDoubleLeftRight: '╫',\n lineUpDownLeftDoubleRightDouble: '╪',\n lineCross: '╳',\n lineBackslash: '╲',\n lineSlash: '╱',\n};\nconst specialMainSymbols = {\n tick: '✔',\n info: 'ℹ',\n warning: '⚠',\n cross: '✘',\n squareSmall: '◻',\n squareSmallFilled: '◼',\n circle: '◯',\n circleFilled: '◉',\n circleDotted: '◌',\n circleDouble: '◎',\n circleCircle: 'ⓞ',\n circleCross: 'ⓧ',\n circlePipe: 'Ⓘ',\n radioOn: '◉',\n radioOff: '◯',\n checkboxOn: '☒',\n checkboxOff: '☐',\n checkboxCircleOn: 'ⓧ',\n checkboxCircleOff: 'Ⓘ',\n pointer: '❯',\n triangleUpOutline: '△',\n triangleLeft: '◀',\n triangleRight: '▶',\n lozenge: '◆',\n lozengeOutline: '◇',\n hamburger: '☰',\n smiley: '㋡',\n mustache: '෴',\n star: '★',\n play: '▶',\n nodejs: '⬢',\n oneSeventh: '⅐',\n oneNinth: '⅑',\n oneTenth: '⅒',\n};\nconst specialFallbackSymbols = {\n tick: '√',\n info: 'i',\n warning: '‼',\n cross: '×',\n squareSmall: '□',\n squareSmallFilled: '■',\n circle: '( )',\n circleFilled: '(*)',\n circleDotted: '( )',\n circleDouble: '( )',\n circleCircle: '(○)',\n circleCross: '(×)',\n circlePipe: '(│)',\n radioOn: '(*)',\n radioOff: '( )',\n checkboxOn: '[×]',\n checkboxOff: '[ ]',\n checkboxCircleOn: '(×)',\n checkboxCircleOff: '( )',\n pointer: '>',\n triangleUpOutline: '∆',\n triangleLeft: '◄',\n triangleRight: '►',\n lozenge: '♦',\n lozengeOutline: '◊',\n hamburger: '≡',\n smiley: '☺',\n mustache: '┌─┐',\n star: '✶',\n play: '►',\n nodejs: '♦',\n oneSeventh: '1/7',\n oneNinth: '1/9',\n oneTenth: '1/10',\n};\nexport const mainSymbols = {\n ...common,\n ...specialMainSymbols,\n};\nexport const fallbackSymbols = {\n ...common,\n ...specialFallbackSymbols,\n};\nconst shouldUseMain = isUnicodeSupported();\nconst figures = shouldUseMain\n ? mainSymbols\n : fallbackSymbols;\nexport default figures;\nconst replacements = Object.entries(specialMainSymbols);\n// On terminals which do not support Unicode symbols, substitute them to other symbols\nexport const replaceSymbols = (string, { useFallback = !shouldUseMain } = {}) => {\n if (useFallback) {\n for (const [key, mainSymbol] of replacements) {\n const fallbackSymbol = fallbackSymbols[key];\n if (!fallbackSymbol) {\n throw new Error(`Unable to find fallback for ${key}`);\n }\n string = string.replaceAll(mainSymbol, fallbackSymbol);\n }\n }\n return string;\n};\n","import { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nexport const defaultTheme = {\n prefix: {\n idle: styleText('blue', '?'),\n done: styleText('green', figures.tick),\n },\n spinner: {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'].map((frame) => styleText('yellow', frame)),\n },\n style: {\n answer: (text) => styleText('cyan', text),\n message: (text) => styleText('bold', text),\n error: (text) => styleText('red', `> ${text}`),\n defaultAnswer: (text) => styleText('dim', `(${text})`),\n help: (text) => styleText('dim', text),\n highlight: (text) => styleText('cyan', text),\n key: (text) => styleText('cyan', styleText('bold', `<${text}>`)),\n },\n};\n","import { defaultTheme } from \"./theme.js\";\nfunction isPlainObject(value) {\n if (typeof value !== 'object' || value === null)\n return false;\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n}\nfunction deepMerge(...objects) {\n const output = {};\n for (const obj of objects) {\n for (const [key, value] of Object.entries(obj)) {\n const prevValue = output[key];\n output[key] =\n isPlainObject(prevValue) && isPlainObject(value)\n ? deepMerge(prevValue, value)\n : value;\n }\n }\n return output;\n}\nexport function makeTheme(...themes) {\n const themesToMerge = [\n defaultTheme,\n ...themes.filter((theme) => theme != null),\n ];\n return deepMerge(...themesToMerge);\n}\n","import { useState } from \"./use-state.js\";\nimport { useEffect } from \"./use-effect.js\";\nimport { makeTheme } from \"./make-theme.js\";\nexport function usePrefix({ status = 'idle', theme, }) {\n const [showLoader, setShowLoader] = useState(false);\n const [tick, setTick] = useState(0);\n const { prefix, spinner } = makeTheme(theme);\n useEffect(() => {\n if (status === 'loading') {\n let tickInterval;\n let inc = -1;\n // Delay displaying spinner by 300ms, to avoid flickering\n const delayTimeout = setTimeout(() => {\n setShowLoader(true);\n tickInterval = setInterval(() => {\n inc = inc + 1;\n setTick(inc % spinner.frames.length);\n }, spinner.interval);\n }, 300);\n return () => {\n clearTimeout(delayTimeout);\n clearInterval(tickInterval);\n };\n }\n else {\n setShowLoader(false);\n }\n }, [status]);\n if (showLoader) {\n return spinner.frames[tick];\n }\n // There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead.\n const iconName = status === 'loading' ? 'idle' : status;\n return typeof prefix === 'string' ? prefix : (prefix[iconName] ?? prefix['idle']);\n}\n","import { withPointer } from \"./hook-engine.js\";\nexport function useMemo(fn, dependencies) {\n return withPointer((pointer) => {\n const prev = pointer.get();\n if (!prev ||\n prev.dependencies.length !== dependencies.length ||\n prev.dependencies.some((dep, i) => dep !== dependencies[i])) {\n const value = fn();\n pointer.set({ value, dependencies });\n return value;\n }\n return prev.value;\n });\n}\n","import { useState } from \"./use-state.js\";\nexport function useRef(val) {\n return useState({ current: val })[0];\n}\n","import { useRef } from \"./use-ref.js\";\nimport { useEffect } from \"./use-effect.js\";\nimport { withUpdates } from \"./hook-engine.js\";\nexport function useKeypress(userHandler) {\n const signal = useRef(userHandler);\n signal.current = userHandler;\n useEffect((rl) => {\n let ignore = false;\n const handler = withUpdates((_input, event) => {\n if (ignore)\n return;\n void signal.current(event, rl);\n });\n rl.input.on('keypress', handler);\n return () => {\n ignore = true;\n rl.input.removeListener('keypress', handler);\n };\n }, []);\n}\n","'use strict';\n\nmodule.exports = cliWidth;\n\nfunction normalizeOpts(options) {\n const defaultOpts = {\n defaultWidth: 0,\n output: process.stdout,\n tty: require('tty'),\n };\n\n if (!options) {\n return defaultOpts;\n }\n\n Object.keys(defaultOpts).forEach(function (key) {\n if (!options[key]) {\n options[key] = defaultOpts[key];\n }\n });\n\n return options;\n}\n\nfunction cliWidth(options) {\n const opts = normalizeOpts(options);\n\n if (opts.output.getWindowSize) {\n return opts.output.getWindowSize()[0] || opts.defaultWidth;\n }\n\n if (opts.tty.getWindowSize) {\n return opts.tty.getWindowSize()[1] || opts.defaultWidth;\n }\n\n if (opts.output.columns) {\n return opts.output.columns;\n }\n\n if (process.env.CLI_WIDTH) {\n const width = parseInt(process.env.CLI_WIDTH, 10);\n\n if (!isNaN(width) && width !== 0) {\n return width;\n }\n }\n\n return opts.defaultWidth;\n}\n","/* MAIN */\nconst getCodePointsLength = (() => {\n const SURROGATE_PAIR_RE = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n return (input) => {\n let surrogatePairsNr = 0;\n SURROGATE_PAIR_RE.lastIndex = 0;\n while (SURROGATE_PAIR_RE.test(input)) {\n surrogatePairsNr += 1;\n }\n return input.length - surrogatePairsNr;\n };\n})();\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWideNotCJKTNotEmoji = (x) => {\n return x === 0x231B || x === 0x2329 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3099 && x <= 0x30FF || x >= 0x3105 && x <= 0x312F || x >= 0x3131 && x <= 0x318E || x >= 0x3190 && x <= 0x31E3 || x >= 0x31EF && x <= 0x321E || x >= 0x3220 && x <= 0x3247 || x >= 0x3250 && x <= 0x4DBF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji };\n","/* IMPORT */\nimport { getCodePointsLength, isFullWidth, isWideNotCJKTNotEmoji } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\\u001b\\]8;[^;]*;.*?(?:\\u0007|\\u001b\\u005c)/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\nconst CJKT_WIDE_RE = /(?:(?![\\uFF61-\\uFF9F\\uFF00-\\uFFEF])[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\p{Script=Tangut}]){1,1000}/yu;\nconst TAB_RE = /\\t{1,1000}/y;\nconst EMOJI_RE = /[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*/yu;\nconst LATIN_RE = /(?:[\\x20-\\x7E\\xA0-\\xFF](?!\\uFE0F)){1,1000}/y;\nconst MODIFIER_RE = /\\p{M}+/gu;\nconst NO_TRUNCATION = { limit: Infinity, ellipsis: '' };\n/* MAIN */\nconst getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {\n /* CONSTANTS */\n const LIMIT = truncationOptions.limit ?? Infinity;\n const ELLIPSIS = truncationOptions.ellipsis ?? '';\n const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);\n const ANSI_WIDTH = 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;\n const PARSE_BLOCKS = [\n [LATIN_RE, REGULAR_WIDTH],\n [ANSI_RE, ANSI_WIDTH],\n [CONTROL_RE, CONTROL_WIDTH],\n [TAB_RE, TAB_WIDTH],\n [EMOJI_RE, EMOJI_WIDTH],\n [CJKT_WIDE_RE, WIDE_WIDTH],\n ];\n /* STATE */\n let indexPrev = 0;\n let index = 0;\n let length = input.length;\n let lengthExtra = 0;\n let truncationEnabled = false;\n let truncationIndex = length;\n let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);\n let unmatchedStart = 0;\n let unmatchedEnd = 0;\n let width = 0;\n let widthExtra = 0;\n /* PARSE LOOP */\n outer: while (true) {\n /* UNMATCHED */\n if ((unmatchedEnd > unmatchedStart) || (index >= length && index > indexPrev)) {\n const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);\n lengthExtra = 0;\n for (const char of unmatched.replaceAll(MODIFIER_RE, '')) {\n const codePoint = char.codePointAt(0) || 0;\n if (isFullWidth(codePoint)) {\n widthExtra = FULL_WIDTH_WIDTH;\n }\n else if (isWideNotCJKTNotEmoji(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else {\n widthExtra = REGULAR_WIDTH;\n }\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n lengthExtra += char.length;\n width += widthExtra;\n }\n unmatchedStart = unmatchedEnd = 0;\n }\n /* EXITING */\n if (index >= length) {\n break outer;\n }\n /* PARSE BLOCKS */\n for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {\n const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];\n BLOCK_RE.lastIndex = index;\n if (BLOCK_RE.test(input)) {\n lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;\n widthExtra = lengthExtra * BLOCK_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break outer;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = BLOCK_RE.lastIndex;\n continue outer;\n }\n }\n /* UNMATCHED INDEX */\n index += 1;\n }\n /* RETURN */\n return {\n width: truncationEnabled ? truncationLimit : width,\n index: truncationEnabled ? truncationIndex : length,\n truncated: truncationEnabled,\n ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH\n };\n};\n/* EXPORT */\nexport default getStringTruncatedWidth;\n","/* IMPORT */\nimport fastStringTruncatedWidth from 'fast-string-truncated-width';\n/* HELPERS */\nconst NO_TRUNCATION = {\n limit: Infinity,\n ellipsis: '',\n ellipsisWidth: 0,\n};\n/* MAIN */\nconst fastStringWidth = (input, options = {}) => {\n return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width;\n};\n/* EXPORT */\nexport default fastStringWidth;\n","import stringWidth from 'fast-string-width';\nconst ESC = '\\x1B';\nconst CSI = '\\x9B';\nconst END_CODE = 39;\nconst ANSI_ESCAPE_BELL = '\\u0007';\nconst ANSI_CSI = '[';\nconst ANSI_OSC = ']';\nconst ANSI_SGR_TERMINATOR = 'm';\nconst ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;\nconst GROUP_REGEX = new RegExp(`(?:\\\\${ANSI_CSI}(?<code>\\\\d+)m|\\\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');\nconst getClosingCode = (openingCode) => {\n if (openingCode >= 30 && openingCode <= 37)\n return 39;\n if (openingCode >= 90 && openingCode <= 97)\n return 39;\n if (openingCode >= 40 && openingCode <= 47)\n return 49;\n if (openingCode >= 100 && openingCode <= 107)\n return 49;\n if (openingCode === 1 || openingCode === 2)\n return 22;\n if (openingCode === 3)\n return 23;\n if (openingCode === 4)\n return 24;\n if (openingCode === 7)\n return 27;\n if (openingCode === 8)\n return 28;\n if (openingCode === 9)\n return 29;\n if (openingCode === 0)\n return 0;\n return undefined;\n};\nconst wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;\nconst wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;\nconst wrapWord = (rows, word, columns) => {\n const characters = word[Symbol.iterator]();\n let isInsideEscape = false;\n let isInsideLinkEscape = false;\n let lastRow = rows.at(-1);\n let visible = lastRow === undefined ? 0 : stringWidth(lastRow);\n let currentCharacter = characters.next();\n let nextCharacter = characters.next();\n let rawCharacterIndex = 0;\n while (!currentCharacter.done) {\n const character = currentCharacter.value;\n const characterLength = stringWidth(character);\n if (visible + characterLength <= columns) {\n rows[rows.length - 1] += character;\n }\n else {\n rows.push(character);\n visible = 0;\n }\n if (character === ESC || character === CSI) {\n isInsideEscape = true;\n isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);\n }\n if (isInsideEscape) {\n if (isInsideLinkEscape) {\n if (character === ANSI_ESCAPE_BELL) {\n isInsideEscape = false;\n isInsideLinkEscape = false;\n }\n }\n else if (character === ANSI_SGR_TERMINATOR) {\n isInsideEscape = false;\n }\n }\n else {\n visible += characterLength;\n if (visible === columns && !nextCharacter.done) {\n rows.push('');\n visible = 0;\n }\n }\n currentCharacter = nextCharacter;\n nextCharacter = characters.next();\n rawCharacterIndex += character.length;\n }\n lastRow = rows.at(-1);\n if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {\n rows[rows.length - 2] += rows.pop();\n }\n};\nconst stringVisibleTrimSpacesRight = (string) => {\n const words = string.split(' ');\n let last = words.length;\n while (last) {\n if (stringWidth(words[last - 1])) {\n break;\n }\n last--;\n }\n if (last === words.length) {\n return string;\n }\n return words.slice(0, last).join(' ') + words.slice(last).join('');\n};\nconst exec = (string, columns, options = {}) => {\n if (options.trim !== false && string.trim() === '') {\n return '';\n }\n let returnValue = '';\n let escapeCode;\n let escapeUrl;\n const words = string.split(' ');\n let rows = [''];\n let rowLength = 0;\n for (let index = 0; index < words.length; index++) {\n const word = words[index];\n if (options.trim !== false) {\n const row = rows.at(-1) ?? '';\n const trimmed = row.trimStart();\n if (row.length !== trimmed.length) {\n rows[rows.length - 1] = trimmed;\n rowLength = stringWidth(trimmed);\n }\n }\n if (index !== 0) {\n if (rowLength >= columns &&\n (options.wordWrap === false || options.trim === false)) {\n rows.push('');\n rowLength = 0;\n }\n if (rowLength || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n const wordLength = stringWidth(word);\n if (options.hard && wordLength > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n rowLength = stringWidth(rows.at(-1) ?? '');\n continue;\n }\n if (rowLength + wordLength > columns && rowLength && wordLength) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n rowLength = stringWidth(rows.at(-1) ?? '');\n continue;\n }\n rows.push('');\n rowLength = 0;\n }\n if (rowLength + wordLength > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n rowLength = stringWidth(rows.at(-1) ?? '');\n continue;\n }\n rows[rows.length - 1] += word;\n rowLength += wordLength;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n let inSurrogate = false;\n for (let i = 0; i < preString.length; i++) {\n const character = preString[i];\n returnValue += character;\n if (!inSurrogate) {\n inSurrogate = character >= '\\ud800' && character <= '\\udbff';\n if (inSurrogate) {\n continue;\n }\n }\n else {\n inSurrogate = false;\n }\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = i + 1;\n const groupsResult = GROUP_REGEX.exec(preString);\n const groups = groupsResult?.groups;\n if (groups?.code !== undefined) {\n const code = Number.parseFloat(groups.code);\n escapeCode = code === END_CODE ? undefined : code;\n }\n else if (groups?.uri !== undefined) {\n escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;\n }\n }\n if (preString[i + 1] === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && getClosingCode(escapeCode)) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n }\n return returnValue;\n};\nconst CRLF_OR_LF = /\\r?\\n/;\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .split(CRLF_OR_LF)\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","import cliWidth from 'cli-width';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { readline } from \"./hook-engine.js\";\n/**\n * Force line returns at specific width. This function is ANSI code friendly and it'll\n * ignore invisible codes during width calculation.\n * @param {string} content\n * @param {number} width\n * @return {string}\n */\nexport function breakLines(content, width) {\n return content\n .split('\\n')\n .flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true })\n .split('\\n')\n .map((str) => str.trimEnd()))\n .join('\\n');\n}\n/**\n * Returns the width of the active readline, or 80 as default value.\n * @returns {number}\n */\nexport function readlineWidth() {\n return cliWidth({ defaultWidth: 80, output: readline().output });\n}\n","import { useRef } from \"../use-ref.js\";\nimport { readlineWidth, breakLines } from \"../utils.js\";\nfunction usePointerPosition({ active, renderedItems, pageSize, loop, }) {\n const state = useRef({\n lastPointer: active,\n lastActive: undefined,\n });\n const { lastPointer, lastActive } = state.current;\n const middle = Math.floor(pageSize / 2);\n const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);\n const defaultPointerPosition = renderedItems\n .slice(0, active)\n .reduce((acc, item) => acc + item.length, 0);\n let pointer = defaultPointerPosition;\n if (renderedLength > pageSize) {\n if (loop) {\n /**\n * Creates the next position for the pointer considering an infinitely\n * looping list of items to be rendered on the page.\n *\n * The goal is to progressively move the cursor to the middle position as the user move down, and then keep\n * the cursor there. When the user move up, maintain the cursor position.\n */\n // By default, keep the cursor position as-is.\n pointer = lastPointer;\n if (\n // First render, skip this logic.\n lastActive != null &&\n // Only move the pointer down when the user moves down.\n lastActive < active &&\n // Check user didn't move up across page boundary.\n active - lastActive < pageSize) {\n pointer = Math.min(\n // Furthest allowed position for the pointer is the middle of the list\n middle, Math.abs(active - lastActive) === 1\n ? Math.min(\n // Move the pointer at most the height of the last active item.\n lastPointer + (renderedItems[lastActive]?.length ?? 0), \n // If the user moved by one item, move the pointer to the natural position of the active item as\n // long as it doesn't move the cursor up.\n Math.max(defaultPointerPosition, lastPointer))\n : // Otherwise, move the pointer down by the difference between the active and last active item.\n lastPointer + active - lastActive);\n }\n }\n else {\n /**\n * Creates the next position for the pointer considering a finite list of\n * items to be rendered on a page.\n *\n * The goal is to keep the pointer in the middle of the page whenever possible, until\n * we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively\n * to the bottom or top of the list.\n */\n const spaceUnderActive = renderedItems\n .slice(active)\n .reduce((acc, item) => acc + item.length, 0);\n pointer =\n spaceUnderActive < pageSize - middle\n ? // If the active item is near the end of the list, progressively move the cursor towards the end.\n pageSize - spaceUnderActive\n : // Otherwise, progressively move the pointer to the middle of the list.\n Math.min(defaultPointerPosition, middle);\n }\n }\n // Save state for the next render\n state.current.lastPointer = pointer;\n state.current.lastActive = active;\n return pointer;\n}\nexport function usePagination({ items, active, renderItem, pageSize, loop = true, }) {\n const width = readlineWidth();\n const bound = (num) => ((num % items.length) + items.length) % items.length;\n const renderedItems = items.map((item, index) => {\n if (item == null)\n return [];\n return breakLines(renderItem({ item, index, isActive: index === active }), width).split('\\n');\n });\n const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);\n const renderItemAtIndex = (index) => renderedItems[index] ?? [];\n const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });\n // Render the active item to decide the position.\n // If the active item fits under the pointer, we render it there.\n // Otherwise, we need to render it to fit at the bottom of the page; moving the pointer up.\n const activeItem = renderItemAtIndex(active).slice(0, pageSize);\n const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;\n // Create an array of lines for the page, and add the lines of the active item into the page\n const pageBuffer = Array.from({ length: pageSize });\n pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);\n // Store to prevent rendering the same item twice\n const itemVisited = new Set([active]);\n // Fill the page under the active item\n let bufferPointer = activeItemPosition + activeItem.length;\n let itemPointer = bound(active + 1);\n while (bufferPointer < pageSize &&\n !itemVisited.has(itemPointer) &&\n (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {\n const lines = renderItemAtIndex(itemPointer);\n const linesToAdd = lines.slice(0, pageSize - bufferPointer);\n pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);\n // Move pointers for next iteration\n itemVisited.add(itemPointer);\n bufferPointer += linesToAdd.length;\n itemPointer = bound(itemPointer + 1);\n }\n // Fill the page over the active item\n bufferPointer = activeItemPosition - 1;\n itemPointer = bound(active - 1);\n while (bufferPointer >= 0 &&\n !itemVisited.has(itemPointer) &&\n (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {\n const lines = renderItemAtIndex(itemPointer);\n const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));\n pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);\n // Move pointers for next iteration\n itemVisited.add(itemPointer);\n bufferPointer -= linesToAdd.length;\n itemPointer = bound(itemPointer - 1);\n }\n return pageBuffer.filter((line) => typeof line === 'string').join('\\n');\n}\n","const Stream = require('stream')\n\nclass MuteStream extends Stream {\n #isTTY = null\n\n constructor (opts = {}) {\n super(opts)\n this.writable = this.readable = true\n this.muted = false\n this.on('pipe', this._onpipe)\n this.replace = opts.replace\n\n // For readline-type situations\n // This much at the start of a line being redrawn after a ctrl char\n // is seen (such as backspace) won't be redrawn as the replacement\n this._prompt = opts.prompt || null\n this._hadControl = false\n }\n\n #destSrc (key, def) {\n if (this._dest) {\n return this._dest[key]\n }\n if (this._src) {\n return this._src[key]\n }\n return def\n }\n\n #proxy (method, ...args) {\n if (typeof this._dest?.[method] === 'function') {\n this._dest[method](...args)\n }\n if (typeof this._src?.[method] === 'function') {\n this._src[method](...args)\n }\n }\n\n get isTTY () {\n if (this.#isTTY !== null) {\n return this.#isTTY\n }\n return this.#destSrc('isTTY', false)\n }\n\n // basically just get replace the getter/setter with a regular value\n set isTTY (val) {\n this.#isTTY = val\n }\n\n get rows () {\n return this.#destSrc('rows')\n }\n\n get columns () {\n return this.#destSrc('columns')\n }\n\n mute () {\n this.muted = true\n }\n\n unmute () {\n this.muted = false\n }\n\n _onpipe (src) {\n this._src = src\n }\n\n pipe (dest, options) {\n this._dest = dest\n return super.pipe(dest, options)\n }\n\n pause () {\n if (this._src) {\n return this._src.pause()\n }\n }\n\n resume () {\n if (this._src) {\n return this._src.resume()\n }\n }\n\n write (c) {\n if (this.muted) {\n if (!this.replace) {\n return true\n }\n // eslint-disable-next-line no-control-regex\n if (c.match(/^\\u001b/)) {\n if (c.indexOf(this._prompt) === 0) {\n c = c.slice(this._prompt.length)\n c = c.replace(/./g, this.replace)\n c = this._prompt + c\n }\n this._hadControl = true\n return this.emit('data', c)\n } else {\n if (this._prompt && this._hadControl &&\n c.indexOf(this._prompt) === 0) {\n this._hadControl = false\n this.emit('data', this._prompt)\n c = c.slice(this._prompt.length)\n }\n c = c.toString().replace(/./g, this.replace)\n }\n }\n this.emit('data', c)\n }\n\n end (c) {\n if (this.muted) {\n if (c && this.replace) {\n c = c.toString().replace(/./g, this.replace)\n } else {\n c = null\n }\n }\n if (c) {\n this.emit('data', c)\n }\n this.emit('end')\n }\n\n destroy (...args) {\n return this.#proxy('destroy', ...args)\n }\n\n destroySoon (...args) {\n return this.#proxy('destroySoon', ...args)\n }\n\n close (...args) {\n return this.#proxy('close', ...args)\n }\n}\n\nmodule.exports = MuteStream\n","/**\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","// 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","const ESC = '\\u001B[';\n/** Move cursor to first column */\nexport const cursorLeft = ESC + 'G';\n/** Hide the cursor */\nexport const cursorHide = ESC + '?25l';\n/** Show the cursor */\nexport const cursorShow = ESC + '?25h';\n/** Move cursor up by count rows */\nexport const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '');\n/** Move cursor down by count rows */\nexport const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : '';\n/** Move cursor to position (x, y) */\nexport const cursorTo = (x, y) => {\n if (typeof y === 'number' && !Number.isNaN(y)) {\n return `${ESC}${y + 1};${x + 1}H`;\n }\n return `${ESC}${x + 1}G`;\n};\nconst eraseLine = ESC + '2K';\n/** Erase the specified number of lines above the cursor */\nexport const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : '';\n","import { stripVTControlCharacters } from 'node:util';\nimport { breakLines, readlineWidth } from \"./utils.js\";\nimport { cursorDown, cursorUp, cursorTo, cursorShow, eraseLines } from '@inquirer/ansi';\nconst height = (content) => content.split('\\n').length;\nconst lastLine = (content) => content.split('\\n').pop() ?? '';\nexport default class ScreenManager {\n // These variables are keeping information to allow correct prompt re-rendering\n height = 0;\n extraLinesUnderPrompt = 0;\n cursorPos;\n rl;\n constructor(rl) {\n this.rl = rl;\n this.cursorPos = rl.getCursorPos();\n }\n write(content) {\n this.rl.output.unmute();\n this.rl.output.write(content);\n this.rl.output.mute();\n }\n render(content, bottomContent = '') {\n // Write message to screen and setPrompt to control backspace\n const promptLine = lastLine(content);\n const rawPromptLine = stripVTControlCharacters(promptLine);\n // Remove the rl.line from our prompt. We can't rely on the content of\n // rl.line (mainly because of the password prompt), so just rely on it's\n // length.\n let prompt = rawPromptLine;\n if (this.rl.line.length > 0) {\n prompt = prompt.slice(0, -this.rl.line.length);\n }\n this.rl.setPrompt(prompt);\n // SetPrompt will change cursor position, now we can get correct value\n this.cursorPos = this.rl.getCursorPos();\n const width = readlineWidth();\n content = breakLines(content, width);\n bottomContent = breakLines(bottomContent, width);\n // Manually insert an extra line if we're at the end of the line.\n // This prevent the cursor from appearing at the beginning of the\n // current line.\n if (rawPromptLine.length % width === 0) {\n content += '\\n';\n }\n let output = content + (bottomContent ? '\\n' + bottomContent : '');\n /**\n * Re-adjust the cursor at the correct position.\n */\n // We need to consider parts of the prompt under the cursor as part of the bottom\n // content in order to correctly cleanup and re-render.\n const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;\n const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);\n // Return cursor to the input position (on top of the bottomContent)\n if (bottomContentHeight > 0)\n output += cursorUp(bottomContentHeight);\n // Return cursor to the initial left offset.\n output += cursorTo(this.cursorPos.cols);\n /**\n * Render and store state for future re-rendering\n */\n this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);\n this.extraLinesUnderPrompt = bottomContentHeight;\n this.height = height(output);\n }\n checkCursorPos() {\n const cursorPos = this.rl.getCursorPos();\n if (cursorPos.cols !== this.cursorPos.cols) {\n this.write(cursorTo(cursorPos.cols));\n this.cursorPos = cursorPos;\n }\n }\n done({ clearContent }) {\n this.rl.setPrompt('');\n let output = cursorDown(this.extraLinesUnderPrompt);\n output += clearContent ? eraseLines(this.height) : '\\n';\n output += cursorShow;\n this.write(output);\n this.rl.close();\n }\n}\n","// TODO: Remove this class once Node 22 becomes the minimum supported version.\nexport class PromisePolyfill extends Promise {\n // Available starting from Node 22\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers\n static withResolver() {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve, reject: reject };\n }\n}\n","import * as readline from 'node:readline';\nimport { AsyncResource } from 'node:async_hooks';\nimport MuteStream from 'mute-stream';\nimport { onExit as onSignalExit } from 'signal-exit';\nimport ScreenManager from \"./screen-manager.js\";\nimport { PromisePolyfill } from \"./promise-polyfill.js\";\nimport { withHooks, effectScheduler } from \"./hook-engine.js\";\nimport { AbortPromptError, CancelPromptError, ExitPromptError } from \"./errors.js\";\n// Capture the real setImmediate at module load time so it works even when test\n// frameworks mock timers with vi.useFakeTimers() or similar.\nconst nativeSetImmediate = globalThis.setImmediate;\nfunction getCallSites() {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const _prepareStackTrace = Error.prepareStackTrace;\n let result = [];\n try {\n Error.prepareStackTrace = (_, callSites) => {\n const callSitesWithoutCurrent = callSites.slice(1);\n result = callSitesWithoutCurrent;\n return callSitesWithoutCurrent;\n };\n // oxlint-disable-next-line no-unused-expressions\n new Error().stack;\n }\n catch {\n // An error will occur if the Node flag --frozen-intrinsics is used.\n // https://nodejs.org/api/cli.html#--frozen-intrinsics\n return result;\n }\n Error.prepareStackTrace = _prepareStackTrace;\n return result;\n}\nexport function createPrompt(view) {\n const callSites = getCallSites();\n const prompt = (config, context = {}) => {\n // Default `input` to stdin\n const { input = process.stdin, signal } = context;\n const cleanups = new Set();\n // Add mute capabilities to the output\n const output = new MuteStream();\n output.pipe(context.output ?? process.stdout);\n // Pre-mute the output so that readline doesn't echo stale keystrokes\n // to the terminal before the first render. ScreenManager will unmute/mute\n // the output around each render call as needed.\n output.mute();\n const rl = readline.createInterface({\n terminal: true,\n input,\n output,\n });\n const screen = new ScreenManager(rl);\n const { promise, resolve, reject } = PromisePolyfill.withResolver();\n const cancel = () => reject(new CancelPromptError());\n if (signal) {\n const abort = () => reject(new AbortPromptError({ cause: signal.reason }));\n if (signal.aborted) {\n abort();\n return Object.assign(promise, { cancel });\n }\n signal.addEventListener('abort', abort);\n cleanups.add(() => signal.removeEventListener('abort', abort));\n }\n cleanups.add(onSignalExit((code, signal) => {\n reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));\n }));\n // SIGINT must be explicitly handled by the prompt so the ExitPromptError can be handled.\n // Otherwise, the prompt will stop and in some scenarios never resolve.\n // Ref issue #1741\n const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));\n rl.on('SIGINT', sigint);\n cleanups.add(() => rl.removeListener('SIGINT', sigint));\n return withHooks(rl, (cycle) => {\n // The close event triggers immediately when the user press ctrl+c. SignalExit on the other hand\n // triggers after the process is done (which happens after timeouts are done triggering.)\n // We triggers the hooks cleanup phase on rl `close` so active timeouts can be cleared.\n const hooksCleanup = AsyncResource.bind(() => effectScheduler.clearAll());\n rl.on('close', hooksCleanup);\n cleanups.add(() => rl.removeListener('close', hooksCleanup));\n const startCycle = () => {\n // Re-renders only happen when the state change; but the readline cursor could\n // change position and that also requires a re-render (and a manual one because\n // we mute the streams). We set the listener after the initial workLoop to avoid\n // a double render if render triggered by a state change sets the cursor to the\n // right position.\n const checkCursorPos = () => screen.checkCursorPos();\n rl.input.on('keypress', checkCursorPos);\n cleanups.add(() => rl.input.removeListener('keypress', checkCursorPos));\n cycle(() => {\n try {\n const nextView = view(config, (value) => {\n setImmediate(() => resolve(value));\n });\n // Typescript won't allow this, but not all users rely on typescript.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (nextView === undefined) {\n const callerFilename = callSites[1]?.getFileName();\n throw new Error(`Prompt functions must return a string.\\n at ${callerFilename}`);\n }\n const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView;\n screen.render(content, bottomContent);\n effectScheduler.run();\n }\n catch (error) {\n reject(error);\n }\n });\n };\n // Proper Readable streams (like process.stdin) may have OS-level buffered\n // data that arrives in the poll phase when readline resumes the stream.\n // Deferring the first render by one setImmediate tick (check phase, after\n // poll) lets that stale data flow through readline harmlessly—no keypress\n // handlers are registered yet and the output is muted, so the stale\n // keystrokes are silently discarded.\n // Old-style streams (like MuteStream) have no such buffering, so the\n // render cycle starts immediately.\n //\n // @see https://github.com/SBoudrias/Inquirer.js/issues/1303\n if ('readableFlowing' in input) {\n nativeSetImmediate(startCycle);\n }\n else {\n startCycle();\n }\n return Object.assign(promise\n .then((answer) => {\n effectScheduler.clearAll();\n return answer;\n }, (error) => {\n effectScheduler.clearAll();\n throw error;\n })\n // Wait for the promise to settle, then cleanup.\n .finally(() => {\n cleanups.forEach((cleanup) => cleanup());\n screen.done({ clearContent: Boolean(context.clearPromptOnDone) });\n output.end();\n })\n // Once cleanup is done, let the expose promise resolve/reject to the internal one.\n .then(() => promise), { cancel });\n });\n };\n return prompt;\n}\n","import { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\n/**\n * Separator object\n * Used to space/separate choices group\n */\nexport class Separator {\n separator = styleText('dim', Array.from({ length: 15 }).join(figures.line));\n type = 'separator';\n constructor(separator) {\n if (separator) {\n this.separator = separator;\n }\n }\n static isSeparator(choice) {\n return Boolean(choice &&\n typeof choice === 'object' &&\n 'type' in choice &&\n choice.type === 'separator');\n }\n}\n","import { createPrompt, useState, useKeypress, useEffect, usePrefix, isBackspaceKey, isEnterKey, isTabKey, makeTheme, } from '@inquirer/core';\nconst inputTheme = {\n validationFailureMode: 'keep',\n};\nexport default createPrompt((config, done) => {\n const { prefill = 'tab' } = config;\n const theme = makeTheme(inputTheme, config.theme);\n const [status, setStatus] = useState('idle');\n // Coerce to string to handle runtime values that may be numbers despite TypeScript types\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const [defaultValue, setDefaultValue] = useState(String(config.default ?? ''));\n const [errorMsg, setError] = useState();\n const [value, setValue] = useState('');\n const prefix = usePrefix({ status, theme });\n async function validate(value) {\n const { required, pattern, patternError = 'Invalid input' } = config;\n if (required && !value) {\n return 'You must provide a value';\n }\n if (pattern && !pattern.test(value)) {\n return patternError;\n }\n if (typeof config.validate === 'function') {\n return (await config.validate(value)) || 'You must provide a valid value';\n }\n return true;\n }\n useKeypress(async (key, rl) => {\n // Ignore keypress while our prompt is doing other processing.\n if (status !== 'idle') {\n return;\n }\n if (isEnterKey(key)) {\n const answer = value || defaultValue;\n setStatus('loading');\n const isValid = await validate(answer);\n if (isValid === true) {\n setValue(answer);\n setStatus('done');\n done(answer);\n }\n else {\n if (theme.validationFailureMode === 'clear') {\n setValue('');\n }\n else {\n // Reset the readline line value to the previous value. On line event, the value\n // get cleared, forcing the user to re-enter the value instead of fixing it.\n rl.write(value);\n }\n setError(isValid);\n setStatus('idle');\n }\n }\n else if (isBackspaceKey(key) && !value) {\n setDefaultValue('');\n }\n else if (isTabKey(key) && !value) {\n setDefaultValue('');\n rl.clearLine(0); // Remove the tab character.\n rl.write(defaultValue);\n setValue(defaultValue);\n }\n else {\n setValue(rl.line);\n setError(undefined);\n }\n });\n // If prefill is set to 'editable' cut out the default value and paste into current state and the user's cli buffer\n // They can edit the value immediately instead of needing to press 'tab'\n useEffect((rl) => {\n if (prefill === 'editable' && defaultValue) {\n rl.write(defaultValue);\n setValue(defaultValue);\n }\n }, []);\n const message = theme.style.message(config.message, status);\n let formattedValue = value;\n if (typeof config.transformer === 'function') {\n formattedValue = config.transformer(value, { isFinal: status === 'done' });\n }\n else if (status === 'done') {\n formattedValue = theme.style.answer(value);\n }\n let defaultStr;\n if (defaultValue && status !== 'done' && !value) {\n defaultStr = theme.style.defaultAnswer(defaultValue);\n }\n let error = '';\n if (errorMsg) {\n error = theme.style.error(errorMsg);\n }\n return [\n [prefix, message, defaultStr, formattedValue]\n .filter((v) => v !== undefined)\n .join(' '),\n error,\n ];\n});\n","import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, useEffect, isBackspaceKey, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, ValidationError, makeTheme, } from '@inquirer/core';\nimport { cursorHide } from '@inquirer/ansi';\nimport { styleText } from 'node:util';\nimport figures from '@inquirer/figures';\nconst selectTheme = {\n icon: { cursor: figures.pointer },\n style: {\n disabled: (text) => styleText('dim', text),\n description: (text) => styleText('cyan', text),\n keysHelpTip: (keys) => keys\n .map(([key, action]) => `${styleText('bold', key)} ${styleText('dim', action)}`)\n .join(styleText('dim', ' • ')),\n },\n i18n: { disabledError: 'This option is disabled and cannot be selected.' },\n indexMode: 'hidden',\n keybindings: [],\n};\nfunction isSelectable(item) {\n return !Separator.isSeparator(item) && !item.disabled;\n}\nfunction isNavigable(item) {\n return !Separator.isSeparator(item);\n}\nfunction normalizeChoices(choices) {\n return choices.map((choice) => {\n if (Separator.isSeparator(choice))\n return choice;\n if (typeof choice !== 'object' || choice === null || !('value' in choice)) {\n // It's a raw value (string, number, etc.)\n const name = String(choice);\n return {\n value: choice,\n name,\n short: name,\n disabled: false,\n };\n }\n const name = choice.name ?? String(choice.value);\n const normalizedChoice = {\n value: choice.value,\n name,\n short: choice.short ?? name,\n disabled: choice.disabled ?? false,\n };\n if (choice.description) {\n normalizedChoice.description = choice.description;\n }\n return normalizedChoice;\n });\n}\nexport default createPrompt((config, done) => {\n const { loop = true, pageSize = 7 } = config;\n const theme = makeTheme(selectTheme, config.theme);\n const { keybindings } = theme;\n const [status, setStatus] = useState('idle');\n const prefix = usePrefix({ status, theme });\n const searchTimeoutRef = useRef();\n // Vim keybindings (j/k) conflict with typing those letters in search,\n // so search must be disabled when vim bindings are enabled\n const searchEnabled = !keybindings.includes('vim');\n const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);\n const bounds = useMemo(() => {\n const first = items.findIndex(isNavigable);\n const last = items.findLastIndex(isNavigable);\n if (first === -1) {\n throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');\n }\n return { first, last };\n }, [items]);\n const defaultItemIndex = useMemo(() => {\n if (!('default' in config))\n return -1;\n return items.findIndex((item) => isSelectable(item) && item.value === config.default);\n }, [config.default, items]);\n const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);\n // Safe to assume the cursor position always point to a Choice.\n const selectedChoice = items[active];\n const [errorMsg, setError] = useState();\n useKeypress((key, rl) => {\n clearTimeout(searchTimeoutRef.current);\n if (errorMsg) {\n setError(undefined);\n }\n if (isEnterKey(key)) {\n if (selectedChoice.disabled) {\n setError(theme.i18n.disabledError);\n }\n else {\n setStatus('done');\n done(selectedChoice.value);\n }\n }\n else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {\n rl.clearLine(0);\n if (loop ||\n (isUpKey(key, keybindings) && active !== bounds.first) ||\n (isDownKey(key, keybindings) && active !== bounds.last)) {\n const offset = isUpKey(key, keybindings) ? -1 : 1;\n let next = active;\n do {\n next = (next + offset + items.length) % items.length;\n } while (!isNavigable(items[next]));\n setActive(next);\n }\n }\n else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {\n const selectedIndex = Number(rl.line) - 1;\n // Find the nth item (ignoring separators)\n let selectableIndex = -1;\n const position = items.findIndex((item) => {\n if (Separator.isSeparator(item))\n return false;\n selectableIndex++;\n return selectableIndex === selectedIndex;\n });\n const item = items[position];\n if (item != null && isSelectable(item)) {\n setActive(position);\n }\n searchTimeoutRef.current = setTimeout(() => {\n rl.clearLine(0);\n }, 700);\n }\n else if (isBackspaceKey(key)) {\n rl.clearLine(0);\n }\n else if (searchEnabled) {\n const searchTerm = rl.line.toLowerCase();\n const matchIndex = items.findIndex((item) => {\n if (Separator.isSeparator(item) || !isSelectable(item))\n return false;\n return item.name.toLowerCase().startsWith(searchTerm);\n });\n if (matchIndex !== -1) {\n setActive(matchIndex);\n }\n searchTimeoutRef.current = setTimeout(() => {\n rl.clearLine(0);\n }, 700);\n }\n });\n useEffect(() => () => {\n clearTimeout(searchTimeoutRef.current);\n }, []);\n const message = theme.style.message(config.message, status);\n const helpLine = theme.style.keysHelpTip([\n ['↑↓', 'navigate'],\n ['⏎', 'select'],\n ]);\n let separatorCount = 0;\n const page = usePagination({\n items,\n active,\n renderItem({ item, isActive, index }) {\n if (Separator.isSeparator(item)) {\n separatorCount++;\n return ` ${item.separator}`;\n }\n const cursor = isActive ? theme.icon.cursor : ' ';\n const indexLabel = theme.indexMode === 'number' ? `${index + 1 - separatorCount}. ` : '';\n if (item.disabled) {\n const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';\n const disabledCursor = isActive ? theme.icon.cursor : '-';\n return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);\n }\n const color = isActive ? theme.style.highlight : (x) => x;\n return color(`${cursor} ${indexLabel}${item.name}`);\n },\n pageSize,\n loop,\n });\n if (status === 'done') {\n return [prefix, message, theme.style.answer(selectedChoice.short)]\n .filter(Boolean)\n .join(' ');\n }\n const { description } = selectedChoice;\n const lines = [\n [prefix, message].filter(Boolean).join(' '),\n page,\n ' ',\n description ? theme.style.description(description) : '',\n errorMsg ? theme.style.error(errorMsg) : '',\n helpLine,\n ]\n .filter(Boolean)\n .join('\\n')\n .trimEnd();\n return `${lines}${cursorHide}`;\n});\nexport { Separator } from '@inquirer/core';\n","import input from \"@inquirer/input\"\nimport select from \"@inquirer/select\"\nimport { colorize } from \"./colors\"\nimport { ScaffoldCmdConfig, ScaffoldConfig, ScaffoldConfigMap, ScaffoldInput } from \"./types\"\n\n/** Prompts the user for a scaffold name. */\nexport async function promptForName(): Promise<string> {\n return input({\n message: colorize.cyan(\"Scaffold name:\"),\n required: true,\n validate: (value) => {\n if (!value.trim()) return \"Name cannot be empty\"\n return true\n },\n })\n}\n\n/** Prompts the user to select a template key from the available config keys. */\nexport async function promptForTemplateKey(configMap: ScaffoldConfigMap): Promise<string> {\n const keys = Object.keys(configMap)\n if (keys.length === 0) {\n throw new Error(\"No templates found in config file\")\n }\n if (keys.length === 1) {\n return keys[0]\n }\n return select({\n message: colorize.cyan(\"Select a template:\"),\n choices: keys.map((key) => ({\n name: key,\n value: key,\n })),\n })\n}\n\n/** Prompts the user for an output directory path. */\nexport async function promptForOutput(): Promise<string> {\n return input({\n message: colorize.cyan(\"Output directory:\"),\n required: true,\n default: \".\",\n validate: (value) => {\n if (!value.trim()) return \"Output directory cannot be empty\"\n return true\n },\n })\n}\n\n/** Prompts the user for template paths (comma-separated). */\nexport async function promptForTemplates(): Promise<string[]> {\n const value = await input({\n message: colorize.cyan(\"Template paths (comma-separated):\"),\n required: true,\n validate: (value) => {\n if (!value.trim()) return \"At least one template path is required\"\n return true\n },\n })\n return value.split(\",\").map((t) => t.trim()).filter(Boolean)\n}\n\n/**\n * Prompts the user for any required scaffold inputs that are not already provided in data.\n * Also applies default values for optional inputs that have one.\n * Returns the merged data object.\n */\nexport async function promptForInputs(\n inputs: Record<string, ScaffoldInput>,\n existingData: Record<string, unknown> = {},\n): Promise<Record<string, unknown>> {\n const data = { ...existingData }\n\n for (const [key, def] of Object.entries(inputs)) {\n // Skip if already provided via data/CLI\n if (key in data && data[key] !== undefined && data[key] !== \"\") {\n continue\n }\n\n if (def.required) {\n data[key] = await input({\n message: colorize.cyan(def.message ?? `${key}:`),\n required: true,\n default: def.default,\n validate: (value) => {\n if (!value.trim()) return `${key} is required`\n return true\n },\n })\n } else if (def.default !== undefined && !(key in data)) {\n data[key] = def.default\n }\n }\n\n return data\n}\n\n/** Returns true if the process is running in an interactive terminal. */\nexport function isInteractive(): boolean {\n return Boolean(process.stdin.isTTY)\n}\n\n/**\n * Fills in missing config values by prompting the user interactively.\n * Only prompts when running in a TTY — in non-interactive mode, returns config as-is.\n */\nexport async function promptForMissingConfig(\n config: ScaffoldCmdConfig,\n configMap?: ScaffoldConfigMap,\n): Promise<ScaffoldCmdConfig> {\n if (!isInteractive()) {\n return config\n }\n\n if (!config.name) {\n config.name = await promptForName()\n }\n\n if (configMap && !config.key) {\n const keys = Object.keys(configMap)\n if (keys.length > 1) {\n config.key = await promptForTemplateKey(configMap)\n }\n }\n\n if (!config.output) {\n config.output = await promptForOutput()\n }\n\n if (!config.templates || config.templates.length === 0) {\n config.templates = await promptForTemplates()\n }\n\n return config\n}\n\n/**\n * Prompts for any required inputs defined in the scaffold config and merges them into data.\n * Only prompts in interactive mode; in non-interactive mode, only applies defaults.\n */\nexport async function resolveInputs(config: ScaffoldConfig): Promise<ScaffoldConfig> {\n if (!config.inputs) {\n return config\n }\n\n const interactive = isInteractive()\n\n if (interactive) {\n config.data = await promptForInputs(config.inputs, config.data)\n } else {\n // Non-interactive: only apply defaults\n const data = { ...config.data }\n for (const [key, def] of Object.entries(config.inputs)) {\n if (def.default !== undefined && !(key in data)) {\n data[key] = def.default\n }\n }\n config.data = data\n }\n\n return config\n}\n","/**\n * @module\n * Simple Scaffold\n *\n * See [readme](README.md)\n */\nimport path from \"node:path\"\nimport os from \"node:os\"\n\nimport { handleErr, resolve } from \"./utils\"\nimport { isDir, getTemplateGlobInfo, getFileList, handleTemplateFile, GlobInfo } from \"./file\"\nimport { removeGlob, makeRelativePath, getBasePath } from \"./path-utils\"\nimport { LogLevel, MinimalConfig, Resolver, ScaffoldCmdConfig, ScaffoldConfig } from \"./types\"\nimport { registerHelpers } from \"./parser\"\nimport { log, logInitStep } from \"./logger\"\nimport { parseConfigFile } from \"./config\"\nimport { resolveInputs } from \"./prompts\"\n\n/**\n * Create a scaffold using given `options`.\n *\n * #### Create files\n * To create a file structure to output, use any directory and file structure you would like.\n * Inside folder names, file names or file contents, you may place `{{ var }}` where `var` is either\n * `name` which is the scaffold name you provided or one of the keys you provided in the `data` option.\n *\n * The contents and names will be replaced with the transformed values so you can use your original structure as a\n * boilerplate for other projects, components, modules, or even single files.\n *\n * The files will maintain their structure, starting from the directory containing the template (or the template itself\n * if it is already a directory), and will output from that directory into the directory defined by `config.output`.\n *\n * #### Helpers\n * Helpers are functions you can use to transform your `{{ var }}` contents into other values without having to\n * pre-define the data and use a duplicated key.\n *\n * Any functions you provide in `helpers` option will also be available to you to make custom formatting as you see fit\n * (for example, formatting a date)\n *\n * For available default values, see {@link DefaultHelpers}.\n *\n * @param {ScaffoldConfig} config The main configuration object\n * @return {Promise<void>} A promise that resolves when the scaffold is complete\n *\n * @see {@link DefaultHelpers}\n * @see {@link CaseHelpers}\n * @see {@link DateHelpers}\n *\n * @category Main\n */\nexport async function Scaffold(config: ScaffoldConfig): Promise<void> {\n config.output ??= process.cwd()\n\n config = await resolveInputs(config)\n registerHelpers(config)\n try {\n config.data = { name: config.name, ...config.data }\n logInitStep(config)\n\n const excludes = config.templates.filter((t) => t.startsWith(\"!\"))\n const includes = config.templates.filter((t) => !t.startsWith(\"!\"))\n\n const templates = await resolveTemplateGlobs(config, includes)\n\n for (const tpl of templates) {\n await processTemplateGlob(config, tpl, excludes)\n }\n } catch (e: unknown) {\n log(config, LogLevel.error, e)\n throw e\n }\n}\n\n/** Resolves included template paths into GlobInfo objects. */\nasync function resolveTemplateGlobs(config: ScaffoldConfig, includes: string[]): Promise<GlobInfo[]> {\n const templates: GlobInfo[] = []\n for (const includedTemplate of includes) {\n try {\n templates.push(await getTemplateGlobInfo(config, includedTemplate))\n } catch (e: unknown) {\n handleErr(e as NodeJS.ErrnoException)\n }\n }\n return templates\n}\n\n/** Processes all files matching a single template glob pattern. */\nasync function processTemplateGlob(config: ScaffoldConfig, tpl: GlobInfo, excludes: string[]): Promise<void> {\n const files = await getFileList(config, [tpl.template, ...excludes])\n for (const file of files) {\n if (await isDir(file)) {\n continue\n }\n log(config, LogLevel.debug, \"Iterating files\", { files, file })\n const relPath = makeRelativePath(path.dirname(removeGlob(file).replace(tpl.baseTemplatePath, \"\")))\n const basePath = getBasePath(relPath)\n\n log(config, LogLevel.debug, {\n originalTemplate: tpl.origTemplate,\n relativePath: relPath,\n parsedTemplate: tpl.template,\n inputFilePath: file,\n baseTemplatePath: tpl.baseTemplatePath,\n basePath,\n isDirOrGlob: tpl.isDirOrGlob,\n isGlob: tpl.isGlob,\n })\n\n await handleTemplateFile(config, { templatePath: file, basePath })\n }\n}\n\n/**\n * Create a scaffold based on a config file or URL.\n *\n * @param {string} pathOrUrl The path or URL to the config file\n * @param {Record<string, string>} config Information needed before loading the config\n * @param {Partial<Omit<ScaffoldConfig, 'name'>>} overrides Any overrides to the loaded config\n *\n * @see {@link Scaffold}\n * @category Main\n * @return {Promise<void>} A promise that resolves when the scaffold is complete\n */\nScaffold.fromConfig = async function (\n pathOrUrl: string,\n config: MinimalConfig,\n overrides?: Resolver<ScaffoldCmdConfig, Partial<Omit<ScaffoldConfig, \"name\">>>,\n): Promise<void> {\n const tmpPath = path.resolve(os.tmpdir(), `scaffold-config-${Date.now()}`)\n const _cmdConfig: ScaffoldCmdConfig = {\n dryRun: false,\n output: process.cwd(),\n logLevel: LogLevel.info,\n overwrite: false,\n templates: [],\n subdir: false,\n quiet: false,\n config: pathOrUrl,\n version: false,\n tmpDir: tmpPath,\n ...config,\n }\n const _overrides = resolve(overrides, _cmdConfig)\n const _config = await parseConfigFile(_cmdConfig)\n return Scaffold({ ..._config, ..._overrides })\n}\n\nexport default Scaffold\n"],"x_google_ignoreList":[12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,WAAW;CACf,OAAO;CACP,KAAK;CACL,MAAM;CACN,QAAQ;CACR,WAAW;CACX,KAAK;CACL,OAAO;CACP,QAA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,iBAAiB,UAAA,QAAK,QAAQ,WAAW,KAAK,CAAC,QAAQ,IAAI,kBAAkB,GAAG,CAAC,CAAC;EAClG,MAAM,WAAW,YAAY,QAAQ;AAErC,MAAI,QAAQ,SAAS,OAAO;GAC1B,kBAAkB,IAAI;GACtB,cAAc;GACd,gBAAgB,IAAI;GACpB,eAAe;GACf,kBAAkB,IAAI;GACtB;GACA,aAAa,IAAI;GACjB,QAAQ,IAAI;GACb,CAAC;AAEF,QAAM,mBAAmB,QAAQ;GAAE,cAAc;GAAM;GAAU,CAAC;;;;;;;;;;;;;;AAetE,SAAS,aAAa,eACpB,WACA,QACA,WACe;CACf,MAAM,UAAU,UAAA,QAAK,QAAQ,QAAA,QAAG,QAAQ,EAAE,mBAAmB,KAAK,KAAK,GAAG;CAC1E,MAAM,aAAgC;EACpC,QAAQ;EACR,QAAQ,QAAQ,KAAK;EACrB,UAAU,SAAS;EACnB,WAAW;EACX,WAAW,EAAE;EACb,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,GAAG;EACJ;CACD,MAAM,aAAa,QAAQ,WAAW,WAAW;AAEjD,QAAO,SAAS;EAAE,GADF,MAAM,gBAAgB,WAAW;EACnB,GAAG;EAAY,CAAC"}
package/types.d.ts CHANGED
@@ -51,7 +51,7 @@ export interface ScaffoldConfig {
51
51
  *
52
52
  * This can be any object that will be usable by Handlebars.
53
53
  */
54
- data?: Record<string, any>;
54
+ data?: Record<string, unknown>;
55
55
  /**
56
56
  * Enable to override output files, even if they already exist.
57
57
  *
@@ -150,9 +150,44 @@ export interface ScaffoldConfig {
150
150
  * contents-only, after further modifications - or `undefined` to use the original content (i.e. `content.toString()`)
151
151
  */
152
152
  beforeWrite?(content: Buffer, rawContent: Buffer, outputPath: string): string | Buffer | undefined | Promise<string | Buffer | undefined>;
153
+ /**
154
+ * Defines interactive inputs for the template. Each input becomes a template data variable.
155
+ *
156
+ * When running interactively, required inputs that are not already provided via `data` or CLI args
157
+ * will be prompted for. Optional inputs without a value will use their `default` if defined.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * Scaffold({
162
+ * // ...
163
+ * inputs: {
164
+ * author: { message: "Author name", required: true },
165
+ * license: { message: "License", default: "MIT" },
166
+ * },
167
+ * })
168
+ * ```
169
+ *
170
+ * In templates: `{{ author }}`, `{{ license }}`
171
+ *
172
+ * @see {@link ScaffoldInput}
173
+ */
174
+ inputs?: Record<string, ScaffoldInput>;
153
175
  /** @internal */
154
176
  tmpDir?: string;
155
177
  }
178
+ /**
179
+ * Defines a single interactive input for a scaffold template.
180
+ *
181
+ * @category Config
182
+ */
183
+ export interface ScaffoldInput {
184
+ /** The prompt message shown to the user. Defaults to the input key name if omitted. */
185
+ message?: string;
186
+ /** Whether this input must be provided. If true and missing, the user will be prompted interactively. */
187
+ required?: boolean;
188
+ /** Default value used when the user doesn't provide one. */
189
+ default?: string;
190
+ }
156
191
  /**
157
192
  * The names of the available helper functions that relate to text capitalization.
158
193
  *
@@ -374,7 +409,7 @@ export type ScaffoldConfigMap = Record<string, ScaffoldConfig>;
374
409
  */
375
410
  export type ScaffoldConfigFile = AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>;
376
411
  /** @internal */
377
- export type Resolver<T, R = T> = R | ((value: T) => R);
412
+ export type Resolver<T, R = T> = R | ((_value: T) => R);
378
413
  /** @internal */
379
414
  export type AsyncResolver<T, R = T> = Resolver<T, Promise<R> | R>;
380
415
  /** @internal */
@@ -385,4 +420,5 @@ export type ConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, "config">;
385
420
  export type RemoteConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, "config" | "git" | "tmpDir">;
386
421
  /** @internal */
387
422
  export type MinimalConfig = Pick<ScaffoldCmdConfig, "name" | "key">;
423
+ /** @internal */
388
424
  export type ListCommandCliOptions = Pick<ScaffoldCmdConfig, "config" | "git" | "logLevel" | "quiet">;
package/utils.d.ts CHANGED
@@ -1,28 +1,8 @@
1
1
  import { Resolver } from "./types";
2
+ export { colorize, type TermColor } from "./colors";
3
+ /** Throws the error if non-null, no-ops otherwise. */
2
4
  export declare function handleErr(err: NodeJS.ErrnoException | null): void;
5
+ /** Resolves a value that may be either a static value or a function that produces one. */
3
6
  export declare function resolve<T, R = T>(resolver: Resolver<T, R>, arg: T): R;
7
+ /** Wraps a static value in a resolver function. If already a function, returns as-is. */
4
8
  export declare function wrapNoopResolver<T, R = T>(value: Resolver<T, R>): Resolver<T, R>;
5
- declare const colorMap: {
6
- readonly reset: 0;
7
- readonly dim: 2;
8
- readonly bold: 1;
9
- readonly italic: 3;
10
- readonly underline: 4;
11
- readonly red: 31;
12
- readonly green: 32;
13
- readonly yellow: 33;
14
- readonly blue: 34;
15
- readonly magenta: 35;
16
- readonly cyan: 36;
17
- readonly white: 37;
18
- readonly gray: 90;
19
- };
20
- export type TermColor = keyof typeof colorMap;
21
- declare function _colorize(text: string, color: TermColor): string;
22
- declare const createColorize: (color: TermColor) => (template: TemplateStringsArray | unknown, ...params: unknown[]) => string;
23
- type TemplateStringsFn = ReturnType<typeof createColorize> & ((text: string) => string);
24
- type TemplateStringsFns = {
25
- [key in TermColor]: TemplateStringsFn;
26
- };
27
- export declare const colorize: typeof _colorize & TemplateStringsFns;
28
- export {};