@brucewaynedecoy/make-docs 1.0.0-rc.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/LICENSE +21 -201
  2. package/README.md +36 -27
  3. package/dist/backup-73HQNKMC.js +20 -0
  4. package/dist/backup-73HQNKMC.js.map +1 -0
  5. package/dist/chunk-3BAJQXGH.js +1575 -0
  6. package/dist/chunk-3BAJQXGH.js.map +1 -0
  7. package/dist/chunk-64CTKJO7.js +4136 -0
  8. package/dist/chunk-64CTKJO7.js.map +1 -0
  9. package/dist/chunk-BENO4IH5.js +875 -0
  10. package/dist/chunk-BENO4IH5.js.map +1 -0
  11. package/dist/chunk-D4HDZEJT.js +37 -0
  12. package/dist/chunk-D4HDZEJT.js.map +1 -0
  13. package/dist/chunk-G5EF63GG.js +1291 -0
  14. package/dist/chunk-G5EF63GG.js.map +1 -0
  15. package/dist/chunk-GNP6HRVP.js +523 -0
  16. package/dist/chunk-GNP6HRVP.js.map +1 -0
  17. package/dist/chunk-HJYIQTMD.js +204 -0
  18. package/dist/chunk-HJYIQTMD.js.map +1 -0
  19. package/dist/chunk-LQ5NSWCJ.js +39 -0
  20. package/dist/chunk-LQ5NSWCJ.js.map +1 -0
  21. package/dist/chunk-LRVV7UDD.js +2340 -0
  22. package/dist/chunk-LRVV7UDD.js.map +1 -0
  23. package/dist/chunk-LVQSJF63.js +24674 -0
  24. package/dist/chunk-LVQSJF63.js.map +1 -0
  25. package/dist/chunk-MXBHCHSM.js +13995 -0
  26. package/dist/chunk-MXBHCHSM.js.map +1 -0
  27. package/dist/chunk-Z5K4FHYP.js +922 -0
  28. package/dist/chunk-Z5K4FHYP.js.map +1 -0
  29. package/dist/index.js +3798 -250
  30. package/dist/index.js.map +1 -1
  31. package/dist/self-YYXOLDKU.js +653 -0
  32. package/dist/self-YYXOLDKU.js.map +1 -0
  33. package/dist/server-O2ZELIMX.js +512 -0
  34. package/dist/server-O2ZELIMX.js.map +1 -0
  35. package/dist/setup-system-HZROFNMP.js +544 -0
  36. package/dist/setup-system-HZROFNMP.js.map +1 -0
  37. package/dist/{skills-command-3ESCZ75U.js → skills-command-MGGHY7HU.js} +190 -32
  38. package/dist/skills-command-MGGHY7HU.js.map +1 -0
  39. package/dist/uninstall-3UXXXNFO.js +223 -0
  40. package/dist/uninstall-3UXXXNFO.js.map +1 -0
  41. package/dist/virtual_make-docs-first-party-skills-ZII74YOB.js +11 -0
  42. package/dist/virtual_make-docs-first-party-skills-ZII74YOB.js.map +1 -0
  43. package/package.json +9 -6
  44. package/skill-registry.json +328 -125
  45. package/skill-registry.schema.json +221 -45
  46. package/template/.make-docs/AGENTS.md +18 -0
  47. package/template/.make-docs/CLAUDE.md +18 -0
  48. package/template/.make-docs/archive/AGENTS.md +11 -0
  49. package/template/.make-docs/archive/CLAUDE.md +11 -0
  50. package/template/.make-docs/system/AGENTS.md +12 -0
  51. package/template/.make-docs/system/CLAUDE.md +12 -0
  52. package/template/.make-docs/system/contracts/AGENTS.md +13 -0
  53. package/template/.make-docs/system/contracts/CLAUDE.md +13 -0
  54. package/template/{docs/assets/references → .make-docs/system/contracts}/commit-message-convention.md +4 -4
  55. package/template/.make-docs/system/contracts/coverage-pass-contract.md +198 -0
  56. package/template/.make-docs/system/contracts/deferred-obligation-contract.md +128 -0
  57. package/template/{docs/assets/references → .make-docs/system/contracts}/design-contract.md +7 -2
  58. package/template/{docs/assets/references → .make-docs/system/contracts}/guide-contract.md +21 -19
  59. package/template/{docs/assets/references → .make-docs/system/contracts}/history-record-contract.md +17 -11
  60. package/template/.make-docs/system/contracts/human-experience-contract.md +134 -0
  61. package/template/.make-docs/system/contracts/naive-uat-contract.md +231 -0
  62. package/template/.make-docs/system/contracts/output-contract.md +277 -0
  63. package/template/.make-docs/system/contracts/performance-evidence-governance.md +257 -0
  64. package/template/.make-docs/system/contracts/system-resource-contract.md +93 -0
  65. package/template/.make-docs/system/prompts/AGENTS.md +12 -0
  66. package/template/.make-docs/system/prompts/CLAUDE.md +12 -0
  67. package/template/.make-docs/system/prompts/coverage-pass-maintainer-guide.prompt.md +20 -0
  68. package/template/.make-docs/system/prompts/coverage-pass-prd-reconciliation.prompt.md +18 -0
  69. package/template/.make-docs/system/prompts/coverage-pass-testing-uat.prompt.md +46 -0
  70. package/template/.make-docs/system/prompts/coverage-pass-user-guide.prompt.md +20 -0
  71. package/template/.make-docs/system/prompts/designs-to-plan-change.prompt.md +18 -0
  72. package/template/.make-docs/system/prompts/designs-to-plan.prompt.md +14 -0
  73. package/template/.make-docs/system/prompts/docs-path-hygiene-cleanup.prompt.md +29 -0
  74. package/template/.make-docs/system/prompts/naive-uat-facilitator.prompt.md +28 -0
  75. package/template/.make-docs/system/prompts/naive-uat-tester.prompt.md +20 -0
  76. package/template/.make-docs/system/prompts/performance-coverage.prompt.md +63 -0
  77. package/template/.make-docs/system/prompts/plan-to-prd-change.prompt.md +12 -0
  78. package/template/.make-docs/system/prompts/plan-to-prd-green-field.prompt.md +10 -0
  79. package/template/.make-docs/system/prompts/prd-change-to-work.prompt.md +14 -0
  80. package/template/.make-docs/system/prompts/prd-to-work-full-prd.prompt.md +10 -0
  81. package/template/.make-docs/system/prompts/prd-to-work-prd-feature.prompt.md +10 -0
  82. package/template/.make-docs/system/prompts/request-to-design.prompt.md +20 -0
  83. package/template/.make-docs/system/prompts/session-to-history-record.prompt.md +23 -0
  84. package/template/{docs/assets → .make-docs/system}/prompts/work-to-commit-message.prompt.md +2 -2
  85. package/template/.make-docs/system/prompts/work-to-guides.prompt.md +22 -0
  86. package/template/.make-docs/system/references/AGENTS.md +14 -0
  87. package/template/.make-docs/system/references/CLAUDE.md +14 -0
  88. package/template/{docs/assets → .make-docs/system}/references/design-workflow.md +15 -2
  89. package/template/.make-docs/system/references/execution-workflow.md +189 -0
  90. package/template/.make-docs/system/references/human-experience.md +138 -0
  91. package/template/.make-docs/system/references/lifecycle.md +153 -0
  92. package/template/.make-docs/system/references/naive-uat-validation.md +65 -0
  93. package/template/.make-docs/system/references/naive-uat-workflow.md +64 -0
  94. package/template/.make-docs/system/references/path-and-link-hygiene.md +101 -0
  95. package/template/.make-docs/system/references/performance-evidence.md +114 -0
  96. package/template/.make-docs/system/references/planning-workflow.md +209 -0
  97. package/template/.make-docs/system/references/prd-change-management.md +165 -0
  98. package/template/{docs/assets → .make-docs/system}/references/wave-model.md +10 -8
  99. package/template/.make-docs/system/templates/AGENTS.md +12 -0
  100. package/template/.make-docs/system/templates/CLAUDE.md +12 -0
  101. package/template/.make-docs/system/templates/design.md +79 -0
  102. package/template/{docs/assets/templates/guide-developer.md → .make-docs/system/templates/guide-maintainer.md} +7 -3
  103. package/template/{docs/assets → .make-docs/system}/templates/guide-user.md +6 -2
  104. package/template/{docs/assets → .make-docs/system}/templates/history-record.md +6 -3
  105. package/template/.make-docs/system/templates/naive-uat-scenario.md +91 -0
  106. package/template/.make-docs/system/templates/performance-evidence-profile.md +252 -0
  107. package/template/.make-docs/system/templates/plan-overview.md +76 -0
  108. package/template/.make-docs/system/templates/plan-prd-change.md +155 -0
  109. package/template/{docs/assets → .make-docs/system}/templates/plan-prd-decompose.md +10 -0
  110. package/template/{docs/assets → .make-docs/system}/templates/plan-prd.md +28 -2
  111. package/template/{docs/assets → .make-docs/system}/templates/prd-architecture.md +13 -0
  112. package/template/.make-docs/system/templates/prd-glossary.md +28 -0
  113. package/template/.make-docs/system/templates/prd-index.md +70 -0
  114. package/template/{docs/assets → .make-docs/system}/templates/prd-overview.md +13 -0
  115. package/template/.make-docs/system/templates/prd-reference.md +30 -0
  116. package/template/{docs/assets → .make-docs/system}/templates/prd-risk-register.md +16 -1
  117. package/template/{docs/assets → .make-docs/system}/templates/prd-subsystem.md +15 -0
  118. package/template/.make-docs/system/templates/work-index.md +58 -0
  119. package/template/.make-docs/system/templates/work-phase.md +107 -0
  120. package/template/.make-docs/system-resources.catalog.json +91 -0
  121. package/template/.make-docs/system-resources.schema.json +204 -0
  122. package/template/AGENTS.md +8 -1
  123. package/template/CLAUDE.md +8 -1
  124. package/template/docs/AGENTS.codex-only.md +22 -0
  125. package/template/docs/AGENTS.md +21 -13
  126. package/template/docs/CLAUDE.claude-only.md +22 -0
  127. package/template/docs/CLAUDE.md +21 -13
  128. package/template/docs/assets/AGENTS.md +11 -7
  129. package/template/docs/assets/CLAUDE.md +11 -7
  130. package/template/docs/designs/AGENTS.md +8 -3
  131. package/template/docs/designs/CLAUDE.md +8 -3
  132. package/template/docs/plans/AGENTS.md +10 -3
  133. package/template/docs/plans/CLAUDE.md +10 -3
  134. package/template/docs/prd/AGENTS.md +14 -4
  135. package/template/docs/prd/CLAUDE.md +14 -4
  136. package/template/docs/work/AGENTS.md +10 -3
  137. package/template/docs/work/CLAUDE.md +10 -3
  138. package/dist/chunk-HP3HBG7F.js +0 -626
  139. package/dist/chunk-HP3HBG7F.js.map +0 -1
  140. package/dist/chunk-QRFH4J6H.js +0 -1194
  141. package/dist/chunk-QRFH4J6H.js.map +0 -1
  142. package/dist/chunk-WM3OXYTW.js +0 -2630
  143. package/dist/chunk-WM3OXYTW.js.map +0 -1
  144. package/dist/skills-command-3ESCZ75U.js.map +0 -1
  145. package/dist/uninstall-GQE4SJF2.js +0 -150
  146. package/dist/uninstall-GQE4SJF2.js.map +0 -1
  147. package/template/.make-docs/scripts/check_path_hygiene.py +0 -435
  148. package/template/docs/assets/archive/AGENTS.md +0 -20
  149. package/template/docs/assets/archive/CLAUDE.md +0 -20
  150. package/template/docs/assets/history/AGENTS.md +0 -12
  151. package/template/docs/assets/history/CLAUDE.md +0 -12
  152. package/template/docs/assets/prompts/AGENTS.md +0 -8
  153. package/template/docs/assets/prompts/CLAUDE.md +0 -8
  154. package/template/docs/assets/prompts/designs-to-plan-change.prompt.md +0 -14
  155. package/template/docs/assets/prompts/designs-to-plan.prompt.md +0 -10
  156. package/template/docs/assets/prompts/docs-path-hygiene-cleanup.prompt.md +0 -27
  157. package/template/docs/assets/prompts/plan-to-prd-change.prompt.md +0 -8
  158. package/template/docs/assets/prompts/plan-to-prd-green-field.prompt.md +0 -6
  159. package/template/docs/assets/prompts/prd-change-to-work.prompt.md +0 -10
  160. package/template/docs/assets/prompts/prd-to-work-full-prd.prompt.md +0 -6
  161. package/template/docs/assets/prompts/prd-to-work-prd-feature.prompt.md +0 -6
  162. package/template/docs/assets/prompts/request-to-design.prompt.md +0 -16
  163. package/template/docs/assets/prompts/session-to-history-record.prompt.md +0 -19
  164. package/template/docs/assets/prompts/work-to-guides.prompt.md +0 -18
  165. package/template/docs/assets/references/AGENTS.md +0 -9
  166. package/template/docs/assets/references/CLAUDE.md +0 -9
  167. package/template/docs/assets/references/execution-workflow.md +0 -157
  168. package/template/docs/assets/references/output-contract.md +0 -221
  169. package/template/docs/assets/references/path-and-link-hygiene.md +0 -49
  170. package/template/docs/assets/references/planning-workflow.md +0 -160
  171. package/template/docs/assets/references/prd-change-management.md +0 -129
  172. package/template/docs/assets/templates/AGENTS.md +0 -8
  173. package/template/docs/assets/templates/CLAUDE.md +0 -8
  174. package/template/docs/assets/templates/design.md +0 -30
  175. package/template/docs/assets/templates/plan-overview.md +0 -32
  176. package/template/docs/assets/templates/plan-prd-change.md +0 -99
  177. package/template/docs/assets/templates/prd-change-addition.md +0 -45
  178. package/template/docs/assets/templates/prd-change-revision.md +0 -45
  179. package/template/docs/assets/templates/prd-glossary.md +0 -15
  180. package/template/docs/assets/templates/prd-index.md +0 -45
  181. package/template/docs/assets/templates/prd-reference.md +0 -17
  182. package/template/docs/assets/templates/work-index.md +0 -21
  183. package/template/docs/assets/templates/work-phase.md +0 -34
  184. package/template/docs/guides/AGENTS.md +0 -15
  185. package/template/docs/guides/CLAUDE.md +0 -15
  186. /package/template/{docs/assets → .make-docs/system}/prompts/update-readme-green-field.prompt.md +0 -0
  187. /package/template/{docs/assets → .make-docs/system}/references/harness-capability-matrix.md +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/sisteransi/src/index.js","../../../node_modules/@clack/core/src/utils/cursor.ts","../../../node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js","../../../node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js","../../../node_modules/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js","../../../node_modules/node_modules/.pnpm/fast-wrap-ansi@0.1.3/node_modules/fast-wrap-ansi/lib/main.js","../../../node_modules/@clack/core/src/utils/settings.ts","../../../node_modules/@clack/core/src/utils/string.ts","../../../node_modules/@clack/core/src/utils/index.ts","../../../node_modules/@clack/core/src/prompts/prompt.ts","../../../node_modules/@clack/core/src/prompts/autocomplete.ts","../../../node_modules/@clack/core/src/prompts/confirm.ts","../../../node_modules/@clack/core/src/prompts/group-multiselect.ts","../../../node_modules/@clack/core/src/prompts/multi-select.ts","../../../node_modules/@clack/core/src/prompts/password.ts","../../../node_modules/@clack/core/src/prompts/select.ts","../../../node_modules/@clack/core/src/prompts/select-key.ts","../../../node_modules/@clack/core/src/prompts/text.ts","../../../node_modules/node_modules/.pnpm/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js","../../../node_modules/@clack/prompts/src/common.ts","../../../node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js","../../../node_modules/node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js","../../../node_modules/node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js","../../../node_modules/node_modules/.pnpm/fast-wrap-ansi@0.1.3/node_modules/fast-wrap-ansi/lib/main.js","../../../node_modules/@clack/prompts/src/limit-options.ts","../../../node_modules/@clack/prompts/src/autocomplete.ts","../../../node_modules/@clack/prompts/src/box.ts","../../../node_modules/@clack/prompts/src/confirm.ts","../../../node_modules/@clack/prompts/src/group.ts","../../../node_modules/@clack/prompts/src/group-multi-select.ts","../../../node_modules/@clack/prompts/src/log.ts","../../../node_modules/@clack/prompts/src/messages.ts","../../../node_modules/@clack/prompts/src/multi-select.ts","../../../node_modules/@clack/prompts/src/note.ts","../../../node_modules/@clack/prompts/src/password.ts","../../../node_modules/@clack/prompts/src/path.ts","../../../node_modules/@clack/prompts/src/spinner.ts","../../../node_modules/@clack/prompts/src/progress-bar.ts","../../../node_modules/@clack/prompts/src/select.ts","../../../node_modules/@clack/prompts/src/select-key.ts","../../../node_modules/@clack/prompts/src/stream.ts","../../../node_modules/@clack/prompts/src/task.ts","../../../node_modules/@clack/prompts/src/task-log.ts","../../../node_modules/@clack/prompts/src/text.ts","../src/utils.ts","../src/skill-registry.ts","../src/types.ts","../src/profile.ts","../src/manifest.ts","../src/rules.ts","../src/renderers.ts","../src/catalog.ts","../src/skill-catalog.ts","../src/skill-resolver.ts"],"sourcesContent":["'use strict';\n\nconst ESC = '\\x1B';\nconst CSI = `${ESC}[`;\nconst beep = '\\u0007';\n\nconst cursor = {\n to(x, y) {\n if (!y) return `${CSI}${x + 1}G`;\n return `${CSI}${y + 1};${x + 1}H`;\n },\n move(x, y) {\n let ret = '';\n\n if (x < 0) ret += `${CSI}${-x}D`;\n else if (x > 0) ret += `${CSI}${x}C`;\n\n if (y < 0) ret += `${CSI}${-y}A`;\n else if (y > 0) ret += `${CSI}${y}B`;\n\n return ret;\n },\n up: (count = 1) => `${CSI}${count}A`,\n down: (count = 1) => `${CSI}${count}B`,\n forward: (count = 1) => `${CSI}${count}C`,\n backward: (count = 1) => `${CSI}${count}D`,\n nextLine: (count = 1) => `${CSI}E`.repeat(count),\n prevLine: (count = 1) => `${CSI}F`.repeat(count),\n left: `${CSI}G`,\n hide: `${CSI}?25l`,\n show: `${CSI}?25h`,\n save: `${ESC}7`,\n restore: `${ESC}8`\n}\n\nconst scroll = {\n up: (count = 1) => `${CSI}S`.repeat(count),\n down: (count = 1) => `${CSI}T`.repeat(count)\n}\n\nconst erase = {\n screen: `${CSI}2J`,\n up: (count = 1) => `${CSI}1J`.repeat(count),\n down: (count = 1) => `${CSI}J`.repeat(count),\n line: `${CSI}2K`,\n lineEnd: `${CSI}K`,\n lineStart: `${CSI}1K`,\n lines(count) {\n let clear = '';\n for (let i = 0; i < count; i++)\n clear += this.line + (i < count - 1 ? cursor.up() : '');\n if (count)\n clear += cursor.left;\n return clear;\n }\n}\n\nmodule.exports = { cursor, scroll, erase, beep };\n","export function findCursor<T extends { disabled?: boolean }>(\n\tcursor: number,\n\tdelta: number,\n\toptions: T[]\n) {\n\tconst hasEnabledOptions = options.some((opt) => !opt.disabled);\n\tif (!hasEnabledOptions) {\n\t\treturn cursor;\n\t}\n\tconst newCursor = cursor + delta;\n\tconst maxCursor = Math.max(options.length - 1, 0);\n\tconst clampedCursor = newCursor < 0 ? maxCursor : newCursor > maxCursor ? 0 : newCursor;\n\tconst newOption = options[clampedCursor];\n\tif (newOption.disabled) {\n\t\treturn findCursor(clampedCursor, delta < 0 ? -1 : 1, options);\n\t}\n\treturn clampedCursor;\n}\n","/* MAIN */\n//URL: https://github.com/sindresorhus/get-east-asian-width/blob/main/lookup.js\n//LICENSE: https://github.com/sindresorhus/get-east-asian-width/blob/main/license\n//TODO: Replace these with some unicode property classes, if the ones we need exist\nconst isAmbiguous = (x) => {\n return x === 0xA1 || x === 0xA4 || x === 0xA7 || x === 0xA8 || x === 0xAA || x === 0xAD || x === 0xAE || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || x === 0xC6 || x === 0xD0 || x === 0xD7 || x === 0xD8 || x >= 0xDE && x <= 0xE1 || x === 0xE6 || x >= 0xE8 && x <= 0xEA || x === 0xEC || x === 0xED || x === 0xF0 || x === 0xF2 || x === 0xF3 || x >= 0xF7 && x <= 0xFA || x === 0xFC || x === 0xFE || x === 0x101 || x === 0x111 || x === 0x113 || x === 0x11B || x === 0x126 || x === 0x127 || x === 0x12B || x >= 0x131 && x <= 0x133 || x === 0x138 || x >= 0x13F && x <= 0x142 || x === 0x144 || x >= 0x148 && x <= 0x14B || x === 0x14D || x === 0x152 || x === 0x153 || x === 0x166 || x === 0x167 || x === 0x16B || x === 0x1CE || x === 0x1D0 || x === 0x1D2 || x === 0x1D4 || x === 0x1D6 || x === 0x1D8 || x === 0x1DA || x === 0x1DC || x === 0x251 || x === 0x261 || x === 0x2C4 || x === 0x2C7 || x >= 0x2C9 && x <= 0x2CB || x === 0x2CD || x === 0x2D0 || x >= 0x2D8 && x <= 0x2DB || x === 0x2DD || x === 0x2DF || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || x === 0x401 || x >= 0x410 && x <= 0x44F || x === 0x451 || x === 0x2010 || x >= 0x2013 && x <= 0x2016 || x === 0x2018 || x === 0x2019 || x === 0x201C || x === 0x201D || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || x === 0x2030 || x === 0x2032 || x === 0x2033 || x === 0x2035 || x === 0x203B || x === 0x203E || x === 0x2074 || x === 0x207F || x >= 0x2081 && x <= 0x2084 || x === 0x20AC || x === 0x2103 || x === 0x2105 || x === 0x2109 || x === 0x2113 || x === 0x2116 || x === 0x2121 || x === 0x2122 || x === 0x2126 || x === 0x212B || x === 0x2153 || x === 0x2154 || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || x === 0x2189 || x >= 0x2190 && x <= 0x2199 || x === 0x21B8 || x === 0x21B9 || x === 0x21D2 || x === 0x21D4 || x === 0x21E7 || x === 0x2200 || x === 0x2202 || x === 0x2203 || x === 0x2207 || x === 0x2208 || x === 0x220B || x === 0x220F || x === 0x2211 || x === 0x2215 || x === 0x221A || x >= 0x221D && x <= 0x2220 || x === 0x2223 || x === 0x2225 || x >= 0x2227 && x <= 0x222C || x === 0x222E || x >= 0x2234 && x <= 0x2237 || x === 0x223C || x === 0x223D || x === 0x2248 || x === 0x224C || x === 0x2252 || x === 0x2260 || x === 0x2261 || x >= 0x2264 && x <= 0x2267 || x === 0x226A || x === 0x226B || x === 0x226E || x === 0x226F || x === 0x2282 || x === 0x2283 || x === 0x2286 || x === 0x2287 || x === 0x2295 || x === 0x2299 || x === 0x22A5 || x === 0x22BF || x === 0x2312 || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || x === 0x25A0 || x === 0x25A1 || x >= 0x25A3 && x <= 0x25A9 || x === 0x25B2 || x === 0x25B3 || x === 0x25B6 || x === 0x25B7 || x === 0x25BC || x === 0x25BD || x === 0x25C0 || x === 0x25C1 || x >= 0x25C6 && x <= 0x25C8 || x === 0x25CB || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || x === 0x25EF || x === 0x2605 || x === 0x2606 || x === 0x2609 || x === 0x260E || x === 0x260F || x === 0x261C || x === 0x261E || x === 0x2640 || x === 0x2642 || x === 0x2660 || x === 0x2661 || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || x === 0x266C || x === 0x266D || x === 0x266F || x === 0x269E || x === 0x269F || x === 0x26BF || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || x === 0x26E3 || x === 0x26E8 || x === 0x26E9 || x >= 0x26EB && x <= 0x26F1 || x === 0x26F4 || x >= 0x26F6 && x <= 0x26F9 || x === 0x26FB || x === 0x26FC || x === 0x26FE || x === 0x26FF || x === 0x273D || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || x === 0xFFFD || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || x === 0x1F18F || x === 0x1F190 || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;\n};\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWide = (x) => {\n return x >= 0x1100 && x <= 0x115F || x === 0x231A || x === 0x231B || x === 0x2329 || x === 0x232A || x >= 0x23E9 && x <= 0x23EC || x === 0x23F0 || x === 0x23F3 || x === 0x25FD || x === 0x25FE || x === 0x2614 || x === 0x2615 || x >= 0x2648 && x <= 0x2653 || x === 0x267F || x === 0x2693 || x === 0x26A1 || x === 0x26AA || x === 0x26AB || x === 0x26BD || x === 0x26BE || x === 0x26C4 || x === 0x26C5 || x === 0x26CE || x === 0x26D4 || x === 0x26EA || x === 0x26F2 || x === 0x26F3 || x === 0x26F5 || x === 0x26FA || x === 0x26FD || x === 0x2705 || x === 0x270A || x === 0x270B || x === 0x2728 || x === 0x274C || x === 0x274E || x >= 0x2753 && x <= 0x2755 || x === 0x2757 || x >= 0x2795 && x <= 0x2797 || x === 0x27B0 || x === 0x27BF || x === 0x2B1B || x === 0x2B1C || x === 0x2B50 || x === 0x2B55 || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || 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 >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || x === 0x16FF0 || x === 0x16FF1 || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || x === 0x1AFFD || x === 0x1AFFE || x >= 0x1B000 && x <= 0x1B122 || x === 0x1B132 || x >= 0x1B150 && x <= 0x1B152 || x === 0x1B155 || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || x === 0x1F004 || x === 0x1F0CF || x === 0x1F18E || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x === 0x1F250 || x === 0x1F251 || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || x === 0x1F3F4 || x >= 0x1F3F8 && x <= 0x1F43E || x === 0x1F440 || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || x === 0x1F57A || x === 0x1F595 || x === 0x1F596 || x === 0x1F5A4 || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || x === 0x1F6CC || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || x === 0x1F6EB || x === 0x1F6EC || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || x === 0x1F7F0 || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { isAmbiguous, isFullWidth, isWide };\n","/* IMPORT */\nimport { isAmbiguous, isFullWidth, isWide } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\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 */\n//TODO: Optimize matching non-latin letters\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 = widthOptions.ansiWidth ?? 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? 2;\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 (isWide(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {\n widthExtra = AMBIGUOUS_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;\n /* LATIN */\n LATIN_RE.lastIndex = index;\n if (LATIN_RE.test(input)) {\n lengthExtra = LATIN_RE.lastIndex - index;\n widthExtra = lengthExtra * REGULAR_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = LATIN_RE.lastIndex;\n continue;\n }\n /* ANSI */\n ANSI_RE.lastIndex = index;\n if (ANSI_RE.test(input)) {\n if ((width + ANSI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + ANSI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += ANSI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = ANSI_RE.lastIndex;\n continue;\n }\n /* CONTROL */\n CONTROL_RE.lastIndex = index;\n if (CONTROL_RE.test(input)) {\n lengthExtra = CONTROL_RE.lastIndex - index;\n widthExtra = lengthExtra * CONTROL_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = CONTROL_RE.lastIndex;\n continue;\n }\n /* TAB */\n TAB_RE.lastIndex = index;\n if (TAB_RE.test(input)) {\n lengthExtra = TAB_RE.lastIndex - index;\n widthExtra = lengthExtra * TAB_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = TAB_RE.lastIndex;\n continue;\n }\n /* EMOJI */\n EMOJI_RE.lastIndex = index;\n if (EMOJI_RE.test(input)) {\n if ((width + EMOJI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + EMOJI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += EMOJI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = EMOJI_RE.lastIndex;\n continue;\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 wordLengths = (words) => words.map((character) => stringWidth(character));\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 &&\n lastRow !== undefined &&\n lastRow.length > 0 &&\n 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 > 0) {\n if (stringWidth(words[last - 1]) > 0) {\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 const lengths = wordLengths(words);\n let rows = [''];\n for (const [index, word] of words.entries()) {\n if (options.trim !== false) {\n rows[rows.length - 1] = (rows.at(-1) ?? '').trimStart();\n }\n let rowLength = stringWidth(rows.at(-1) ?? '');\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 > 0 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n if (options.hard && lengths[index] > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n continue;\n }\n if (rowLength + lengths[index] > columns &&\n rowLength > 0 &&\n lengths[index] > 0) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows.push('');\n }\n if (rowLength + lengths[index] > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows[rows.length - 1] += word;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n const pre = preString[Symbol.iterator]();\n let currentPre = pre.next();\n let nextPre = pre.next();\n // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.\n let preStringIndex = 0;\n while (!currentPre.done) {\n const character = currentPre.value;\n const nextCharacter = nextPre.value;\n returnValue += character;\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = preStringIndex + 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 const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (nextCharacter === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n preStringIndex += character.length;\n currentPre = nextPre;\n nextPre = pre.next();\n }\n return returnValue;\n};\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .replaceAll('\\r\\n', '\\n')\n .split('\\n')\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","const actions = ['up', 'down', 'left', 'right', 'space', 'enter', 'cancel'] as const;\nexport type Action = (typeof actions)[number];\n\n/** Global settings for Clack programs, stored in memory */\ninterface InternalClackSettings {\n\tactions: Set<Action>;\n\taliases: Map<string, Action>;\n\tmessages: {\n\t\tcancel: string;\n\t\terror: string;\n\t};\n\twithGuide: boolean;\n}\n\nexport const settings: InternalClackSettings = {\n\tactions: new Set(actions),\n\taliases: new Map<string, Action>([\n\t\t// vim support\n\t\t['k', 'up'],\n\t\t['j', 'down'],\n\t\t['h', 'left'],\n\t\t['l', 'right'],\n\t\t['\\x03', 'cancel'],\n\t\t// opinionated defaults!\n\t\t['escape', 'cancel'],\n\t]),\n\tmessages: {\n\t\tcancel: 'Canceled',\n\t\terror: 'Something went wrong',\n\t},\n\twithGuide: true,\n};\n\nexport interface ClackSettings {\n\t/**\n\t * Set custom global aliases for the default actions.\n\t * This will not overwrite existing aliases, it will only add new ones!\n\t *\n\t * @param aliases - An object that maps aliases to actions\n\t * @default { k: 'up', j: 'down', h: 'left', l: 'right', '\\x03': 'cancel', 'escape': 'cancel' }\n\t */\n\taliases?: Record<string, Action>;\n\n\t/**\n\t * Custom messages for prompts\n\t */\n\tmessages?: {\n\t\t/**\n\t\t * Custom message to display when a spinner is cancelled\n\t\t * @default \"Canceled\"\n\t\t */\n\t\tcancel?: string;\n\t\t/**\n\t\t * Custom message to display when a spinner encounters an error\n\t\t * @default \"Something went wrong\"\n\t\t */\n\t\terror?: string;\n\t};\n\n\twithGuide?: boolean;\n}\n\nexport function updateSettings(updates: ClackSettings) {\n\t// Handle each property in the updates\n\tif (updates.aliases !== undefined) {\n\t\tconst aliases = updates.aliases;\n\t\tfor (const alias in aliases) {\n\t\t\tif (!Object.hasOwn(aliases, alias)) continue;\n\n\t\t\tconst action = aliases[alias];\n\t\t\tif (!settings.actions.has(action)) continue;\n\n\t\t\tif (!settings.aliases.has(alias)) {\n\t\t\t\tsettings.aliases.set(alias, action);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (updates.messages !== undefined) {\n\t\tconst messages = updates.messages;\n\t\tif (messages.cancel !== undefined) {\n\t\t\tsettings.messages.cancel = messages.cancel;\n\t\t}\n\t\tif (messages.error !== undefined) {\n\t\t\tsettings.messages.error = messages.error;\n\t\t}\n\t}\n\n\tif (updates.withGuide !== undefined) {\n\t\tsettings.withGuide = updates.withGuide !== false;\n\t}\n}\n\n/**\n * Check if a key is an alias for a default action\n * @param key - The raw key which might match to an action\n * @param action - The action to match\n * @returns boolean\n */\nexport function isActionKey(key: string | Array<string | undefined>, action: Action) {\n\tif (typeof key === 'string') {\n\t\treturn settings.aliases.get(key) === action;\n\t}\n\n\tfor (const value of key) {\n\t\tif (value === undefined) continue;\n\t\tif (isActionKey(value, action)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n","export function diffLines(a: string, b: string) {\n\tif (a === b) return;\n\n\tconst aLines = a.split('\\n');\n\tconst bLines = b.split('\\n');\n\tconst numLines = Math.max(aLines.length, bLines.length);\n\tconst diff: number[] = [];\n\n\tfor (let i = 0; i < numLines; i++) {\n\t\tif (aLines[i] !== bLines[i]) diff.push(i);\n\t}\n\n\treturn {\n\t\tlines: diff,\n\t\tnumLinesBefore: aLines.length,\n\t\tnumLinesAfter: bLines.length,\n\t\tnumLines,\n\t};\n}\n","import { stdin, stdout } from 'node:process';\nimport type { Key } from 'node:readline';\nimport * as readline from 'node:readline';\nimport type { Readable, Writable } from 'node:stream';\nimport { ReadStream } from 'node:tty';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor } from 'sisteransi';\nimport { isActionKey } from './settings.js';\n\nexport * from './settings.js';\nexport * from './string.js';\n\nconst isWindows = globalThis.process.platform.startsWith('win');\n\nexport const CANCEL_SYMBOL = Symbol('clack:cancel');\n\nexport function isCancel(value: unknown): value is symbol {\n\treturn value === CANCEL_SYMBOL;\n}\n\nexport function setRawMode(input: Readable, value: boolean) {\n\tconst i = input as typeof stdin;\n\n\tif (i.isTTY) i.setRawMode(value);\n}\n\ninterface BlockOptions {\n\tinput?: Readable;\n\toutput?: Writable;\n\toverwrite?: boolean;\n\thideCursor?: boolean;\n}\n\nexport function block({\n\tinput = stdin,\n\toutput = stdout,\n\toverwrite = true,\n\thideCursor = true,\n}: BlockOptions = {}) {\n\tconst rl = readline.createInterface({\n\t\tinput,\n\t\toutput,\n\t\tprompt: '',\n\t\ttabSize: 1,\n\t});\n\treadline.emitKeypressEvents(input, rl);\n\n\tif (input instanceof ReadStream && input.isTTY) {\n\t\tinput.setRawMode(true);\n\t}\n\n\tconst clear = (data: Buffer, { name, sequence }: Key) => {\n\t\tconst str = String(data);\n\t\tif (isActionKey([str, name, sequence], 'cancel')) {\n\t\t\tif (hideCursor) output.write(cursor.show);\n\t\t\tprocess.exit(0);\n\t\t\treturn;\n\t\t}\n\t\tif (!overwrite) return;\n\t\tconst dx = name === 'return' ? 0 : -1;\n\t\tconst dy = name === 'return' ? -1 : 0;\n\n\t\treadline.moveCursor(output, dx, dy, () => {\n\t\t\treadline.clearLine(output, 1, () => {\n\t\t\t\tinput.once('keypress', clear);\n\t\t\t});\n\t\t});\n\t};\n\tif (hideCursor) output.write(cursor.hide);\n\tinput.once('keypress', clear);\n\n\treturn () => {\n\t\tinput.off('keypress', clear);\n\t\tif (hideCursor) output.write(cursor.show);\n\n\t\t// Prevent Windows specific issues: https://github.com/bombshell-dev/clack/issues/176\n\t\tif (input instanceof ReadStream && input.isTTY && !isWindows) {\n\t\t\tinput.setRawMode(false);\n\t\t}\n\n\t\t// @ts-expect-error fix for https://github.com/nodejs/node/issues/31762#issuecomment-1441223907\n\t\trl.terminal = false;\n\t\trl.close();\n\t};\n}\n\nexport const getColumns = (output: Writable): number => {\n\tif ('columns' in output && typeof output.columns === 'number') {\n\t\treturn output.columns;\n\t}\n\treturn 80;\n};\n\nexport const getRows = (output: Writable): number => {\n\tif ('rows' in output && typeof output.rows === 'number') {\n\t\treturn output.rows;\n\t}\n\treturn 20;\n};\n\nexport function wrapTextWithPrefix(\n\toutput: Writable | undefined,\n\ttext: string,\n\tprefix: string,\n\tstartPrefix: string = prefix\n): string {\n\tconst columns = getColumns(output ?? stdout);\n\tconst wrapped = wrapAnsi(text, columns - prefix.length, {\n\t\thard: true,\n\t\ttrim: false,\n\t});\n\tconst lines = wrapped\n\t\t.split('\\n')\n\t\t.map((line, index) => {\n\t\t\treturn `${index === 0 ? startPrefix : prefix}${line}`;\n\t\t})\n\t\t.join('\\n');\n\treturn lines;\n}\n","import { stdin, stdout } from 'node:process';\nimport readline, { type Key, type ReadLine } from 'node:readline';\nimport type { Readable, Writable } from 'node:stream';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor, erase } from 'sisteransi';\nimport type { ClackEvents, ClackState } from '../types.js';\nimport type { Action } from '../utils/index.js';\nimport {\n\tCANCEL_SYMBOL,\n\tdiffLines,\n\tgetRows,\n\tisActionKey,\n\tsetRawMode,\n\tsettings,\n} from '../utils/index.js';\n\nexport interface PromptOptions<TValue, Self extends Prompt<TValue>> {\n\trender(this: Omit<Self, 'prompt'>): string | undefined;\n\tinitialValue?: any;\n\tinitialUserInput?: string;\n\tvalidate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;\n\tinput?: Readable;\n\toutput?: Writable;\n\tdebug?: boolean;\n\tsignal?: AbortSignal;\n}\n\nexport default class Prompt<TValue> {\n\tprotected input: Readable;\n\tprotected output: Writable;\n\tprivate _abortSignal?: AbortSignal;\n\n\tprivate rl: ReadLine | undefined;\n\tprivate opts: Omit<PromptOptions<TValue, Prompt<TValue>>, 'render' | 'input' | 'output'>;\n\tprivate _render: (context: Omit<Prompt<TValue>, 'prompt'>) => string | undefined;\n\tprivate _track = false;\n\tprivate _prevFrame = '';\n\tprivate _subscribers = new Map<string, { cb: (...args: any) => any; once?: boolean }[]>();\n\tprotected _cursor = 0;\n\n\tpublic state: ClackState = 'initial';\n\tpublic error = '';\n\tpublic value: TValue | undefined;\n\tpublic userInput = '';\n\n\tconstructor(options: PromptOptions<TValue, Prompt<TValue>>, trackValue = true) {\n\t\tconst { input = stdin, output = stdout, render, signal, ...opts } = options;\n\n\t\tthis.opts = opts;\n\t\tthis.onKeypress = this.onKeypress.bind(this);\n\t\tthis.close = this.close.bind(this);\n\t\tthis.render = this.render.bind(this);\n\t\tthis._render = render.bind(this);\n\t\tthis._track = trackValue;\n\t\tthis._abortSignal = signal;\n\n\t\tthis.input = input;\n\t\tthis.output = output;\n\t}\n\n\t/**\n\t * Unsubscribe all listeners\n\t */\n\tprotected unsubscribe() {\n\t\tthis._subscribers.clear();\n\t}\n\n\t/**\n\t * Set a subscriber with opts\n\t * @param event - The event name\n\t */\n\tprivate setSubscriber<T extends keyof ClackEvents<TValue>>(\n\t\tevent: T,\n\t\topts: { cb: ClackEvents<TValue>[T]; once?: boolean }\n\t) {\n\t\tconst params = this._subscribers.get(event) ?? [];\n\t\tparams.push(opts);\n\t\tthis._subscribers.set(event, params);\n\t}\n\n\t/**\n\t * Subscribe to an event\n\t * @param event - The event name\n\t * @param cb - The callback\n\t */\n\tpublic on<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]) {\n\t\tthis.setSubscriber(event, { cb });\n\t}\n\n\t/**\n\t * Subscribe to an event once\n\t * @param event - The event name\n\t * @param cb - The callback\n\t */\n\tpublic once<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]) {\n\t\tthis.setSubscriber(event, { cb, once: true });\n\t}\n\n\t/**\n\t * Emit an event with data\n\t * @param event - The event name\n\t * @param data - The data to pass to the callback\n\t */\n\tpublic emit<T extends keyof ClackEvents<TValue>>(\n\t\tevent: T,\n\t\t...data: Parameters<ClackEvents<TValue>[T]>\n\t) {\n\t\tconst cbs = this._subscribers.get(event) ?? [];\n\t\tconst cleanup: (() => void)[] = [];\n\n\t\tfor (const subscriber of cbs) {\n\t\t\tsubscriber.cb(...data);\n\n\t\t\tif (subscriber.once) {\n\t\t\t\tcleanup.push(() => cbs.splice(cbs.indexOf(subscriber), 1));\n\t\t\t}\n\t\t}\n\n\t\tfor (const cb of cleanup) {\n\t\t\tcb();\n\t\t}\n\t}\n\n\tpublic prompt() {\n\t\treturn new Promise<TValue | symbol | undefined>((resolve) => {\n\t\t\tif (this._abortSignal) {\n\t\t\t\tif (this._abortSignal.aborted) {\n\t\t\t\t\tthis.state = 'cancel';\n\n\t\t\t\t\tthis.close();\n\t\t\t\t\treturn resolve(CANCEL_SYMBOL);\n\t\t\t\t}\n\n\t\t\t\tthis._abortSignal.addEventListener(\n\t\t\t\t\t'abort',\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.state = 'cancel';\n\t\t\t\t\t\tthis.close();\n\t\t\t\t\t},\n\t\t\t\t\t{ once: true }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.rl = readline.createInterface({\n\t\t\t\tinput: this.input,\n\t\t\t\ttabSize: 2,\n\t\t\t\tprompt: '',\n\t\t\t\tescapeCodeTimeout: 50,\n\t\t\t\tterminal: true,\n\t\t\t});\n\t\t\tthis.rl.prompt();\n\n\t\t\tif (this.opts.initialUserInput !== undefined) {\n\t\t\t\tthis._setUserInput(this.opts.initialUserInput, true);\n\t\t\t}\n\n\t\t\tthis.input.on('keypress', this.onKeypress);\n\t\t\tsetRawMode(this.input, true);\n\t\t\tthis.output.on('resize', this.render);\n\n\t\t\tthis.render();\n\n\t\t\tthis.once('submit', () => {\n\t\t\t\tthis.output.write(cursor.show);\n\t\t\t\tthis.output.off('resize', this.render);\n\t\t\t\tsetRawMode(this.input, false);\n\t\t\t\tresolve(this.value);\n\t\t\t});\n\t\t\tthis.once('cancel', () => {\n\t\t\t\tthis.output.write(cursor.show);\n\t\t\t\tthis.output.off('resize', this.render);\n\t\t\t\tsetRawMode(this.input, false);\n\t\t\t\tresolve(CANCEL_SYMBOL);\n\t\t\t});\n\t\t});\n\t}\n\n\tprotected _isActionKey(char: string | undefined, _key: Key): boolean {\n\t\treturn char === '\\t';\n\t}\n\n\tprotected _setValue(value: TValue | undefined): void {\n\t\tthis.value = value;\n\t\tthis.emit('value', this.value);\n\t}\n\n\tprotected _setUserInput(value: string | undefined, write?: boolean): void {\n\t\tthis.userInput = value ?? '';\n\t\tthis.emit('userInput', this.userInput);\n\t\tif (write && this._track && this.rl) {\n\t\t\tthis.rl.write(this.userInput);\n\t\t\tthis._cursor = this.rl.cursor;\n\t\t}\n\t}\n\n\tprotected _clearUserInput(): void {\n\t\tthis.rl?.write(null, { ctrl: true, name: 'u' });\n\t\tthis._setUserInput('');\n\t}\n\n\tprivate onKeypress(char: string | undefined, key: Key) {\n\t\tif (this._track && key.name !== 'return') {\n\t\t\tif (key.name && this._isActionKey(char, key)) {\n\t\t\t\tthis.rl?.write(null, { ctrl: true, name: 'h' });\n\t\t\t}\n\t\t\tthis._cursor = this.rl?.cursor ?? 0;\n\t\t\tthis._setUserInput(this.rl?.line);\n\t\t}\n\n\t\tif (this.state === 'error') {\n\t\t\tthis.state = 'active';\n\t\t}\n\t\tif (key?.name) {\n\t\t\tif (!this._track && settings.aliases.has(key.name)) {\n\t\t\t\tthis.emit('cursor', settings.aliases.get(key.name));\n\t\t\t}\n\t\t\tif (settings.actions.has(key.name as Action)) {\n\t\t\t\tthis.emit('cursor', key.name as Action);\n\t\t\t}\n\t\t}\n\t\tif (char && (char.toLowerCase() === 'y' || char.toLowerCase() === 'n')) {\n\t\t\tthis.emit('confirm', char.toLowerCase() === 'y');\n\t\t}\n\n\t\t// Call the key event handler and emit the key event\n\t\tthis.emit('key', char?.toLowerCase(), key);\n\n\t\tif (key?.name === 'return') {\n\t\t\tif (this.opts.validate) {\n\t\t\t\tconst problem = this.opts.validate(this.value);\n\t\t\t\tif (problem) {\n\t\t\t\t\tthis.error = problem instanceof Error ? problem.message : problem;\n\t\t\t\t\tthis.state = 'error';\n\t\t\t\t\tthis.rl?.write(this.userInput);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.state !== 'error') {\n\t\t\t\tthis.state = 'submit';\n\t\t\t}\n\t\t}\n\n\t\tif (isActionKey([char, key?.name, key?.sequence], 'cancel')) {\n\t\t\tthis.state = 'cancel';\n\t\t}\n\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\tthis.emit('finalize');\n\t\t}\n\t\tthis.render();\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\tprotected close() {\n\t\tthis.input.unpipe();\n\t\tthis.input.removeListener('keypress', this.onKeypress);\n\t\tthis.output.write('\\n');\n\t\tsetRawMode(this.input, false);\n\t\tthis.rl?.close();\n\t\tthis.rl = undefined;\n\t\tthis.emit(`${this.state}`, this.value);\n\t\tthis.unsubscribe();\n\t}\n\n\tprivate restoreCursor() {\n\t\tconst lines =\n\t\t\twrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split('\\n')\n\t\t\t\t.length - 1;\n\t\tthis.output.write(cursor.move(-999, lines * -1));\n\t}\n\n\tprivate render() {\n\t\tconst frame = wrapAnsi(this._render(this) ?? '', process.stdout.columns, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t});\n\t\tif (frame === this._prevFrame) return;\n\n\t\tif (this.state === 'initial') {\n\t\t\tthis.output.write(cursor.hide);\n\t\t} else {\n\t\t\tconst diff = diffLines(this._prevFrame, frame);\n\t\t\tconst rows = getRows(this.output);\n\t\t\tthis.restoreCursor();\n\t\t\tif (diff) {\n\t\t\t\tconst diffOffsetAfter = Math.max(0, diff.numLinesAfter - rows);\n\t\t\t\tconst diffOffsetBefore = Math.max(0, diff.numLinesBefore - rows);\n\t\t\t\tlet diffLine = diff.lines.find((line) => line >= diffOffsetAfter);\n\n\t\t\t\tif (diffLine === undefined) {\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If a single line has changed, only update that line\n\t\t\t\tif (diff.lines.length === 1) {\n\t\t\t\t\tthis.output.write(cursor.move(0, diffLine - diffOffsetBefore));\n\t\t\t\t\tthis.output.write(erase.lines(1));\n\t\t\t\t\tconst lines = frame.split('\\n');\n\t\t\t\t\tthis.output.write(lines[diffLine]);\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\tthis.output.write(cursor.move(0, lines.length - diffLine - 1));\n\t\t\t\t\treturn;\n\t\t\t\t\t// If many lines have changed, rerender everything past the first line\n\t\t\t\t} else if (diff.lines.length > 1) {\n\t\t\t\t\tif (diffOffsetAfter < diffOffsetBefore) {\n\t\t\t\t\t\tdiffLine = diffOffsetAfter;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst adjustedDiffLine = diffLine - diffOffsetBefore;\n\t\t\t\t\t\tif (adjustedDiffLine > 0) {\n\t\t\t\t\t\t\tthis.output.write(cursor.move(0, adjustedDiffLine));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.output.write(erase.down());\n\t\t\t\t\tconst lines = frame.split('\\n');\n\t\t\t\t\tconst newLines = lines.slice(diffLine);\n\t\t\t\t\tthis.output.write(newLines.join('\\n'));\n\t\t\t\t\tthis._prevFrame = frame;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.output.write(erase.down());\n\t\t}\n\n\t\tthis.output.write(frame);\n\t\tif (this.state === 'initial') {\n\t\t\tthis.state = 'active';\n\t\t}\n\t\tthis._prevFrame = frame;\n\t}\n}\n","import type { Key } from 'node:readline';\nimport { styleText } from 'node:util';\nimport { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\ninterface OptionLike {\n\tvalue: unknown;\n\tlabel?: string;\n\tdisabled?: boolean;\n}\n\ntype FilterFunction<T extends OptionLike> = (search: string, opt: T) => boolean;\n\nfunction getCursorForValue<T extends OptionLike>(\n\tselected: T['value'] | undefined,\n\titems: T[]\n): number {\n\tif (selected === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst currLength = items.length;\n\n\t// If filtering changed the available options, update cursor\n\tif (currLength === 0) {\n\t\treturn 0;\n\t}\n\n\t// Try to maintain the same selected item\n\tconst index = items.findIndex((item) => item.value === selected);\n\treturn index !== -1 ? index : 0;\n}\n\nfunction defaultFilter<T extends OptionLike>(input: string, option: T): boolean {\n\tconst label = option.label ?? String(option.value);\n\treturn label.toLowerCase().includes(input.toLowerCase());\n}\n\nfunction normalisedValue<T>(multiple: boolean, values: T[] | undefined): T | T[] | undefined {\n\tif (!values) {\n\t\treturn undefined;\n\t}\n\tif (multiple) {\n\t\treturn values;\n\t}\n\treturn values[0];\n}\n\nexport interface AutocompleteOptions<T extends OptionLike>\n\textends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {\n\toptions: T[] | ((this: AutocompletePrompt<T>) => T[]);\n\tfilter?: FilterFunction<T>;\n\tmultiple?: boolean;\n}\n\nexport default class AutocompletePrompt<T extends OptionLike> extends Prompt<\n\tT['value'] | T['value'][]\n> {\n\tfilteredOptions: T[];\n\tmultiple: boolean;\n\tisNavigating = false;\n\tselectedValues: Array<T['value']> = [];\n\n\tfocusedValue: T['value'] | undefined;\n\t#cursor = 0;\n\t#lastUserInput = '';\n\t#filterFn: FilterFunction<T>;\n\t#options: T[] | (() => T[]);\n\n\tget cursor(): number {\n\t\treturn this.#cursor;\n\t}\n\n\tget userInputWithCursor() {\n\t\tif (!this.userInput) {\n\t\t\treturn styleText(['inverse', 'hidden'], '_');\n\t\t}\n\t\tif (this._cursor >= this.userInput.length) {\n\t\t\treturn `${this.userInput}█`;\n\t\t}\n\t\tconst s1 = this.userInput.slice(0, this._cursor);\n\t\tconst [s2, ...s3] = this.userInput.slice(this._cursor);\n\t\treturn `${s1}${styleText('inverse', s2)}${s3.join('')}`;\n\t}\n\n\tget options(): T[] {\n\t\tif (typeof this.#options === 'function') {\n\t\t\treturn this.#options();\n\t\t}\n\t\treturn this.#options;\n\t}\n\n\tconstructor(opts: AutocompleteOptions<T>) {\n\t\tsuper(opts);\n\n\t\tthis.#options = opts.options;\n\t\tconst options = this.options;\n\t\tthis.filteredOptions = [...options];\n\t\tthis.multiple = opts.multiple === true;\n\t\tthis.#filterFn = opts.filter ?? defaultFilter;\n\t\tlet initialValues: unknown[] | undefined;\n\t\tif (opts.initialValue && Array.isArray(opts.initialValue)) {\n\t\t\tif (this.multiple) {\n\t\t\t\tinitialValues = opts.initialValue;\n\t\t\t} else {\n\t\t\t\tinitialValues = opts.initialValue.slice(0, 1);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!this.multiple && this.options.length > 0) {\n\t\t\t\tinitialValues = [this.options[0].value];\n\t\t\t}\n\t\t}\n\n\t\tif (initialValues) {\n\t\t\tfor (const selectedValue of initialValues) {\n\t\t\t\tconst selectedIndex = options.findIndex((opt) => opt.value === selectedValue);\n\t\t\t\tif (selectedIndex !== -1) {\n\t\t\t\t\tthis.toggleSelected(selectedValue);\n\t\t\t\t\tthis.#cursor = selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.focusedValue = this.options[this.#cursor]?.value;\n\n\t\tthis.on('key', (char, key) => this.#onKey(char, key));\n\t\tthis.on('userInput', (value) => this.#onUserInputChanged(value));\n\t}\n\n\tprotected override _isActionKey(char: string | undefined, key: Key): boolean {\n\t\treturn (\n\t\t\tchar === '\\t' ||\n\t\t\t(this.multiple &&\n\t\t\t\tthis.isNavigating &&\n\t\t\t\tkey.name === 'space' &&\n\t\t\t\tchar !== undefined &&\n\t\t\t\tchar !== '')\n\t\t);\n\t}\n\n\t#onKey(_char: string | undefined, key: Key): void {\n\t\tconst isUpKey = key.name === 'up';\n\t\tconst isDownKey = key.name === 'down';\n\t\tconst isReturnKey = key.name === 'return';\n\n\t\t// Start navigation mode with up/down arrows\n\t\tif (isUpKey || isDownKey) {\n\t\t\tthis.#cursor = findCursor(this.#cursor, isUpKey ? -1 : 1, this.filteredOptions);\n\t\t\tthis.focusedValue = this.filteredOptions[this.#cursor]?.value;\n\t\t\tif (!this.multiple) {\n\t\t\t\tthis.selectedValues = [this.focusedValue];\n\t\t\t}\n\t\t\tthis.isNavigating = true;\n\t\t} else if (isReturnKey) {\n\t\t\tthis.value = normalisedValue(this.multiple, this.selectedValues);\n\t\t} else {\n\t\t\tif (this.multiple) {\n\t\t\t\tif (\n\t\t\t\t\tthis.focusedValue !== undefined &&\n\t\t\t\t\t(key.name === 'tab' || (this.isNavigating && key.name === 'space'))\n\t\t\t\t) {\n\t\t\t\t\tthis.toggleSelected(this.focusedValue);\n\t\t\t\t} else {\n\t\t\t\t\tthis.isNavigating = false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.focusedValue) {\n\t\t\t\t\tthis.selectedValues = [this.focusedValue];\n\t\t\t\t}\n\t\t\t\tthis.isNavigating = false;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeselectAll() {\n\t\tthis.selectedValues = [];\n\t}\n\n\ttoggleSelected(value: T['value']) {\n\t\tif (this.filteredOptions.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.multiple) {\n\t\t\tif (this.selectedValues.includes(value)) {\n\t\t\t\tthis.selectedValues = this.selectedValues.filter((v) => v !== value);\n\t\t\t} else {\n\t\t\t\tthis.selectedValues = [...this.selectedValues, value];\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValues = [value];\n\t\t}\n\t}\n\n\t#onUserInputChanged(value: string): void {\n\t\tif (value !== this.#lastUserInput) {\n\t\t\tthis.#lastUserInput = value;\n\n\t\t\tconst options = this.options;\n\n\t\t\tif (value) {\n\t\t\t\tthis.filteredOptions = options.filter((opt) => this.#filterFn(value, opt));\n\t\t\t} else {\n\t\t\t\tthis.filteredOptions = [...options];\n\t\t\t}\n\t\t\tconst valueCursor = getCursorForValue(this.focusedValue, this.filteredOptions);\n\t\t\tthis.#cursor = findCursor(valueCursor, 0, this.filteredOptions);\n\t\t\tconst focusedOption = this.filteredOptions[this.#cursor];\n\t\t\tif (focusedOption && !focusedOption.disabled) {\n\t\t\t\tthis.focusedValue = focusedOption.value;\n\t\t\t} else {\n\t\t\t\tthis.focusedValue = undefined;\n\t\t\t}\n\t\t\tif (!this.multiple) {\n\t\t\t\tif (this.focusedValue !== undefined) {\n\t\t\t\t\tthis.toggleSelected(this.focusedValue);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deselectAll();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { cursor } from 'sisteransi';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {\n\tactive: string;\n\tinactive: string;\n\tinitialValue?: boolean;\n}\n\nexport default class ConfirmPrompt extends Prompt<boolean> {\n\tget cursor() {\n\t\treturn this.value ? 0 : 1;\n\t}\n\n\tprivate get _value() {\n\t\treturn this.cursor === 0;\n\t}\n\n\tconstructor(opts: ConfirmOptions) {\n\t\tsuper(opts, false);\n\t\tthis.value = !!opts.initialValue;\n\n\t\tthis.on('userInput', () => {\n\t\t\tthis.value = this._value;\n\t\t});\n\n\t\tthis.on('confirm', (confirm) => {\n\t\t\tthis.output.write(cursor.move(0, -1));\n\t\t\tthis.value = confirm;\n\t\t\tthis.state = 'submit';\n\t\t\tthis.close();\n\t\t});\n\n\t\tthis.on('cursor', () => {\n\t\t\tthis.value = !this.value;\n\t\t});\n\t}\n}\n","import Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface GroupMultiSelectOptions<T extends { value: any }>\n\textends PromptOptions<T['value'][], GroupMultiSelectPrompt<T>> {\n\toptions: Record<string, T[]>;\n\tinitialValues?: T['value'][];\n\trequired?: boolean;\n\tcursorAt?: T['value'];\n\tselectableGroups?: boolean;\n}\nexport default class GroupMultiSelectPrompt<T extends { value: any }> extends Prompt<T['value'][]> {\n\toptions: (T & { group: string | boolean })[];\n\tcursor = 0;\n\t#selectableGroups: boolean;\n\n\tgetGroupItems(group: string): T[] {\n\t\treturn this.options.filter((o) => o.group === group);\n\t}\n\n\tisGroupSelected(group: string) {\n\t\tconst items = this.getGroupItems(group);\n\t\tconst value = this.value;\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn items.every((i) => value.includes(i.value));\n\t}\n\n\tprivate toggleValue() {\n\t\tconst item = this.options[this.cursor];\n\t\tif (this.value === undefined) {\n\t\t\tthis.value = [];\n\t\t}\n\t\tif (item.group === true) {\n\t\t\tconst group = item.value;\n\t\t\tconst groupedItems = this.getGroupItems(group);\n\t\t\tif (this.isGroupSelected(group)) {\n\t\t\t\tthis.value = this.value.filter(\n\t\t\t\t\t(v: string) => groupedItems.findIndex((i) => i.value === v) === -1\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.value = [...this.value, ...groupedItems.map((i) => i.value)];\n\t\t\t}\n\t\t\tthis.value = Array.from(new Set(this.value));\n\t\t} else {\n\t\t\tconst selected = this.value.includes(item.value);\n\t\t\tthis.value = selected\n\t\t\t\t? this.value.filter((v: T['value']) => v !== item.value)\n\t\t\t\t: [...this.value, item.value];\n\t\t}\n\t}\n\n\tconstructor(opts: GroupMultiSelectOptions<T>) {\n\t\tsuper(opts, false);\n\t\tconst { options } = opts;\n\t\tthis.#selectableGroups = opts.selectableGroups !== false;\n\t\tthis.options = Object.entries(options).flatMap(([key, option]) => [\n\t\t\t{ value: key, group: true, label: key },\n\t\t\t...option.map((opt) => ({ ...opt, group: key })),\n\t\t]) as any;\n\t\tthis.value = [...(opts.initialValues ?? [])];\n\t\tthis.cursor = Math.max(\n\t\t\tthis.options.findIndex(({ value }) => value === opts.cursorAt),\n\t\t\tthis.#selectableGroups ? 0 : 1\n\t\t);\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up': {\n\t\t\t\t\tthis.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n\t\t\t\t\tconst currentIsGroup = this.options[this.cursor]?.group === true;\n\t\t\t\t\tif (!this.#selectableGroups && currentIsGroup) {\n\t\t\t\t\t\tthis.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right': {\n\t\t\t\t\tthis.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n\t\t\t\t\tconst currentIsGroup = this.options[this.cursor]?.group === true;\n\t\t\t\t\tif (!this.#selectableGroups && currentIsGroup) {\n\t\t\t\t\t\tthis.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'space':\n\t\t\t\t\tthis.toggleValue();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n}\n","import { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\ninterface OptionLike {\n\tvalue: any;\n\tdisabled?: boolean;\n}\n\nexport interface MultiSelectOptions<T extends OptionLike>\n\textends PromptOptions<T['value'][], MultiSelectPrompt<T>> {\n\toptions: T[];\n\tinitialValues?: T['value'][];\n\trequired?: boolean;\n\tcursorAt?: T['value'];\n}\nexport default class MultiSelectPrompt<T extends OptionLike> extends Prompt<T['value'][]> {\n\toptions: T[];\n\tcursor = 0;\n\n\tprivate get _value(): T['value'] {\n\t\treturn this.options[this.cursor].value;\n\t}\n\n\tprivate get _enabledOptions(): T[] {\n\t\treturn this.options.filter((option) => option.disabled !== true);\n\t}\n\n\tprivate toggleAll() {\n\t\tconst enabledOptions = this._enabledOptions;\n\t\tconst allSelected = this.value !== undefined && this.value.length === enabledOptions.length;\n\t\tthis.value = allSelected ? [] : enabledOptions.map((v) => v.value);\n\t}\n\n\tprivate toggleInvert() {\n\t\tconst value = this.value;\n\t\tif (!value) {\n\t\t\treturn;\n\t\t}\n\t\tconst notSelected = this._enabledOptions.filter((v) => !value.includes(v.value));\n\t\tthis.value = notSelected.map((v) => v.value);\n\t}\n\n\tprivate toggleValue() {\n\t\tif (this.value === undefined) {\n\t\t\tthis.value = [];\n\t\t}\n\t\tconst selected = this.value.includes(this._value);\n\t\tthis.value = selected\n\t\t\t? this.value.filter((value) => value !== this._value)\n\t\t\t: [...this.value, this._value];\n\t}\n\n\tconstructor(opts: MultiSelectOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\t\tthis.value = [...(opts.initialValues ?? [])];\n\t\tconst cursor = Math.max(\n\t\t\tthis.options.findIndex(({ value }) => value === opts.cursorAt),\n\t\t\t0\n\t\t);\n\t\tthis.cursor = this.options[cursor].disabled ? findCursor<T>(cursor, 1, this.options) : cursor;\n\t\tthis.on('key', (char) => {\n\t\t\tif (char === 'a') {\n\t\t\t\tthis.toggleAll();\n\t\t\t}\n\t\t\tif (char === 'i') {\n\t\t\t\tthis.toggleInvert();\n\t\t\t}\n\t\t});\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, -1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, 1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'space':\n\t\t\t\t\tthis.toggleValue();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n}\n","import { styleText } from 'node:util';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface PasswordOptions extends PromptOptions<string, PasswordPrompt> {\n\tmask?: string;\n}\nexport default class PasswordPrompt extends Prompt<string> {\n\tprivate _mask = '•';\n\tget cursor() {\n\t\treturn this._cursor;\n\t}\n\tget masked() {\n\t\treturn this.userInput.replaceAll(/./g, this._mask);\n\t}\n\tget userInputWithCursor() {\n\t\tif (this.state === 'submit' || this.state === 'cancel') {\n\t\t\treturn this.masked;\n\t\t}\n\t\tconst userInput = this.userInput;\n\t\tif (this.cursor >= userInput.length) {\n\t\t\treturn `${this.masked}${styleText(['inverse', 'hidden'], '_')}`;\n\t\t}\n\t\tconst masked = this.masked;\n\t\tconst s1 = masked.slice(0, this.cursor);\n\t\tconst s2 = masked.slice(this.cursor);\n\t\treturn `${s1}${styleText('inverse', s2[0])}${s2.slice(1)}`;\n\t}\n\tclear() {\n\t\tthis._clearUserInput();\n\t}\n\tconstructor({ mask, ...opts }: PasswordOptions) {\n\t\tsuper(opts);\n\t\tthis._mask = mask ?? '•';\n\t\tthis.on('userInput', (input) => {\n\t\t\tthis._setValue(input);\n\t\t});\n\t}\n}\n","import { findCursor } from '../utils/cursor.js';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface SelectOptions<T extends { value: any; disabled?: boolean }>\n\textends PromptOptions<T['value'], SelectPrompt<T>> {\n\toptions: T[];\n\tinitialValue?: T['value'];\n}\nexport default class SelectPrompt<T extends { value: any; disabled?: boolean }> extends Prompt<\n\tT['value']\n> {\n\toptions: T[];\n\tcursor = 0;\n\n\tprivate get _selectedValue() {\n\t\treturn this.options[this.cursor];\n\t}\n\n\tprivate changeValue() {\n\t\tthis.value = this._selectedValue.value;\n\t}\n\n\tconstructor(opts: SelectOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\n\t\tconst initialCursor = this.options.findIndex(({ value }) => value === opts.initialValue);\n\t\tconst cursor = initialCursor === -1 ? 0 : initialCursor;\n\t\tthis.cursor = this.options[cursor].disabled ? findCursor<T>(cursor, 1, this.options) : cursor;\n\t\tthis.changeValue();\n\n\t\tthis.on('cursor', (key) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase 'left':\n\t\t\t\tcase 'up':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, -1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\tcase 'right':\n\t\t\t\t\tthis.cursor = findCursor<T>(this.cursor, 1, this.options);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.changeValue();\n\t\t});\n\t}\n}\n","import Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface SelectKeyOptions<T extends { value: string }>\n\textends PromptOptions<T['value'], SelectKeyPrompt<T>> {\n\toptions: T[];\n\tcaseSensitive?: boolean;\n}\nexport default class SelectKeyPrompt<T extends { value: string }> extends Prompt<T['value']> {\n\toptions: T[];\n\tcursor = 0;\n\n\tconstructor(opts: SelectKeyOptions<T>) {\n\t\tsuper(opts, false);\n\n\t\tthis.options = opts.options;\n\t\tconst caseSensitive = opts.caseSensitive === true;\n\t\tconst keys = this.options.map(({ value: [initial] }) => {\n\t\t\treturn caseSensitive ? initial : initial?.toLowerCase();\n\t\t});\n\t\tthis.cursor = Math.max(keys.indexOf(opts.initialValue), 0);\n\n\t\tthis.on('key', (key, keyInfo) => {\n\t\t\tif (!key) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst casedKey = caseSensitive && keyInfo.shift ? key.toUpperCase() : key;\n\t\t\tif (!keys.includes(casedKey)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst value = this.options.find(({ value: [initial] }) => {\n\t\t\t\treturn caseSensitive ? initial === casedKey : initial?.toLowerCase() === key;\n\t\t\t});\n\t\t\tif (value) {\n\t\t\t\tthis.value = value.value;\n\t\t\t\tthis.state = 'submit';\n\t\t\t\tthis.emit('submit');\n\t\t\t}\n\t\t});\n\t}\n}\n","import { styleText } from 'node:util';\nimport Prompt, { type PromptOptions } from './prompt.js';\n\nexport interface TextOptions extends PromptOptions<string, TextPrompt> {\n\tplaceholder?: string;\n\tdefaultValue?: string;\n}\n\nexport default class TextPrompt extends Prompt<string> {\n\tget userInputWithCursor() {\n\t\tif (this.state === 'submit') {\n\t\t\treturn this.userInput;\n\t\t}\n\t\tconst userInput = this.userInput;\n\t\tif (this.cursor >= userInput.length) {\n\t\t\treturn `${this.userInput}█`;\n\t\t}\n\t\tconst s1 = userInput.slice(0, this.cursor);\n\t\tconst [s2, ...s3] = userInput.slice(this.cursor);\n\t\treturn `${s1}${styleText('inverse', s2)}${s3.join('')}`;\n\t}\n\tget cursor() {\n\t\treturn this._cursor;\n\t}\n\tconstructor(opts: TextOptions) {\n\t\tsuper({\n\t\t\t...opts,\n\t\t\tinitialUserInput: opts.initialUserInput ?? opts.initialValue,\n\t\t});\n\n\t\tthis.on('userInput', (input) => {\n\t\t\tthis._setValue(input);\n\t\t});\n\t\tthis.on('finalize', () => {\n\t\t\tif (!this.value) {\n\t\t\t\tthis.value = opts.defaultValue;\n\t\t\t}\n\t\t\tif (this.value === undefined) {\n\t\t\t\tthis.value = '';\n\t\t\t}\n\t\t});\n\t}\n}\n","import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tif (process.platform !== 'win32') {\n\t\treturn process.env.TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(process.env.CI)\n\t\t|| Boolean(process.env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| process.env.TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| process.env.TERM_PROGRAM === 'vscode'\n\t\t|| process.env.TERM === 'xterm-256color'\n\t\t|| process.env.TERM === 'alacritty'\n\t\t|| process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n","import type { Readable, Writable } from 'node:stream';\nimport { styleText } from 'node:util';\nimport type { State } from '@clack/core';\nimport isUnicodeSupported from 'is-unicode-supported';\n\nexport const unicode = isUnicodeSupported();\nexport const isCI = (): boolean => process.env.CI === 'true';\nexport const isTTY = (output: Writable): boolean => {\n\treturn (output as Writable & { isTTY?: boolean }).isTTY === true;\n};\nexport const unicodeOr = (c: string, fallback: string) => (unicode ? c : fallback);\nexport const S_STEP_ACTIVE = unicodeOr('◆', '*');\nexport const S_STEP_CANCEL = unicodeOr('■', 'x');\nexport const S_STEP_ERROR = unicodeOr('▲', 'x');\nexport const S_STEP_SUBMIT = unicodeOr('◇', 'o');\n\nexport const S_BAR_START = unicodeOr('┌', 'T');\nexport const S_BAR = unicodeOr('│', '|');\nexport const S_BAR_END = unicodeOr('└', '—');\nexport const S_BAR_START_RIGHT = unicodeOr('┐', 'T');\nexport const S_BAR_END_RIGHT = unicodeOr('┘', '—');\n\nexport const S_RADIO_ACTIVE = unicodeOr('●', '>');\nexport const S_RADIO_INACTIVE = unicodeOr('○', ' ');\nexport const S_CHECKBOX_ACTIVE = unicodeOr('◻', '[•]');\nexport const S_CHECKBOX_SELECTED = unicodeOr('◼', '[+]');\nexport const S_CHECKBOX_INACTIVE = unicodeOr('◻', '[ ]');\nexport const S_PASSWORD_MASK = unicodeOr('▪', '•');\n\nexport const S_BAR_H = unicodeOr('─', '-');\nexport const S_CORNER_TOP_RIGHT = unicodeOr('╮', '+');\nexport const S_CONNECT_LEFT = unicodeOr('├', '+');\nexport const S_CORNER_BOTTOM_RIGHT = unicodeOr('╯', '+');\nexport const S_CORNER_BOTTOM_LEFT = unicodeOr('╰', '+');\nexport const S_CORNER_TOP_LEFT = unicodeOr('╭', '+');\n\nexport const S_INFO = unicodeOr('●', '•');\nexport const S_SUCCESS = unicodeOr('◆', '*');\nexport const S_WARN = unicodeOr('▲', '!');\nexport const S_ERROR = unicodeOr('■', 'x');\n\nexport const symbol = (state: State) => {\n\tswitch (state) {\n\t\tcase 'initial':\n\t\tcase 'active':\n\t\t\treturn styleText('cyan', S_STEP_ACTIVE);\n\t\tcase 'cancel':\n\t\t\treturn styleText('red', S_STEP_CANCEL);\n\t\tcase 'error':\n\t\t\treturn styleText('yellow', S_STEP_ERROR);\n\t\tcase 'submit':\n\t\t\treturn styleText('green', S_STEP_SUBMIT);\n\t}\n};\n\nexport const symbolBar = (state: State) => {\n\tswitch (state) {\n\t\tcase 'initial':\n\t\tcase 'active':\n\t\t\treturn styleText('cyan', S_BAR);\n\t\tcase 'cancel':\n\t\t\treturn styleText('red', S_BAR);\n\t\tcase 'error':\n\t\t\treturn styleText('yellow', S_BAR);\n\t\tcase 'submit':\n\t\t\treturn styleText('green', S_BAR);\n\t}\n};\n\nexport interface CommonOptions {\n\tinput?: Readable;\n\toutput?: Writable;\n\tsignal?: AbortSignal;\n\twithGuide?: boolean;\n}\n","/* MAIN */\n//URL: https://github.com/sindresorhus/get-east-asian-width/blob/main/lookup.js\n//LICENSE: https://github.com/sindresorhus/get-east-asian-width/blob/main/license\n//TODO: Replace these with some unicode property classes, if the ones we need exist\nconst isAmbiguous = (x) => {\n return x === 0xA1 || x === 0xA4 || x === 0xA7 || x === 0xA8 || x === 0xAA || x === 0xAD || x === 0xAE || x >= 0xB0 && x <= 0xB4 || x >= 0xB6 && x <= 0xBA || x >= 0xBC && x <= 0xBF || x === 0xC6 || x === 0xD0 || x === 0xD7 || x === 0xD8 || x >= 0xDE && x <= 0xE1 || x === 0xE6 || x >= 0xE8 && x <= 0xEA || x === 0xEC || x === 0xED || x === 0xF0 || x === 0xF2 || x === 0xF3 || x >= 0xF7 && x <= 0xFA || x === 0xFC || x === 0xFE || x === 0x101 || x === 0x111 || x === 0x113 || x === 0x11B || x === 0x126 || x === 0x127 || x === 0x12B || x >= 0x131 && x <= 0x133 || x === 0x138 || x >= 0x13F && x <= 0x142 || x === 0x144 || x >= 0x148 && x <= 0x14B || x === 0x14D || x === 0x152 || x === 0x153 || x === 0x166 || x === 0x167 || x === 0x16B || x === 0x1CE || x === 0x1D0 || x === 0x1D2 || x === 0x1D4 || x === 0x1D6 || x === 0x1D8 || x === 0x1DA || x === 0x1DC || x === 0x251 || x === 0x261 || x === 0x2C4 || x === 0x2C7 || x >= 0x2C9 && x <= 0x2CB || x === 0x2CD || x === 0x2D0 || x >= 0x2D8 && x <= 0x2DB || x === 0x2DD || x === 0x2DF || x >= 0x300 && x <= 0x36F || x >= 0x391 && x <= 0x3A1 || x >= 0x3A3 && x <= 0x3A9 || x >= 0x3B1 && x <= 0x3C1 || x >= 0x3C3 && x <= 0x3C9 || x === 0x401 || x >= 0x410 && x <= 0x44F || x === 0x451 || x === 0x2010 || x >= 0x2013 && x <= 0x2016 || x === 0x2018 || x === 0x2019 || x === 0x201C || x === 0x201D || x >= 0x2020 && x <= 0x2022 || x >= 0x2024 && x <= 0x2027 || x === 0x2030 || x === 0x2032 || x === 0x2033 || x === 0x2035 || x === 0x203B || x === 0x203E || x === 0x2074 || x === 0x207F || x >= 0x2081 && x <= 0x2084 || x === 0x20AC || x === 0x2103 || x === 0x2105 || x === 0x2109 || x === 0x2113 || x === 0x2116 || x === 0x2121 || x === 0x2122 || x === 0x2126 || x === 0x212B || x === 0x2153 || x === 0x2154 || x >= 0x215B && x <= 0x215E || x >= 0x2160 && x <= 0x216B || x >= 0x2170 && x <= 0x2179 || x === 0x2189 || x >= 0x2190 && x <= 0x2199 || x === 0x21B8 || x === 0x21B9 || x === 0x21D2 || x === 0x21D4 || x === 0x21E7 || x === 0x2200 || x === 0x2202 || x === 0x2203 || x === 0x2207 || x === 0x2208 || x === 0x220B || x === 0x220F || x === 0x2211 || x === 0x2215 || x === 0x221A || x >= 0x221D && x <= 0x2220 || x === 0x2223 || x === 0x2225 || x >= 0x2227 && x <= 0x222C || x === 0x222E || x >= 0x2234 && x <= 0x2237 || x === 0x223C || x === 0x223D || x === 0x2248 || x === 0x224C || x === 0x2252 || x === 0x2260 || x === 0x2261 || x >= 0x2264 && x <= 0x2267 || x === 0x226A || x === 0x226B || x === 0x226E || x === 0x226F || x === 0x2282 || x === 0x2283 || x === 0x2286 || x === 0x2287 || x === 0x2295 || x === 0x2299 || x === 0x22A5 || x === 0x22BF || x === 0x2312 || x >= 0x2460 && x <= 0x24E9 || x >= 0x24EB && x <= 0x254B || x >= 0x2550 && x <= 0x2573 || x >= 0x2580 && x <= 0x258F || x >= 0x2592 && x <= 0x2595 || x === 0x25A0 || x === 0x25A1 || x >= 0x25A3 && x <= 0x25A9 || x === 0x25B2 || x === 0x25B3 || x === 0x25B6 || x === 0x25B7 || x === 0x25BC || x === 0x25BD || x === 0x25C0 || x === 0x25C1 || x >= 0x25C6 && x <= 0x25C8 || x === 0x25CB || x >= 0x25CE && x <= 0x25D1 || x >= 0x25E2 && x <= 0x25E5 || x === 0x25EF || x === 0x2605 || x === 0x2606 || x === 0x2609 || x === 0x260E || x === 0x260F || x === 0x261C || x === 0x261E || x === 0x2640 || x === 0x2642 || x === 0x2660 || x === 0x2661 || x >= 0x2663 && x <= 0x2665 || x >= 0x2667 && x <= 0x266A || x === 0x266C || x === 0x266D || x === 0x266F || x === 0x269E || x === 0x269F || x === 0x26BF || x >= 0x26C6 && x <= 0x26CD || x >= 0x26CF && x <= 0x26D3 || x >= 0x26D5 && x <= 0x26E1 || x === 0x26E3 || x === 0x26E8 || x === 0x26E9 || x >= 0x26EB && x <= 0x26F1 || x === 0x26F4 || x >= 0x26F6 && x <= 0x26F9 || x === 0x26FB || x === 0x26FC || x === 0x26FE || x === 0x26FF || x === 0x273D || x >= 0x2776 && x <= 0x277F || x >= 0x2B56 && x <= 0x2B59 || x >= 0x3248 && x <= 0x324F || x >= 0xE000 && x <= 0xF8FF || x >= 0xFE00 && x <= 0xFE0F || x === 0xFFFD || x >= 0x1F100 && x <= 0x1F10A || x >= 0x1F110 && x <= 0x1F12D || x >= 0x1F130 && x <= 0x1F169 || x >= 0x1F170 && x <= 0x1F18D || x === 0x1F18F || x === 0x1F190 || x >= 0x1F19B && x <= 0x1F1AC || x >= 0xE0100 && x <= 0xE01EF || x >= 0xF0000 && x <= 0xFFFFD || x >= 0x100000 && x <= 0x10FFFD;\n};\nconst isFullWidth = (x) => {\n return x === 0x3000 || x >= 0xFF01 && x <= 0xFF60 || x >= 0xFFE0 && x <= 0xFFE6;\n};\nconst isWide = (x) => {\n return x >= 0x1100 && x <= 0x115F || x === 0x231A || x === 0x231B || x === 0x2329 || x === 0x232A || x >= 0x23E9 && x <= 0x23EC || x === 0x23F0 || x === 0x23F3 || x === 0x25FD || x === 0x25FE || x === 0x2614 || x === 0x2615 || x >= 0x2648 && x <= 0x2653 || x === 0x267F || x === 0x2693 || x === 0x26A1 || x === 0x26AA || x === 0x26AB || x === 0x26BD || x === 0x26BE || x === 0x26C4 || x === 0x26C5 || x === 0x26CE || x === 0x26D4 || x === 0x26EA || x === 0x26F2 || x === 0x26F3 || x === 0x26F5 || x === 0x26FA || x === 0x26FD || x === 0x2705 || x === 0x270A || x === 0x270B || x === 0x2728 || x === 0x274C || x === 0x274E || x >= 0x2753 && x <= 0x2755 || x === 0x2757 || x >= 0x2795 && x <= 0x2797 || x === 0x27B0 || x === 0x27BF || x === 0x2B1B || x === 0x2B1C || x === 0x2B50 || x === 0x2B55 || x >= 0x2E80 && x <= 0x2E99 || x >= 0x2E9B && x <= 0x2EF3 || x >= 0x2F00 && x <= 0x2FD5 || x >= 0x2FF0 && x <= 0x2FFF || x >= 0x3001 && x <= 0x303E || x >= 0x3041 && x <= 0x3096 || 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 >= 0x4E00 && x <= 0xA48C || x >= 0xA490 && x <= 0xA4C6 || x >= 0xA960 && x <= 0xA97C || x >= 0xAC00 && x <= 0xD7A3 || x >= 0xF900 && x <= 0xFAFF || x >= 0xFE10 && x <= 0xFE19 || x >= 0xFE30 && x <= 0xFE52 || x >= 0xFE54 && x <= 0xFE66 || x >= 0xFE68 && x <= 0xFE6B || x >= 0x16FE0 && x <= 0x16FE4 || x === 0x16FF0 || x === 0x16FF1 || x >= 0x17000 && x <= 0x187F7 || x >= 0x18800 && x <= 0x18CD5 || x >= 0x18D00 && x <= 0x18D08 || x >= 0x1AFF0 && x <= 0x1AFF3 || x >= 0x1AFF5 && x <= 0x1AFFB || x === 0x1AFFD || x === 0x1AFFE || x >= 0x1B000 && x <= 0x1B122 || x === 0x1B132 || x >= 0x1B150 && x <= 0x1B152 || x === 0x1B155 || x >= 0x1B164 && x <= 0x1B167 || x >= 0x1B170 && x <= 0x1B2FB || x === 0x1F004 || x === 0x1F0CF || x === 0x1F18E || x >= 0x1F191 && x <= 0x1F19A || x >= 0x1F200 && x <= 0x1F202 || x >= 0x1F210 && x <= 0x1F23B || x >= 0x1F240 && x <= 0x1F248 || x === 0x1F250 || x === 0x1F251 || x >= 0x1F260 && x <= 0x1F265 || x >= 0x1F300 && x <= 0x1F320 || x >= 0x1F32D && x <= 0x1F335 || x >= 0x1F337 && x <= 0x1F37C || x >= 0x1F37E && x <= 0x1F393 || x >= 0x1F3A0 && x <= 0x1F3CA || x >= 0x1F3CF && x <= 0x1F3D3 || x >= 0x1F3E0 && x <= 0x1F3F0 || x === 0x1F3F4 || x >= 0x1F3F8 && x <= 0x1F43E || x === 0x1F440 || x >= 0x1F442 && x <= 0x1F4FC || x >= 0x1F4FF && x <= 0x1F53D || x >= 0x1F54B && x <= 0x1F54E || x >= 0x1F550 && x <= 0x1F567 || x === 0x1F57A || x === 0x1F595 || x === 0x1F596 || x === 0x1F5A4 || x >= 0x1F5FB && x <= 0x1F64F || x >= 0x1F680 && x <= 0x1F6C5 || x === 0x1F6CC || x >= 0x1F6D0 && x <= 0x1F6D2 || x >= 0x1F6D5 && x <= 0x1F6D7 || x >= 0x1F6DC && x <= 0x1F6DF || x === 0x1F6EB || x === 0x1F6EC || x >= 0x1F6F4 && x <= 0x1F6FC || x >= 0x1F7E0 && x <= 0x1F7EB || x === 0x1F7F0 || x >= 0x1F90C && x <= 0x1F93A || x >= 0x1F93C && x <= 0x1F945 || x >= 0x1F947 && x <= 0x1F9FF || x >= 0x1FA70 && x <= 0x1FA7C || x >= 0x1FA80 && x <= 0x1FA88 || x >= 0x1FA90 && x <= 0x1FABD || x >= 0x1FABF && x <= 0x1FAC5 || x >= 0x1FACE && x <= 0x1FADB || x >= 0x1FAE0 && x <= 0x1FAE8 || x >= 0x1FAF0 && x <= 0x1FAF8 || x >= 0x20000 && x <= 0x2FFFD || x >= 0x30000 && x <= 0x3FFFD;\n};\n/* EXPORT */\nexport { isAmbiguous, isFullWidth, isWide };\n","/* IMPORT */\nimport { isAmbiguous, isFullWidth, isWide } from './utils.js';\n/* HELPERS */\nconst ANSI_RE = /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;\nconst CONTROL_RE = /[\\x00-\\x08\\x0A-\\x1F\\x7F-\\x9F]{1,1000}/y;\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 */\n//TODO: Optimize matching non-latin letters\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 = widthOptions.ansiWidth ?? 0;\n const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;\n const TAB_WIDTH = widthOptions.tabWidth ?? 8;\n const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;\n const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;\n const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;\n const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;\n const WIDE_WIDTH = widthOptions.wideWidth ?? 2;\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 (isWide(codePoint)) {\n widthExtra = WIDE_WIDTH;\n }\n else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {\n widthExtra = AMBIGUOUS_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;\n /* LATIN */\n LATIN_RE.lastIndex = index;\n if (LATIN_RE.test(input)) {\n lengthExtra = LATIN_RE.lastIndex - index;\n widthExtra = lengthExtra * REGULAR_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = LATIN_RE.lastIndex;\n continue;\n }\n /* ANSI */\n ANSI_RE.lastIndex = index;\n if (ANSI_RE.test(input)) {\n if ((width + ANSI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + ANSI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += ANSI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = ANSI_RE.lastIndex;\n continue;\n }\n /* CONTROL */\n CONTROL_RE.lastIndex = index;\n if (CONTROL_RE.test(input)) {\n lengthExtra = CONTROL_RE.lastIndex - index;\n widthExtra = lengthExtra * CONTROL_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = CONTROL_RE.lastIndex;\n continue;\n }\n /* TAB */\n TAB_RE.lastIndex = index;\n if (TAB_RE.test(input)) {\n lengthExtra = TAB_RE.lastIndex - index;\n widthExtra = lengthExtra * TAB_WIDTH;\n if ((width + widthExtra) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));\n }\n if ((width + widthExtra) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += widthExtra;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = TAB_RE.lastIndex;\n continue;\n }\n /* EMOJI */\n EMOJI_RE.lastIndex = index;\n if (EMOJI_RE.test(input)) {\n if ((width + EMOJI_WIDTH) > truncationLimit) {\n truncationIndex = Math.min(truncationIndex, index);\n }\n if ((width + EMOJI_WIDTH) > LIMIT) {\n truncationEnabled = true;\n break;\n }\n width += EMOJI_WIDTH;\n unmatchedStart = indexPrev;\n unmatchedEnd = index;\n index = indexPrev = EMOJI_RE.lastIndex;\n continue;\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 wordLengths = (words) => words.map((character) => stringWidth(character));\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 &&\n lastRow !== undefined &&\n lastRow.length > 0 &&\n 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 > 0) {\n if (stringWidth(words[last - 1]) > 0) {\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 const lengths = wordLengths(words);\n let rows = [''];\n for (const [index, word] of words.entries()) {\n if (options.trim !== false) {\n rows[rows.length - 1] = (rows.at(-1) ?? '').trimStart();\n }\n let rowLength = stringWidth(rows.at(-1) ?? '');\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 > 0 || options.trim === false) {\n rows[rows.length - 1] += ' ';\n rowLength++;\n }\n }\n if (options.hard && lengths[index] > columns) {\n const remainingColumns = columns - rowLength;\n const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);\n const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);\n if (breaksStartingNextLine < breaksStartingThisLine) {\n rows.push('');\n }\n wrapWord(rows, word, columns);\n continue;\n }\n if (rowLength + lengths[index] > columns &&\n rowLength > 0 &&\n lengths[index] > 0) {\n if (options.wordWrap === false && rowLength < columns) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows.push('');\n }\n if (rowLength + lengths[index] > columns && options.wordWrap === false) {\n wrapWord(rows, word, columns);\n continue;\n }\n rows[rows.length - 1] += word;\n }\n if (options.trim !== false) {\n rows = rows.map((row) => stringVisibleTrimSpacesRight(row));\n }\n const preString = rows.join('\\n');\n const pre = preString[Symbol.iterator]();\n let currentPre = pre.next();\n let nextPre = pre.next();\n // We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.\n let preStringIndex = 0;\n while (!currentPre.done) {\n const character = currentPre.value;\n const nextCharacter = nextPre.value;\n returnValue += character;\n if (character === ESC || character === CSI) {\n GROUP_REGEX.lastIndex = preStringIndex + 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 const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;\n if (nextCharacter === '\\n') {\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink('');\n }\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(closingCode);\n }\n }\n else if (character === '\\n') {\n if (escapeCode && closingCode) {\n returnValue += wrapAnsiCode(escapeCode);\n }\n if (escapeUrl) {\n returnValue += wrapAnsiHyperlink(escapeUrl);\n }\n }\n preStringIndex += character.length;\n currentPre = nextPre;\n nextPre = pre.next();\n }\n return returnValue;\n};\nexport function wrapAnsi(string, columns, options) {\n return String(string)\n .normalize()\n .replaceAll('\\r\\n', '\\n')\n .split('\\n')\n .map((line) => exec(line, columns, options))\n .join('\\n');\n}\n//# sourceMappingURL=main.js.map","import { styleText } from 'node:util';\nimport { getColumns, getRows } from '@clack/core';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport type { CommonOptions } from './common.js';\n\nexport interface LimitOptionsParams<TOption> extends CommonOptions {\n\toptions: TOption[];\n\tcursor: number;\n\tstyle: (option: TOption, active: boolean) => string;\n\tmaxItems?: number;\n\tcolumnPadding?: number;\n\trowPadding?: number;\n}\n\nconst trimLines = (\n\tgroups: Array<string[]>,\n\tinitialLineCount: number,\n\tstartIndex: number,\n\tendIndex: number,\n\tmaxLines: number\n) => {\n\tlet lineCount = initialLineCount;\n\tlet removals = 0;\n\tfor (let i = startIndex; i < endIndex; i++) {\n\t\tconst group = groups[i];\n\t\tlineCount = lineCount - group.length;\n\t\tremovals++;\n\t\tif (lineCount <= maxLines) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn { lineCount, removals };\n};\n\nexport const limitOptions = <TOption>({\n\tcursor,\n\toptions,\n\tstyle,\n\toutput = process.stdout,\n\tmaxItems = Number.POSITIVE_INFINITY,\n\tcolumnPadding = 0,\n\trowPadding = 4,\n}: LimitOptionsParams<TOption>): string[] => {\n\tconst columns = getColumns(output);\n\tconst maxWidth = columns - columnPadding;\n\tconst rows = getRows(output);\n\tconst overflowFormat = styleText('dim', '...');\n\n\tconst outputMaxItems = Math.max(rows - rowPadding, 0);\n\t// We clamp to minimum 5 because anything less doesn't make sense UX wise\n\tconst computedMaxItems = Math.max(Math.min(maxItems, outputMaxItems), 5);\n\tlet slidingWindowLocation = 0;\n\n\tif (cursor >= computedMaxItems - 3) {\n\t\tslidingWindowLocation = Math.max(\n\t\t\tMath.min(cursor - computedMaxItems + 3, options.length - computedMaxItems),\n\t\t\t0\n\t\t);\n\t}\n\n\tlet shouldRenderTopEllipsis = computedMaxItems < options.length && slidingWindowLocation > 0;\n\tlet shouldRenderBottomEllipsis =\n\t\tcomputedMaxItems < options.length && slidingWindowLocation + computedMaxItems < options.length;\n\n\tconst slidingWindowLocationEnd = Math.min(\n\t\tslidingWindowLocation + computedMaxItems,\n\t\toptions.length\n\t);\n\tconst lineGroups: Array<string[]> = [];\n\tlet lineCount = 0;\n\tif (shouldRenderTopEllipsis) {\n\t\tlineCount++;\n\t}\n\tif (shouldRenderBottomEllipsis) {\n\t\tlineCount++;\n\t}\n\n\tconst slidingWindowLocationWithEllipsis =\n\t\tslidingWindowLocation + (shouldRenderTopEllipsis ? 1 : 0);\n\tconst slidingWindowLocationEndWithEllipsis =\n\t\tslidingWindowLocationEnd - (shouldRenderBottomEllipsis ? 1 : 0);\n\n\tfor (let i = slidingWindowLocationWithEllipsis; i < slidingWindowLocationEndWithEllipsis; i++) {\n\t\tconst wrappedLines = wrapAnsi(style(options[i], i === cursor), maxWidth, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t}).split('\\n');\n\t\tlineGroups.push(wrappedLines);\n\t\tlineCount += wrappedLines.length;\n\t}\n\n\tif (lineCount > outputMaxItems) {\n\t\tlet precedingRemovals = 0;\n\t\tlet followingRemovals = 0;\n\t\tlet newLineCount = lineCount;\n\t\tconst cursorGroupIndex = cursor - slidingWindowLocationWithEllipsis;\n\t\tconst trimLinesLocal = (startIndex: number, endIndex: number) =>\n\t\t\ttrimLines(lineGroups, newLineCount, startIndex, endIndex, outputMaxItems);\n\n\t\tif (shouldRenderTopEllipsis) {\n\t\t\t({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal(\n\t\t\t\t0,\n\t\t\t\tcursorGroupIndex\n\t\t\t));\n\t\t\tif (newLineCount > outputMaxItems) {\n\t\t\t\t({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal(\n\t\t\t\t\tcursorGroupIndex + 1,\n\t\t\t\t\tlineGroups.length\n\t\t\t\t));\n\t\t\t}\n\t\t} else {\n\t\t\t({ lineCount: newLineCount, removals: followingRemovals } = trimLinesLocal(\n\t\t\t\tcursorGroupIndex + 1,\n\t\t\t\tlineGroups.length\n\t\t\t));\n\t\t\tif (newLineCount > outputMaxItems) {\n\t\t\t\t({ lineCount: newLineCount, removals: precedingRemovals } = trimLinesLocal(\n\t\t\t\t\t0,\n\t\t\t\t\tcursorGroupIndex\n\t\t\t\t));\n\t\t\t}\n\t\t}\n\n\t\tif (precedingRemovals > 0) {\n\t\t\tshouldRenderTopEllipsis = true;\n\t\t\tlineGroups.splice(0, precedingRemovals);\n\t\t}\n\t\tif (followingRemovals > 0) {\n\t\t\tshouldRenderBottomEllipsis = true;\n\t\t\tlineGroups.splice(lineGroups.length - followingRemovals, followingRemovals);\n\t\t}\n\t}\n\n\tconst result: string[] = [];\n\tif (shouldRenderTopEllipsis) {\n\t\tresult.push(overflowFormat);\n\t}\n\tfor (const lineGroup of lineGroups) {\n\t\tfor (const line of lineGroup) {\n\t\t\tresult.push(line);\n\t\t}\n\t}\n\tif (shouldRenderBottomEllipsis) {\n\t\tresult.push(overflowFormat);\n\t}\n\n\treturn result;\n};\n","import { styleText } from 'node:util';\nimport { AutocompletePrompt, settings } from '@clack/core';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\nimport type { Option } from './select.js';\n\nfunction getLabel<T>(option: Option<T>) {\n\treturn option.label ?? String(option.value ?? '');\n}\n\nfunction getFilteredOption<T>(searchText: string, option: Option<T>): boolean {\n\tif (!searchText) {\n\t\treturn true;\n\t}\n\tconst label = (option.label ?? String(option.value ?? '')).toLowerCase();\n\tconst hint = (option.hint ?? '').toLowerCase();\n\tconst value = String(option.value).toLowerCase();\n\tconst term = searchText.toLowerCase();\n\n\treturn label.includes(term) || hint.includes(term) || value.includes(term);\n}\n\nfunction getSelectedOptions<T>(values: T[], options: Option<T>[]): Option<T>[] {\n\tconst results: Option<T>[] = [];\n\n\tfor (const option of options) {\n\t\tif (values.includes(option.value)) {\n\t\t\tresults.push(option);\n\t\t}\n\t}\n\n\treturn results;\n}\n\ninterface AutocompleteSharedOptions<Value> extends CommonOptions {\n\t/**\n\t * The message to display to the user.\n\t */\n\tmessage: string;\n\t/**\n\t * Available options for the autocomplete prompt.\n\t */\n\toptions: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]);\n\t/**\n\t * Maximum number of items to display at once.\n\t */\n\tmaxItems?: number;\n\t/**\n\t * Placeholder text to display when no input is provided.\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Validates the value\n\t */\n\tvalidate?: (value: Value | Value[] | undefined) => string | Error | undefined;\n\t/**\n\t * Custom filter function to match options against search input.\n\t * If not provided, a default filter that matches label, hint, and value is used.\n\t */\n\tfilter?: (search: string, option: Option<Value>) => boolean;\n}\n\nexport interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {\n\t/**\n\t * The initial selected value.\n\t */\n\tinitialValue?: Value;\n\t/**\n\t * The initial user input\n\t */\n\tinitialUserInput?: string;\n}\n\nexport const autocomplete = <Value>(opts: AutocompleteOptions<Value>) => {\n\tconst prompt = new AutocompletePrompt({\n\t\toptions: opts.options,\n\t\tinitialValue: opts.initialValue ? [opts.initialValue] : undefined,\n\t\tinitialUserInput: opts.initialUserInput,\n\t\tfilter:\n\t\t\topts.filter ??\n\t\t\t((search: string, opt: Option<Value>) => {\n\t\t\t\treturn getFilteredOption(search, opt);\n\t\t\t}),\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tvalidate: opts.validate,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\t// Title and message display\n\t\t\tconst headings = hasGuide\n\t\t\t\t? [`${styleText('gray', S_BAR)}`, `${symbol(this.state)} ${opts.message}`]\n\t\t\t\t: [`${symbol(this.state)} ${opts.message}`];\n\t\t\tconst userInput = this.userInput;\n\t\t\tconst options = this.options;\n\t\t\tconst placeholder = opts.placeholder;\n\t\t\tconst showPlaceholder = userInput === '' && placeholder !== undefined;\n\t\t\tconst opt = (option: Option<Value>, state: 'inactive' | 'active' | 'disabled') => {\n\t\t\t\tconst label = getLabel(option);\n\t\t\t\tconst hint =\n\t\t\t\t\toption.hint && option.value === this.focusedValue\n\t\t\t\t\t\t? styleText('dim', ` (${option.hint})`)\n\t\t\t\t\t\t: '';\n\t\t\t\tswitch (state) {\n\t\t\t\t\tcase 'active':\n\t\t\t\t\t\treturn `${styleText('green', S_RADIO_ACTIVE)} ${label}${hint}`;\n\t\t\t\t\tcase 'inactive':\n\t\t\t\t\t\treturn `${styleText('dim', S_RADIO_INACTIVE)} ${styleText('dim', label)}`;\n\t\t\t\t\tcase 'disabled':\n\t\t\t\t\t\treturn `${styleText('gray', S_RADIO_INACTIVE)} ${styleText(['strikethrough', 'gray'], label)}`;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Handle different states\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\t// Show selected value\n\t\t\t\t\tconst selected = getSelectedOptions(this.selectedValues, options);\n\t\t\t\t\tconst label =\n\t\t\t\t\t\tselected.length > 0 ? ` ${styleText('dim', selected.map(getLabel).join(', '))}` : '';\n\t\t\t\t\tconst submitPrefix = hasGuide ? styleText('gray', S_BAR) : '';\n\t\t\t\t\treturn `${headings.join('\\n')}\\n${submitPrefix}${label}`;\n\t\t\t\t}\n\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst userInputText = userInput\n\t\t\t\t\t\t? ` ${styleText(['strikethrough', 'dim'], userInput)}`\n\t\t\t\t\t\t: '';\n\t\t\t\t\tconst cancelPrefix = hasGuide ? styleText('gray', S_BAR) : '';\n\t\t\t\t\treturn `${headings.join('\\n')}\\n${cancelPrefix}${userInputText}`;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tconst barStyle = this.state === 'error' ? 'yellow' : 'cyan';\n\t\t\t\t\tconst guidePrefix = hasGuide ? `${styleText(barStyle, S_BAR)} ` : '';\n\t\t\t\t\tconst guidePrefixEnd = hasGuide ? styleText(barStyle, S_BAR_END) : '';\n\t\t\t\t\t// Display cursor position - show plain text in navigation mode\n\t\t\t\t\tlet searchText = '';\n\t\t\t\t\tif (this.isNavigating || showPlaceholder) {\n\t\t\t\t\t\tconst searchTextValue = showPlaceholder ? placeholder : userInput;\n\t\t\t\t\t\tsearchText = searchTextValue !== '' ? ` ${styleText('dim', searchTextValue)}` : '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsearchText = ` ${this.userInputWithCursor}`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Show match count if filtered\n\t\t\t\t\tconst matches =\n\t\t\t\t\t\tthis.filteredOptions.length !== options.length\n\t\t\t\t\t\t\t? styleText(\n\t\t\t\t\t\t\t\t\t'dim',\n\t\t\t\t\t\t\t\t\t` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: '';\n\n\t\t\t\t\t// No matches message\n\t\t\t\t\tconst noResults =\n\t\t\t\t\t\tthis.filteredOptions.length === 0 && userInput\n\t\t\t\t\t\t\t? [`${guidePrefix}${styleText('yellow', 'No matches found')}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\tconst validationError =\n\t\t\t\t\t\tthis.state === 'error' ? [`${guidePrefix}${styleText('yellow', this.error)}`] : [];\n\n\t\t\t\t\tif (hasGuide) {\n\t\t\t\t\t\theadings.push(`${guidePrefix.trimEnd()}`);\n\t\t\t\t\t}\n\t\t\t\t\theadings.push(\n\t\t\t\t\t\t`${guidePrefix}${styleText('dim', 'Search:')}${searchText}${matches}`,\n\t\t\t\t\t\t...noResults,\n\t\t\t\t\t\t...validationError\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show instructions\n\t\t\t\t\tconst instructions = [\n\t\t\t\t\t\t`${styleText('dim', '↑/↓')} to select`,\n\t\t\t\t\t\t`${styleText('dim', 'Enter:')} confirm`,\n\t\t\t\t\t\t`${styleText('dim', 'Type:')} to search`,\n\t\t\t\t\t];\n\n\t\t\t\t\tconst footers = [`${guidePrefix}${instructions.join(' • ')}`, guidePrefixEnd];\n\n\t\t\t\t\t// Render options with selection\n\t\t\t\t\tconst displayOptions =\n\t\t\t\t\t\tthis.filteredOptions.length === 0\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: limitOptions({\n\t\t\t\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\t\t\t\toptions: this.filteredOptions,\n\t\t\t\t\t\t\t\t\tcolumnPadding: hasGuide ? 3 : 0, // for `| ` when guide is shown\n\t\t\t\t\t\t\t\t\trowPadding: headings.length + footers.length,\n\t\t\t\t\t\t\t\t\tstyle: (option, active) => {\n\t\t\t\t\t\t\t\t\t\treturn opt(\n\t\t\t\t\t\t\t\t\t\t\toption,\n\t\t\t\t\t\t\t\t\t\t\toption.disabled ? 'disabled' : active ? 'active' : 'inactive'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t// Return the formatted prompt\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...headings,\n\t\t\t\t\t\t...displayOptions.map((option) => `${guidePrefix}${option}`),\n\t\t\t\t\t\t...footers,\n\t\t\t\t\t].join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\t// Return the result or cancel symbol\n\treturn prompt.prompt() as Promise<Value | symbol>;\n};\n\n// Type definition for the autocompleteMultiselect component\nexport interface AutocompleteMultiSelectOptions<Value> extends AutocompleteSharedOptions<Value> {\n\t/**\n\t * The initial selected values\n\t */\n\tinitialValues?: Value[];\n\t/**\n\t * If true, at least one option must be selected\n\t */\n\trequired?: boolean;\n}\n\n/**\n * Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI\n */\nexport const autocompleteMultiselect = <Value>(opts: AutocompleteMultiSelectOptions<Value>) => {\n\tconst formatOption = (\n\t\toption: Option<Value>,\n\t\tactive: boolean,\n\t\tselectedValues: Value[],\n\t\tfocusedValue: Value | undefined\n\t) => {\n\t\tconst isSelected = selectedValues.includes(option.value);\n\t\tconst label = option.label ?? String(option.value ?? '');\n\t\tconst hint =\n\t\t\toption.hint && focusedValue !== undefined && option.value === focusedValue\n\t\t\t\t? styleText('dim', ` (${option.hint})`)\n\t\t\t\t: '';\n\t\tconst checkbox = isSelected\n\t\t\t? styleText('green', S_CHECKBOX_SELECTED)\n\t\t\t: styleText('dim', S_CHECKBOX_INACTIVE);\n\n\t\tif (option.disabled) {\n\t\t\treturn `${styleText('gray', S_CHECKBOX_INACTIVE)} ${styleText(['strikethrough', 'gray'], label)}`;\n\t\t}\n\t\tif (active) {\n\t\t\treturn `${checkbox} ${label}${hint}`;\n\t\t}\n\t\treturn `${checkbox} ${styleText('dim', label)}`;\n\t};\n\n\t// Create text prompt which we'll use as foundation\n\tconst prompt = new AutocompletePrompt<Option<Value>>({\n\t\toptions: opts.options,\n\t\tmultiple: true,\n\t\tfilter:\n\t\t\topts.filter ??\n\t\t\t((search, opt) => {\n\t\t\t\treturn getFilteredOption(search, opt);\n\t\t\t}),\n\t\tvalidate: () => {\n\t\t\tif (opts.required && prompt.selectedValues.length === 0) {\n\t\t\t\treturn 'Please select at least one item';\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\tinitialValue: opts.initialValues,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\trender() {\n\t\t\t// Title and symbol\n\t\t\tconst title = `${styleText('gray', S_BAR)}\\n${symbol(this.state)} ${opts.message}\\n`;\n\n\t\t\t// Selection counter\n\t\t\tconst userInput = this.userInput;\n\t\t\tconst placeholder = opts.placeholder;\n\t\t\tconst showPlaceholder = userInput === '' && placeholder !== undefined;\n\n\t\t\t// Search input display\n\t\t\tconst searchText =\n\t\t\t\tthis.isNavigating || showPlaceholder\n\t\t\t\t\t? styleText('dim', showPlaceholder ? placeholder : userInput) // Just show plain text when in navigation mode\n\t\t\t\t\t: this.userInputWithCursor;\n\n\t\t\tconst options = this.options;\n\n\t\t\tconst matches =\n\t\t\t\tthis.filteredOptions.length !== options.length\n\t\t\t\t\t? styleText(\n\t\t\t\t\t\t\t'dim',\n\t\t\t\t\t\t\t` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? '' : 'es'})`\n\t\t\t\t\t\t)\n\t\t\t\t\t: '';\n\n\t\t\t// Render prompt state\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\treturn `${title}${styleText('gray', S_BAR)} ${styleText('dim', `${this.selectedValues.length} items selected`)}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\treturn `${title}${styleText('gray', S_BAR)} ${styleText(['strikethrough', 'dim'], userInput)}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst barStyle = this.state === 'error' ? 'yellow' : 'cyan';\n\t\t\t\t\t// Instructions\n\t\t\t\t\tconst instructions = [\n\t\t\t\t\t\t`${styleText('dim', '↑/↓')} to navigate`,\n\t\t\t\t\t\t`${styleText('dim', this.isNavigating ? 'Space/Tab:' : 'Tab:')} select`,\n\t\t\t\t\t\t`${styleText('dim', 'Enter:')} confirm`,\n\t\t\t\t\t\t`${styleText('dim', 'Type:')} to search`,\n\t\t\t\t\t];\n\n\t\t\t\t\t// No results message\n\t\t\t\t\tconst noResults =\n\t\t\t\t\t\tthis.filteredOptions.length === 0 && userInput\n\t\t\t\t\t\t\t? [`${styleText(barStyle, S_BAR)} ${styleText('yellow', 'No matches found')}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\tthis.state === 'error'\n\t\t\t\t\t\t\t? [`${styleText(barStyle, S_BAR)} ${styleText('yellow', this.error)}`]\n\t\t\t\t\t\t\t: [];\n\n\t\t\t\t\t// Calculate header and footer line counts for rowPadding\n\t\t\t\t\tconst headerLines = [\n\t\t\t\t\t\t...`${title}${styleText(barStyle, S_BAR)}`.split('\\n'),\n\t\t\t\t\t\t`${styleText(barStyle, S_BAR)} ${styleText('dim', 'Search:')} ${searchText}${matches}`,\n\t\t\t\t\t\t...noResults,\n\t\t\t\t\t\t...errorMessage,\n\t\t\t\t\t];\n\t\t\t\t\tconst footerLines = [\n\t\t\t\t\t\t`${styleText(barStyle, S_BAR)} ${instructions.join(' • ')}`,\n\t\t\t\t\t\tstyleText(barStyle, S_BAR_END),\n\t\t\t\t\t];\n\n\t\t\t\t\t// Get limited options for display\n\t\t\t\t\tconst displayOptions = limitOptions({\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\toptions: this.filteredOptions,\n\t\t\t\t\t\tstyle: (option, active) =>\n\t\t\t\t\t\t\tformatOption(option, active, this.selectedValues, this.focusedValue),\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\trowPadding: headerLines.length + footerLines.length,\n\t\t\t\t\t});\n\n\t\t\t\t\t// Build the prompt display\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...headerLines,\n\t\t\t\t\t\t...displayOptions.map((option) => `${styleText(barStyle, S_BAR)} ${option}`),\n\t\t\t\t\t\t...footerLines,\n\t\t\t\t\t].join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\t// Return the result or cancel symbol\n\treturn prompt.prompt() as Promise<Value[] | symbol>;\n};\n","import type { Writable } from 'node:stream';\nimport { getColumns, settings } from '@clack/core';\nimport stringWidth from 'fast-string-width';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_BAR_END_RIGHT,\n\tS_BAR_H,\n\tS_BAR_START,\n\tS_BAR_START_RIGHT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n\tS_CORNER_TOP_LEFT,\n\tS_CORNER_TOP_RIGHT,\n} from './common.js';\n\nexport type BoxAlignment = 'left' | 'center' | 'right';\n\ntype BoxSymbols = [topLeft: string, topRight: string, bottomLeft: string, bottomRight: string];\n\nconst roundedSymbols: BoxSymbols = [\n\tS_CORNER_TOP_LEFT,\n\tS_CORNER_TOP_RIGHT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n];\nconst squareSymbols: BoxSymbols = [S_BAR_START, S_BAR_START_RIGHT, S_BAR_END, S_BAR_END_RIGHT];\n\nexport interface BoxOptions extends CommonOptions {\n\tcontentAlign?: BoxAlignment;\n\ttitleAlign?: BoxAlignment;\n\twidth?: number | 'auto';\n\ttitlePadding?: number;\n\tcontentPadding?: number;\n\trounded?: boolean;\n\tformatBorder?: (text: string) => string;\n}\n\nfunction getPaddingForLine(\n\tlineLength: number,\n\tinnerWidth: number,\n\tpadding: number,\n\tcontentAlign: BoxAlignment | undefined\n): [number, number] {\n\tlet leftPadding = padding;\n\tlet rightPadding = padding;\n\tif (contentAlign === 'center') {\n\t\tleftPadding = Math.floor((innerWidth - lineLength) / 2);\n\t} else if (contentAlign === 'right') {\n\t\tleftPadding = innerWidth - lineLength - padding;\n\t}\n\n\trightPadding = innerWidth - leftPadding - lineLength;\n\n\treturn [leftPadding, rightPadding];\n}\n\nconst defaultFormatBorder = (text: string) => text;\n\nexport const box = (message = '', title = '', opts?: BoxOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst borderWidth = 1;\n\tconst borderTotalWidth = borderWidth * 2;\n\tconst titlePadding = opts?.titlePadding ?? 1;\n\tconst contentPadding = opts?.contentPadding ?? 2;\n\tconst width = opts?.width === undefined || opts.width === 'auto' ? 1 : Math.min(1, opts.width);\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst linePrefix = !hasGuide ? '' : `${S_BAR} `;\n\tconst formatBorder = opts?.formatBorder ?? defaultFormatBorder;\n\tconst symbols = (opts?.rounded ? roundedSymbols : squareSymbols).map(formatBorder);\n\tconst hSymbol = formatBorder(S_BAR_H);\n\tconst vSymbol = formatBorder(S_BAR);\n\tconst linePrefixWidth = stringWidth(linePrefix);\n\tconst titleWidth = stringWidth(title);\n\tconst maxBoxWidth = columns - linePrefixWidth;\n\tlet boxWidth = Math.floor(columns * width) - linePrefixWidth;\n\tif (opts?.width === 'auto') {\n\t\tconst lines = message.split('\\n');\n\t\tlet longestLine = titleWidth + titlePadding * 2;\n\t\tfor (const line of lines) {\n\t\t\tconst lineWithPadding = stringWidth(line) + contentPadding * 2;\n\t\t\tif (lineWithPadding > longestLine) {\n\t\t\t\tlongestLine = lineWithPadding;\n\t\t\t}\n\t\t}\n\t\tconst longestLineWidth = longestLine + borderTotalWidth;\n\t\tif (longestLineWidth < boxWidth) {\n\t\t\tboxWidth = longestLineWidth;\n\t\t}\n\t}\n\tif (boxWidth % 2 !== 0) {\n\t\tif (boxWidth < maxBoxWidth) {\n\t\t\tboxWidth++;\n\t\t} else {\n\t\t\tboxWidth--;\n\t\t}\n\t}\n\tconst innerWidth = boxWidth - borderTotalWidth;\n\tconst maxTitleLength = innerWidth - titlePadding * 2;\n\tconst truncatedTitle =\n\t\ttitleWidth > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title;\n\tconst [titlePaddingLeft, titlePaddingRight] = getPaddingForLine(\n\t\tstringWidth(truncatedTitle),\n\t\tinnerWidth,\n\t\ttitlePadding,\n\t\topts?.titleAlign\n\t);\n\tconst wrappedMessage = wrapAnsi(message, innerWidth - contentPadding * 2, {\n\t\thard: true,\n\t\ttrim: false,\n\t});\n\toutput.write(\n\t\t`${linePrefix}${symbols[0]}${hSymbol.repeat(titlePaddingLeft)}${truncatedTitle}${hSymbol.repeat(titlePaddingRight)}${symbols[1]}\\n`\n\t);\n\tconst wrappedLines = wrappedMessage.split('\\n');\n\tfor (const line of wrappedLines) {\n\t\tconst [leftLinePadding, rightLinePadding] = getPaddingForLine(\n\t\t\tstringWidth(line),\n\t\t\tinnerWidth,\n\t\t\tcontentPadding,\n\t\t\topts?.contentAlign\n\t\t);\n\t\toutput.write(\n\t\t\t`${linePrefix}${vSymbol}${' '.repeat(leftLinePadding)}${line}${' '.repeat(rightLinePadding)}${vSymbol}\\n`\n\t\t);\n\t}\n\toutput.write(`${linePrefix}${symbols[2]}${hSymbol.repeat(innerWidth)}${symbols[3]}\\n`);\n};\n","import { styleText } from 'node:util';\nimport { ConfirmPrompt, settings } from '@clack/core';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n} from './common.js';\n\nexport interface ConfirmOptions extends CommonOptions {\n\tmessage: string;\n\tactive?: string;\n\tinactive?: string;\n\tinitialValue?: boolean;\n\tvertical?: boolean;\n}\nexport const confirm = (opts: ConfirmOptions) => {\n\tconst active = opts.active ?? 'Yes';\n\tconst inactive = opts.inactive ?? 'No';\n\treturn new ConfirmPrompt({\n\t\tactive,\n\t\tinactive,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue ?? true,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${styleText('gray', S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst value = this.value ? active : inactive;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${styleText('dim', value)}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${styleText(['strikethrough', 'dim'], value)}${\n\t\t\t\t\t\thasGuide ? `\\n${styleText('gray', S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? styleText('cyan', S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${\n\t\t\t\t\t\tthis.value\n\t\t\t\t\t\t\t? `${styleText('green', S_RADIO_ACTIVE)} ${active}`\n\t\t\t\t\t\t\t: `${styleText('dim', S_RADIO_INACTIVE)} ${styleText('dim', active)}`\n\t\t\t\t\t}${opts.vertical ? (hasGuide ? `\\n${styleText('cyan', S_BAR)} ` : '\\n') : ` ${styleText('dim', '/')} `}${\n\t\t\t\t\t\t!this.value\n\t\t\t\t\t\t\t? `${styleText('green', S_RADIO_ACTIVE)} ${inactive}`\n\t\t\t\t\t\t\t: `${styleText('dim', S_RADIO_INACTIVE)} ${styleText('dim', inactive)}`\n\t\t\t\t\t}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<boolean | symbol>;\n};\n","import { isCancel } from '@clack/core';\n\ntype Prettify<T> = {\n\t[P in keyof T]: T[P];\n} & {};\n\nexport type PromptGroupAwaitedReturn<T> = {\n\t[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;\n};\n\nexport interface PromptGroupOptions<T> {\n\t/**\n\t * Control how the group can be canceled\n\t * if one of the prompts is canceled.\n\t */\n\tonCancel?: (opts: { results: Prettify<Partial<PromptGroupAwaitedReturn<T>>> }) => void;\n}\n\nexport type PromptGroup<T> = {\n\t[P in keyof T]: (opts: {\n\t\tresults: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;\n\t}) => undefined | Promise<T[P] | undefined>;\n};\n\n/**\n * Define a group of prompts to be displayed\n * and return a results of objects within the group\n */\nexport const group = async <T>(\n\tprompts: PromptGroup<T>,\n\topts?: PromptGroupOptions<T>\n): Promise<Prettify<PromptGroupAwaitedReturn<T>>> => {\n\tconst results = {} as any;\n\tconst promptNames = Object.keys(prompts);\n\n\tfor (const name of promptNames) {\n\t\tconst prompt = prompts[name as keyof T];\n\t\tconst result = await prompt({ results })?.catch((e) => {\n\t\t\tthrow e;\n\t\t});\n\n\t\t// Pass the results to the onCancel function\n\t\t// so the user can decide what to do with the results\n\t\t// TODO: Switch to callback within core to avoid isCancel Fn\n\t\tif (typeof opts?.onCancel === 'function' && isCancel(result)) {\n\t\t\tresults[name] = 'canceled';\n\t\t\topts.onCancel({ results });\n\t\t\tcontinue;\n\t\t}\n\n\t\tresults[name] = result;\n\t}\n\n\treturn results;\n};\n","import { styleText } from 'node:util';\nimport { GroupMultiSelectPrompt } from '@clack/core';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_ACTIVE,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tsymbol,\n} from './common.js';\nimport type { Option } from './select.js';\n\nexport interface GroupMultiSelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Record<string, Option<Value>[]>;\n\tinitialValues?: Value[];\n\trequired?: boolean;\n\tcursorAt?: Value;\n\tselectableGroups?: boolean;\n\tgroupSpacing?: number;\n}\nexport const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) => {\n\tconst { selectableGroups = true, groupSpacing = 0 } = opts;\n\tconst opt = (\n\t\toption: Option<Value> & { group: string | boolean },\n\t\tstate:\n\t\t\t| 'inactive'\n\t\t\t| 'active'\n\t\t\t| 'selected'\n\t\t\t| 'active-selected'\n\t\t\t| 'group-active'\n\t\t\t| 'group-active-selected'\n\t\t\t| 'submitted'\n\t\t\t| 'cancelled',\n\t\toptions: (Option<Value> & { group: string | boolean })[] = []\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tconst isItem = typeof option.group === 'string';\n\t\tconst next = isItem && (options[options.indexOf(option) + 1] ?? { group: true });\n\t\tconst isLast = isItem && next && next.group === true;\n\t\tconst prefix = isItem ? (selectableGroups ? `${isLast ? S_BAR_END : S_BAR} ` : ' ') : '';\n\t\tlet spacingPrefix = '';\n\t\tif (groupSpacing > 0 && !isItem) {\n\t\t\tconst spacingPrefixText = `\\n${styleText('cyan', S_BAR)}`;\n\t\t\tspacingPrefix = `${spacingPrefixText.repeat(groupSpacing - 1)}${spacingPrefixText} `;\n\t\t}\n\n\t\tif (state === 'active') {\n\t\t\treturn `${spacingPrefix}${styleText('dim', prefix)}${styleText('cyan', S_CHECKBOX_ACTIVE)} ${label}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'group-active') {\n\t\t\treturn `${spacingPrefix}${prefix}${styleText('cyan', S_CHECKBOX_ACTIVE)} ${styleText('dim', label)}`;\n\t\t}\n\t\tif (state === 'group-active-selected') {\n\t\t\treturn `${spacingPrefix}${prefix}${styleText('green', S_CHECKBOX_SELECTED)} ${styleText('dim', label)}`;\n\t\t}\n\t\tif (state === 'selected') {\n\t\t\tconst selectedCheckbox =\n\t\t\t\tisItem || selectableGroups ? styleText('green', S_CHECKBOX_SELECTED) : '';\n\t\t\treturn `${spacingPrefix}${styleText('dim', prefix)}${selectedCheckbox} ${styleText('dim', label)}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${styleText(['strikethrough', 'dim'], label)}`;\n\t\t}\n\t\tif (state === 'active-selected') {\n\t\t\treturn `${spacingPrefix}${styleText('dim', prefix)}${styleText('green', S_CHECKBOX_SELECTED)} ${label}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'submitted') {\n\t\t\treturn `${styleText('dim', label)}`;\n\t\t}\n\t\tconst unselectedCheckbox =\n\t\t\tisItem || selectableGroups ? styleText('dim', S_CHECKBOX_INACTIVE) : '';\n\t\treturn `${spacingPrefix}${styleText('dim', prefix)}${unselectedCheckbox} ${styleText('dim', label)}`;\n\t};\n\tconst required = opts.required ?? true;\n\n\treturn new GroupMultiSelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValues: opts.initialValues,\n\t\trequired,\n\t\tcursorAt: opts.cursorAt,\n\t\tselectableGroups,\n\t\tvalidate(selected: Value[] | undefined) {\n\t\t\tif (required && (selected === undefined || selected.length === 0))\n\t\t\t\treturn `Please select at least one option.\\n${styleText(\n\t\t\t\t\t'reset',\n\t\t\t\t\tstyleText(\n\t\t\t\t\t\t'dim',\n\t\t\t\t\t\t`Press ${styleText(['gray', 'bgWhite', 'inverse'], ' space ')} to select, ${styleText(\n\t\t\t\t\t\t\t'gray',\n\t\t\t\t\t\t\tstyleText(['bgWhite', 'inverse'], ' enter ')\n\t\t\t\t\t\t)} to submit`\n\t\t\t\t\t)\n\t\t\t\t)}`;\n\t\t},\n\t\trender() {\n\t\t\tconst title = `${styleText('gray', S_BAR)}\\n${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst value = this.value ?? [];\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst selectedOptions = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'submitted'));\n\t\t\t\t\tconst optionsText =\n\t\t\t\t\t\tselectedOptions.length === 0 ? '' : ` ${selectedOptions.join(styleText('dim', ', '))}`;\n\t\t\t\t\treturn `${title}${styleText('gray', S_BAR)}${optionsText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst label = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'cancelled'))\n\t\t\t\t\t\t.join(styleText('dim', ', '));\n\t\t\t\t\treturn `${title}${styleText('gray', S_BAR)} ${\n\t\t\t\t\t\tlabel.trim() ? `${label}\\n${styleText('gray', S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst footer = this.error\n\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t.map((ln, i) =>\n\t\t\t\t\t\t\ti === 0 ? `${styleText('yellow', S_BAR_END)} ${styleText('yellow', ln)}` : ` ${ln}`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\treturn `${title}${styleText('yellow', S_BAR)} ${this.options\n\t\t\t\t\t\t.map((option, i, options) => {\n\t\t\t\t\t\t\tconst selected =\n\t\t\t\t\t\t\t\tvalue.includes(option.value) ||\n\t\t\t\t\t\t\t\t(option.group === true && this.isGroupSelected(`${option.value}`));\n\t\t\t\t\t\t\tconst active = i === this.cursor;\n\t\t\t\t\t\t\tconst groupActive =\n\t\t\t\t\t\t\t\t!active &&\n\t\t\t\t\t\t\t\ttypeof option.group === 'string' &&\n\t\t\t\t\t\t\t\tthis.options[this.cursor].value === option.group;\n\t\t\t\t\t\t\tif (groupActive) {\n\t\t\t\t\t\t\t\treturn opt(option, selected ? 'group-active-selected' : 'group-active', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (active && selected) {\n\t\t\t\t\t\t\t\treturn opt(option, 'active-selected', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (selected) {\n\t\t\t\t\t\t\t\treturn opt(option, 'selected', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn opt(option, active ? 'active' : 'inactive', options);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(`\\n${styleText('yellow', S_BAR)} `)}\\n${footer}\\n`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst optionsText = this.options\n\t\t\t\t\t\t.map((option, i, options) => {\n\t\t\t\t\t\t\tconst selected =\n\t\t\t\t\t\t\t\tvalue.includes(option.value) ||\n\t\t\t\t\t\t\t\t(option.group === true && this.isGroupSelected(`${option.value}`));\n\t\t\t\t\t\t\tconst active = i === this.cursor;\n\t\t\t\t\t\t\tconst groupActive =\n\t\t\t\t\t\t\t\t!active &&\n\t\t\t\t\t\t\t\ttypeof option.group === 'string' &&\n\t\t\t\t\t\t\t\tthis.options[this.cursor].value === option.group;\n\t\t\t\t\t\t\tlet optionText = '';\n\t\t\t\t\t\t\tif (groupActive) {\n\t\t\t\t\t\t\t\toptionText = opt(\n\t\t\t\t\t\t\t\t\toption,\n\t\t\t\t\t\t\t\t\tselected ? 'group-active-selected' : 'group-active',\n\t\t\t\t\t\t\t\t\toptions\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else if (active && selected) {\n\t\t\t\t\t\t\t\toptionText = opt(option, 'active-selected', options);\n\t\t\t\t\t\t\t} else if (selected) {\n\t\t\t\t\t\t\t\toptionText = opt(option, 'selected', options);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\toptionText = opt(option, active ? 'active' : 'inactive', options);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst prefix = i !== 0 && !optionText.startsWith('\\n') ? ' ' : '';\n\t\t\t\t\t\t\treturn `${prefix}${optionText}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(`\\n${styleText('cyan', S_BAR)}`);\n\t\t\t\t\tconst optionsPrefix = optionsText.startsWith('\\n') ? '' : ' ';\n\t\t\t\t\treturn `${title}${styleText('cyan', S_BAR)}${optionsPrefix}${optionsText}\\n${styleText('cyan', S_BAR_END)}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value[] | symbol>;\n};\n","import { styleText } from 'node:util';\nimport { settings } from '@clack/core';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_ERROR,\n\tS_INFO,\n\tS_STEP_SUBMIT,\n\tS_SUCCESS,\n\tS_WARN,\n} from './common.js';\n\nexport interface LogMessageOptions extends CommonOptions {\n\tsymbol?: string;\n\tspacing?: number;\n\tsecondarySymbol?: string;\n}\n\nexport const log = {\n\tmessage: (\n\t\tmessage: string | string[] = [],\n\t\t{\n\t\t\tsymbol = styleText('gray', S_BAR),\n\t\t\tsecondarySymbol = styleText('gray', S_BAR),\n\t\t\toutput = process.stdout,\n\t\t\tspacing = 1,\n\t\t\twithGuide,\n\t\t}: LogMessageOptions = {}\n\t) => {\n\t\tconst parts: string[] = [];\n\t\tconst hasGuide = withGuide ?? settings.withGuide;\n\t\tconst spacingString = !hasGuide ? '' : secondarySymbol;\n\t\tconst prefix = !hasGuide ? '' : `${symbol} `;\n\t\tconst secondaryPrefix = !hasGuide ? '' : `${secondarySymbol} `;\n\n\t\tfor (let i = 0; i < spacing; i++) {\n\t\t\tparts.push(spacingString);\n\t\t}\n\n\t\tconst messageParts = Array.isArray(message) ? message : message.split('\\n');\n\t\tif (messageParts.length > 0) {\n\t\t\tconst [firstLine, ...lines] = messageParts;\n\t\t\tif (firstLine.length > 0) {\n\t\t\t\tparts.push(`${prefix}${firstLine}`);\n\t\t\t} else {\n\t\t\t\tparts.push(hasGuide ? symbol : '');\n\t\t\t}\n\t\t\tfor (const ln of lines) {\n\t\t\t\tif (ln.length > 0) {\n\t\t\t\t\tparts.push(`${secondaryPrefix}${ln}`);\n\t\t\t\t} else {\n\t\t\t\t\tparts.push(hasGuide ? secondarySymbol : '');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.write(`${parts.join('\\n')}\\n`);\n\t},\n\tinfo: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: styleText('blue', S_INFO) });\n\t},\n\tsuccess: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: styleText('green', S_SUCCESS) });\n\t},\n\tstep: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: styleText('green', S_STEP_SUBMIT) });\n\t},\n\twarn: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: styleText('yellow', S_WARN) });\n\t},\n\t/** alias for `log.warn()`. */\n\twarning: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.warn(message, opts);\n\t},\n\terror: (message: string, opts?: LogMessageOptions) => {\n\t\tlog.message(message, { ...opts, symbol: styleText('red', S_ERROR) });\n\t},\n};\n","import type { Writable } from 'node:stream';\nimport { styleText } from 'node:util';\nimport { settings } from '@clack/core';\nimport { type CommonOptions, S_BAR, S_BAR_END, S_BAR_START } from './common.js';\n\nexport const cancel = (message = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst prefix = hasGuide ? `${styleText('gray', S_BAR_END)} ` : '';\n\toutput.write(`${prefix}${styleText('red', message)}\\n\\n`);\n};\n\nexport const intro = (title = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst prefix = hasGuide ? `${styleText('gray', S_BAR_START)} ` : '';\n\toutput.write(`${prefix}${title}\\n`);\n};\n\nexport const outro = (message = '', opts?: CommonOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst prefix = hasGuide ? `${styleText('gray', S_BAR)}\\n${styleText('gray', S_BAR_END)} ` : '';\n\toutput.write(`${prefix}${message}\\n\\n`);\n};\n","import { styleText } from 'node:util';\nimport { MultiSelectPrompt, wrapTextWithPrefix } from '@clack/core';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_CHECKBOX_ACTIVE,\n\tS_CHECKBOX_INACTIVE,\n\tS_CHECKBOX_SELECTED,\n\tsymbol,\n\tsymbolBar,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\nimport type { Option } from './select.js';\n\nexport interface MultiSelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValues?: Value[];\n\tmaxItems?: number;\n\trequired?: boolean;\n\tcursorAt?: Value;\n}\nconst computeLabel = (label: string, format: (text: string) => string) => {\n\treturn label\n\t\t.split('\\n')\n\t\t.map((line) => format(line))\n\t\t.join('\\n');\n};\n\nexport const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate:\n\t\t\t| 'inactive'\n\t\t\t| 'active'\n\t\t\t| 'selected'\n\t\t\t| 'active-selected'\n\t\t\t| 'submitted'\n\t\t\t| 'cancelled'\n\t\t\t| 'disabled'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tif (state === 'disabled') {\n\t\t\treturn `${styleText('gray', S_CHECKBOX_INACTIVE)} ${computeLabel(label, (str) => styleText(['strikethrough', 'gray'], str))}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint ?? 'disabled'})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'active') {\n\t\t\treturn `${styleText('cyan', S_CHECKBOX_ACTIVE)} ${label}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'selected') {\n\t\t\treturn `${styleText('green', S_CHECKBOX_SELECTED)} ${computeLabel(label, (text) => styleText('dim', text))}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${computeLabel(label, (text) => styleText(['strikethrough', 'dim'], text))}`;\n\t\t}\n\t\tif (state === 'active-selected') {\n\t\t\treturn `${styleText('green', S_CHECKBOX_SELECTED)} ${label}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\tif (state === 'submitted') {\n\t\t\treturn `${computeLabel(label, (text) => styleText('dim', text))}`;\n\t\t}\n\t\treturn `${styleText('dim', S_CHECKBOX_INACTIVE)} ${computeLabel(label, (text) => styleText('dim', text))}`;\n\t};\n\tconst required = opts.required ?? true;\n\n\treturn new MultiSelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValues: opts.initialValues,\n\t\trequired,\n\t\tcursorAt: opts.cursorAt,\n\t\tvalidate(selected: Value[] | undefined) {\n\t\t\tif (required && (selected === undefined || selected.length === 0))\n\t\t\t\treturn `Please select at least one option.\\n${styleText(\n\t\t\t\t\t'reset',\n\t\t\t\t\tstyleText(\n\t\t\t\t\t\t'dim',\n\t\t\t\t\t\t`Press ${styleText(['gray', 'bgWhite', 'inverse'], ' space ')} to select, ${styleText(\n\t\t\t\t\t\t\t'gray',\n\t\t\t\t\t\t\tstyleText('bgWhite', styleText('inverse', ' enter '))\n\t\t\t\t\t\t)} to submit`\n\t\t\t\t\t)\n\t\t\t\t)}`;\n\t\t},\n\t\trender() {\n\t\t\tconst wrappedMessage = wrapTextWithPrefix(\n\t\t\t\topts.output,\n\t\t\t\topts.message,\n\t\t\t\t`${symbolBar(this.state)} `,\n\t\t\t\t`${symbol(this.state)} `\n\t\t\t);\n\t\t\tconst title = `${styleText('gray', S_BAR)}\\n${wrappedMessage}\\n`;\n\t\t\tconst value = this.value ?? [];\n\n\t\t\tconst styleOption = (option: Option<Value>, active: boolean) => {\n\t\t\t\tif (option.disabled) {\n\t\t\t\t\treturn opt(option, 'disabled');\n\t\t\t\t}\n\t\t\t\tconst selected = value.includes(option.value);\n\t\t\t\tif (active && selected) {\n\t\t\t\t\treturn opt(option, 'active-selected');\n\t\t\t\t}\n\t\t\t\tif (selected) {\n\t\t\t\t\treturn opt(option, 'selected');\n\t\t\t\t}\n\t\t\t\treturn opt(option, active ? 'active' : 'inactive');\n\t\t\t};\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitText =\n\t\t\t\t\t\tthis.options\n\t\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t\t.map((option) => opt(option, 'submitted'))\n\t\t\t\t\t\t\t.join(styleText('dim', ', ')) || styleText('dim', 'none');\n\t\t\t\t\tconst wrappedSubmitText = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\tsubmitText,\n\t\t\t\t\t\t`${styleText('gray', S_BAR)} `\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedSubmitText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst label = this.options\n\t\t\t\t\t\t.filter(({ value: optionValue }) => value.includes(optionValue))\n\t\t\t\t\t\t.map((option) => opt(option, 'cancelled'))\n\t\t\t\t\t\t.join(styleText('dim', ', '));\n\t\t\t\t\tif (label.trim() === '') {\n\t\t\t\t\t\treturn `${title}${styleText('gray', S_BAR)}`;\n\t\t\t\t\t}\n\t\t\t\t\tconst wrappedLabel = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t`${styleText('gray', S_BAR)} `\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLabel}\\n${styleText('gray', S_BAR)}`;\n\t\t\t\t}\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst prefix = `${styleText('yellow', S_BAR)} `;\n\t\t\t\t\tconst footer = this.error\n\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t.map((ln, i) =>\n\t\t\t\t\t\t\ti === 0 ? `${styleText('yellow', S_BAR_END)} ${styleText('yellow', ln)}` : ` ${ln}`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (error message + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = footer.split('\\n').length + 1; // footer + trailing newline\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: styleOption,\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${footer}\\n`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst prefix = `${styleText('cyan', S_BAR)} `;\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (S_BAR_END + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = 2; // S_BAR_END + trailing newline\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: styleOption,\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${styleText('cyan', S_BAR_END)}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value[] | symbol>;\n};\n","import process from 'node:process';\nimport type { Writable } from 'node:stream';\nimport { styleText } from 'node:util';\nimport { getColumns, settings } from '@clack/core';\nimport stringWidth from 'fast-string-width';\nimport { type Options as WrapAnsiOptions, wrapAnsi } from 'fast-wrap-ansi';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_H,\n\tS_CONNECT_LEFT,\n\tS_CORNER_BOTTOM_LEFT,\n\tS_CORNER_BOTTOM_RIGHT,\n\tS_CORNER_TOP_RIGHT,\n\tS_STEP_SUBMIT,\n} from './common.js';\n\ntype FormatFn = (line: string) => string;\nexport interface NoteOptions extends CommonOptions {\n\tformat?: FormatFn;\n}\n\nconst defaultNoteFormatter = (line: string): string => styleText('dim', line);\n\nconst wrapWithFormat = (message: string, width: number, format: FormatFn): string => {\n\tconst opts: WrapAnsiOptions = {\n\t\thard: true,\n\t\ttrim: false,\n\t};\n\tconst wrapMsg = wrapAnsi(message, width, opts).split('\\n');\n\tconst maxWidthNormal = wrapMsg.reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0);\n\tconst maxWidthFormat = wrapMsg.map(format).reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0);\n\tconst wrapWidth = width - (maxWidthFormat - maxWidthNormal);\n\treturn wrapAnsi(message, wrapWidth, opts);\n};\n\nexport const note = (message = '', title = '', opts?: NoteOptions) => {\n\tconst output: Writable = opts?.output ?? process.stdout;\n\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\tconst format = opts?.format ?? defaultNoteFormatter;\n\tconst wrapMsg = wrapWithFormat(message, getColumns(output) - 6, format);\n\tconst lines = ['', ...wrapMsg.split('\\n').map(format), ''];\n\tconst titleLen = stringWidth(title);\n\tconst len =\n\t\tMath.max(\n\t\t\tlines.reduce((sum, ln) => {\n\t\t\t\tconst width = stringWidth(ln);\n\t\t\t\treturn width > sum ? width : sum;\n\t\t\t}, 0),\n\t\t\ttitleLen\n\t\t) + 2;\n\tconst msg = lines\n\t\t.map(\n\t\t\t(ln) =>\n\t\t\t\t`${styleText('gray', S_BAR)} ${ln}${' '.repeat(len - stringWidth(ln))}${styleText('gray', S_BAR)}`\n\t\t)\n\t\t.join('\\n');\n\tconst leadingBorder = hasGuide ? `${styleText('gray', S_BAR)}\\n` : '';\n\tconst bottomLeft = hasGuide ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;\n\toutput.write(\n\t\t`${leadingBorder}${styleText('green', S_STEP_SUBMIT)} ${styleText('reset', title)} ${styleText(\n\t\t\t'gray',\n\t\t\tS_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT\n\t\t)}\\n${msg}\\n${styleText('gray', bottomLeft + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}\\n`\n\t);\n};\n","import { styleText } from 'node:util';\nimport { PasswordPrompt, settings } from '@clack/core';\nimport { type CommonOptions, S_BAR, S_BAR_END, S_PASSWORD_MASK, symbol } from './common.js';\n\nexport interface PasswordOptions extends CommonOptions {\n\tmessage: string;\n\tmask?: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n\tclearOnError?: boolean;\n}\nexport const password = (opts: PasswordOptions) => {\n\treturn new PasswordPrompt({\n\t\tvalidate: opts.validate,\n\t\tmask: opts.mask ?? S_PASSWORD_MASK,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${styleText('gray', S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\t\t\tconst userInput = this.userInputWithCursor;\n\t\t\tconst masked = this.masked;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst errorPrefix = hasGuide ? `${styleText('yellow', S_BAR)} ` : '';\n\t\t\t\t\tconst errorPrefixEnd = hasGuide ? `${styleText('yellow', S_BAR_END)} ` : '';\n\t\t\t\t\tconst maskedText = masked ?? '';\n\t\t\t\t\tif (opts.clearOnError) {\n\t\t\t\t\t\tthis.clear();\n\t\t\t\t\t}\n\t\t\t\t\treturn `${title.trim()}\\n${errorPrefix}${maskedText}\\n${errorPrefixEnd}${styleText('yellow', this.error)}\\n`;\n\t\t\t\t}\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\tconst maskedText = masked ? styleText('dim', masked) : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${maskedText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\tconst maskedText = masked ? styleText(['strikethrough', 'dim'], masked) : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${maskedText}${\n\t\t\t\t\t\tmasked && hasGuide ? `\\n${styleText('gray', S_BAR)}` : ''\n\t\t\t\t\t}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? styleText('cyan', S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${userInput}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<string | symbol>;\n};\n","import { existsSync, lstatSync, readdirSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { autocomplete } from './autocomplete.js';\nimport type { CommonOptions } from './common.js';\n\nexport interface PathOptions extends CommonOptions {\n\troot?: string;\n\tdirectory?: boolean;\n\tinitialValue?: string;\n\tmessage: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n}\n\nexport const path = (opts: PathOptions) => {\n\tconst validate = opts.validate;\n\n\treturn autocomplete({\n\t\t...opts,\n\t\tinitialUserInput: opts.initialValue ?? opts.root ?? process.cwd(),\n\t\tmaxItems: 5,\n\t\tvalidate(value) {\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\t// Shouldn't ever happen since we don't enable `multiple: true`\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (!value) {\n\t\t\t\treturn 'Please select a path';\n\t\t\t}\n\t\t\tif (validate) {\n\t\t\t\treturn validate(value);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\toptions() {\n\t\t\tconst userInput = this.userInput;\n\t\t\tif (userInput === '') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tlet searchPath: string;\n\n\t\t\t\tif (!existsSync(userInput)) {\n\t\t\t\t\tsearchPath = dirname(userInput);\n\t\t\t\t} else {\n\t\t\t\t\tconst stat = lstatSync(userInput);\n\t\t\t\t\tif (stat.isDirectory()) {\n\t\t\t\t\t\tsearchPath = userInput;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsearchPath = dirname(userInput);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst items = readdirSync(searchPath)\n\t\t\t\t\t.map((item) => {\n\t\t\t\t\t\tconst path = join(searchPath, item);\n\t\t\t\t\t\tconst stats = lstatSync(path);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tname: item,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tisDirectory: stats.isDirectory(),\n\t\t\t\t\t\t};\n\t\t\t\t\t})\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t({ path, isDirectory }) =>\n\t\t\t\t\t\t\tpath.startsWith(userInput) && (opts.directory || !isDirectory)\n\t\t\t\t\t);\n\t\t\t\treturn items.map((item) => ({\n\t\t\t\t\tvalue: item.path,\n\t\t\t\t}));\n\t\t\t} catch (_e) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t});\n};\n","import { styleText } from 'node:util';\nimport { block, getColumns, settings } from '@clack/core';\nimport { wrapAnsi } from 'fast-wrap-ansi';\nimport { cursor, erase } from 'sisteransi';\nimport {\n\ttype CommonOptions,\n\tisCI as isCIFn,\n\tS_BAR,\n\tS_STEP_CANCEL,\n\tS_STEP_ERROR,\n\tS_STEP_SUBMIT,\n\tunicode,\n} from './common.js';\n\nexport interface SpinnerOptions extends CommonOptions {\n\tindicator?: 'dots' | 'timer';\n\tonCancel?: () => void;\n\tcancelMessage?: string;\n\terrorMessage?: string;\n\tframes?: string[];\n\tdelay?: number;\n\tstyleFrame?: (frame: string) => string;\n}\n\nexport interface SpinnerResult {\n\tstart(msg?: string): void;\n\tstop(msg?: string): void;\n\tcancel(msg?: string): void;\n\terror(msg?: string): void;\n\tmessage(msg?: string): void;\n\tclear(): void;\n\treadonly isCancelled: boolean;\n}\n\nconst defaultStyleFn: SpinnerOptions['styleFrame'] = (frame) => styleText('magenta', frame);\n\nexport const spinner = ({\n\tindicator = 'dots',\n\tonCancel,\n\toutput = process.stdout,\n\tcancelMessage,\n\terrorMessage,\n\tframes = unicode ? ['◒', '◐', '◓', '◑'] : ['•', 'o', 'O', '0'],\n\tdelay = unicode ? 80 : 120,\n\tsignal,\n\t...opts\n}: SpinnerOptions = {}): SpinnerResult => {\n\tconst isCI = isCIFn();\n\n\tlet unblock: () => void;\n\tlet loop: NodeJS.Timeout;\n\tlet isSpinnerActive = false;\n\tlet isCancelled = false;\n\tlet _message = '';\n\tlet _prevMessage: string | undefined;\n\tlet _origin: number = performance.now();\n\tconst columns = getColumns(output);\n\tconst styleFn = opts?.styleFrame ?? defaultStyleFn;\n\n\tconst handleExit = (code: number) => {\n\t\tconst msg =\n\t\t\tcode > 1\n\t\t\t\t? (errorMessage ?? settings.messages.error)\n\t\t\t\t: (cancelMessage ?? settings.messages.cancel);\n\t\tisCancelled = code === 1;\n\t\tif (isSpinnerActive) {\n\t\t\t_stop(msg, code);\n\t\t\tif (isCancelled && typeof onCancel === 'function') {\n\t\t\t\tonCancel();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst errorEventHandler = () => handleExit(2);\n\tconst signalEventHandler = () => handleExit(1);\n\n\tconst registerHooks = () => {\n\t\t// Reference: https://nodejs.org/api/process.html#event-uncaughtexception\n\t\tprocess.on('uncaughtExceptionMonitor', errorEventHandler);\n\t\t// Reference: https://nodejs.org/api/process.html#event-unhandledrejection\n\t\tprocess.on('unhandledRejection', errorEventHandler);\n\t\t// Reference Signal Events: https://nodejs.org/api/process.html#signal-events\n\t\tprocess.on('SIGINT', signalEventHandler);\n\t\tprocess.on('SIGTERM', signalEventHandler);\n\t\tprocess.on('exit', handleExit);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', signalEventHandler);\n\t\t}\n\t};\n\n\tconst clearHooks = () => {\n\t\tprocess.removeListener('uncaughtExceptionMonitor', errorEventHandler);\n\t\tprocess.removeListener('unhandledRejection', errorEventHandler);\n\t\tprocess.removeListener('SIGINT', signalEventHandler);\n\t\tprocess.removeListener('SIGTERM', signalEventHandler);\n\t\tprocess.removeListener('exit', handleExit);\n\n\t\tif (signal) {\n\t\t\tsignal.removeEventListener('abort', signalEventHandler);\n\t\t}\n\t};\n\n\tconst clearPrevMessage = () => {\n\t\tif (_prevMessage === undefined) return;\n\t\tif (isCI) output.write('\\n');\n\t\tconst wrapped = wrapAnsi(_prevMessage, columns, {\n\t\t\thard: true,\n\t\t\ttrim: false,\n\t\t});\n\t\tconst prevLines = wrapped.split('\\n');\n\t\tif (prevLines.length > 1) {\n\t\t\toutput.write(cursor.up(prevLines.length - 1));\n\t\t}\n\t\toutput.write(cursor.to(0));\n\t\toutput.write(erase.down());\n\t};\n\n\tconst removeTrailingDots = (msg: string): string => {\n\t\treturn msg.replace(/\\.+$/, '');\n\t};\n\n\tconst formatTimer = (origin: number): string => {\n\t\tconst duration = (performance.now() - origin) / 1000;\n\t\tconst min = Math.floor(duration / 60);\n\t\tconst secs = Math.floor(duration % 60);\n\t\treturn min > 0 ? `[${min}m ${secs}s]` : `[${secs}s]`;\n\t};\n\n\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\n\tconst start = (msg = ''): void => {\n\t\tisSpinnerActive = true;\n\t\tunblock = block({ output });\n\t\t_message = removeTrailingDots(msg);\n\t\t_origin = performance.now();\n\t\tif (hasGuide) {\n\t\t\toutput.write(`${styleText('gray', S_BAR)}\\n`);\n\t\t}\n\t\tlet frameIndex = 0;\n\t\tlet indicatorTimer = 0;\n\t\tregisterHooks();\n\t\tloop = setInterval(() => {\n\t\t\tif (isCI && _message === _prevMessage) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tclearPrevMessage();\n\t\t\t_prevMessage = _message;\n\t\t\tconst frame = styleFn(frames[frameIndex]);\n\t\t\tlet outputMessage: string;\n\n\t\t\tif (isCI) {\n\t\t\t\toutputMessage = `${frame} ${_message}...`;\n\t\t\t} else if (indicator === 'timer') {\n\t\t\t\toutputMessage = `${frame} ${_message} ${formatTimer(_origin)}`;\n\t\t\t} else {\n\t\t\t\tconst loadingDots = '.'.repeat(Math.floor(indicatorTimer)).slice(0, 3);\n\t\t\t\toutputMessage = `${frame} ${_message}${loadingDots}`;\n\t\t\t}\n\n\t\t\tconst wrapped = wrapAnsi(outputMessage, columns, {\n\t\t\t\thard: true,\n\t\t\t\ttrim: false,\n\t\t\t});\n\t\t\toutput.write(wrapped);\n\n\t\t\tframeIndex = frameIndex + 1 < frames.length ? frameIndex + 1 : 0;\n\t\t\t// indicator increase by 1 every 8 frames\n\t\t\tindicatorTimer = indicatorTimer < 4 ? indicatorTimer + 0.125 : 0;\n\t\t}, delay);\n\t};\n\n\tconst _stop = (msg = '', code = 0, silent: boolean = false): void => {\n\t\tif (!isSpinnerActive) return;\n\t\tisSpinnerActive = false;\n\t\tclearInterval(loop);\n\t\tclearPrevMessage();\n\t\tconst step =\n\t\t\tcode === 0\n\t\t\t\t? styleText('green', S_STEP_SUBMIT)\n\t\t\t\t: code === 1\n\t\t\t\t\t? styleText('red', S_STEP_CANCEL)\n\t\t\t\t\t: styleText('red', S_STEP_ERROR);\n\t\t_message = msg ?? _message;\n\t\tif (!silent) {\n\t\t\tif (indicator === 'timer') {\n\t\t\t\toutput.write(`${step} ${_message} ${formatTimer(_origin)}\\n`);\n\t\t\t} else {\n\t\t\t\toutput.write(`${step} ${_message}\\n`);\n\t\t\t}\n\t\t}\n\t\tclearHooks();\n\t\tunblock();\n\t};\n\n\tconst stop = (msg = ''): void => _stop(msg, 0);\n\tconst cancel = (msg = ''): void => _stop(msg, 1);\n\tconst error = (msg = ''): void => _stop(msg, 2);\n\t// TODO (43081j): this will leave the initial S_BAR since we purposely\n\t// don't erase that in `clearPrevMessage`. In future, we may want to treat\n\t// `clear` as a special case and remove the bar too.\n\tconst clear = (): void => _stop('', 0, true);\n\n\tconst message = (msg = ''): void => {\n\t\t_message = removeTrailingDots(msg ?? _message);\n\t};\n\n\treturn {\n\t\tstart,\n\t\tstop,\n\t\tmessage,\n\t\tcancel,\n\t\terror,\n\t\tclear,\n\t\tget isCancelled() {\n\t\t\treturn isCancelled;\n\t\t},\n\t};\n};\n","import { styleText } from 'node:util';\nimport type { State } from '@clack/core';\nimport { unicodeOr } from './common.js';\nimport { type SpinnerOptions, type SpinnerResult, spinner } from './spinner.js';\n\nconst S_PROGRESS_CHAR: Record<NonNullable<ProgressOptions['style']>, string> = {\n\tlight: unicodeOr('─', '-'),\n\theavy: unicodeOr('━', '='),\n\tblock: unicodeOr('█', '#'),\n};\n\nexport interface ProgressOptions extends SpinnerOptions {\n\tstyle?: 'light' | 'heavy' | 'block';\n\tmax?: number;\n\tsize?: number;\n}\n\nexport interface ProgressResult extends SpinnerResult {\n\tadvance(step?: number, msg?: string): void;\n}\n\nexport function progress({\n\tstyle = 'heavy',\n\tmax: userMax = 100,\n\tsize: userSize = 40,\n\t...spinnerOptions\n}: ProgressOptions = {}): ProgressResult {\n\tconst spin = spinner(spinnerOptions);\n\tlet value = 0;\n\tlet previousMessage = '';\n\n\tconst max = Math.max(1, userMax);\n\tconst size = Math.max(1, userSize);\n\n\tconst activeStyle = (state: State) => {\n\t\tswitch (state) {\n\t\t\tcase 'initial':\n\t\t\tcase 'active':\n\t\t\t\treturn (text: string) => styleText('magenta', text);\n\t\t\tcase 'error':\n\t\t\tcase 'cancel':\n\t\t\t\treturn (text: string) => styleText('red', text);\n\t\t\tcase 'submit':\n\t\t\t\treturn (text: string) => styleText('green', text);\n\t\t\tdefault:\n\t\t\t\treturn (text: string) => styleText('magenta', text);\n\t\t}\n\t};\n\tconst drawProgress = (state: State, msg: string) => {\n\t\tconst active = Math.floor((value / max) * size);\n\t\treturn `${activeStyle(state)(S_PROGRESS_CHAR[style].repeat(active))}${styleText('dim', S_PROGRESS_CHAR[style].repeat(size - active))} ${msg}`;\n\t};\n\n\tconst start = (msg = '') => {\n\t\tpreviousMessage = msg;\n\t\tspin.start(drawProgress('initial', msg));\n\t};\n\tconst advance = (step = 1, msg?: string): void => {\n\t\tvalue = Math.min(max, step + value);\n\t\tspin.message(drawProgress('active', msg ?? previousMessage));\n\t\tpreviousMessage = msg ?? previousMessage;\n\t};\n\treturn {\n\t\tstart,\n\t\tstop: spin.stop,\n\t\tcancel: spin.cancel,\n\t\terror: spin.error,\n\t\tclear: spin.clear,\n\t\tadvance,\n\t\tisCancelled: spin.isCancelled,\n\t\tmessage: (msg: string) => advance(0, msg),\n\t};\n}\n","import { styleText } from 'node:util';\nimport { SelectPrompt, settings, wrapTextWithPrefix } from '@clack/core';\nimport {\n\ttype CommonOptions,\n\tS_BAR,\n\tS_BAR_END,\n\tS_RADIO_ACTIVE,\n\tS_RADIO_INACTIVE,\n\tsymbol,\n\tsymbolBar,\n} from './common.js';\nimport { limitOptions } from './limit-options.js';\n\ntype Primitive = Readonly<string | boolean | number>;\n\nexport type Option<Value> = Value extends Primitive\n\t? {\n\t\t\t/**\n\t\t\t * Internal data for this option.\n\t\t\t */\n\t\t\tvalue: Value;\n\t\t\t/**\n\t\t\t * The optional, user-facing text for this option.\n\t\t\t *\n\t\t\t * By default, the `value` is converted to a string.\n\t\t\t */\n\t\t\tlabel?: string;\n\t\t\t/**\n\t\t\t * An optional hint to display to the user when\n\t\t\t * this option might be selected.\n\t\t\t *\n\t\t\t * By default, no `hint` is displayed.\n\t\t\t */\n\t\t\thint?: string;\n\t\t\t/**\n\t\t\t * Whether this option is disabled.\n\t\t\t * Disabled options are visible but cannot be selected.\n\t\t\t *\n\t\t\t * By default, options are not disabled.\n\t\t\t */\n\t\t\tdisabled?: boolean;\n\t\t}\n\t: {\n\t\t\t/**\n\t\t\t * Internal data for this option.\n\t\t\t */\n\t\t\tvalue: Value;\n\t\t\t/**\n\t\t\t * Required. The user-facing text for this option.\n\t\t\t */\n\t\t\tlabel: string;\n\t\t\t/**\n\t\t\t * An optional hint to display to the user when\n\t\t\t * this option might be selected.\n\t\t\t *\n\t\t\t * By default, no `hint` is displayed.\n\t\t\t */\n\t\t\thint?: string;\n\t\t\t/**\n\t\t\t * Whether this option is disabled.\n\t\t\t * Disabled options are visible but cannot be selected.\n\t\t\t *\n\t\t\t * By default, options are not disabled.\n\t\t\t */\n\t\t\tdisabled?: boolean;\n\t\t};\n\nexport interface SelectOptions<Value> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValue?: Value;\n\tmaxItems?: number;\n}\n\nconst computeLabel = (label: string, format: (text: string) => string) => {\n\tif (!label.includes('\\n')) {\n\t\treturn format(label);\n\t}\n\treturn label\n\t\t.split('\\n')\n\t\t.map((line) => format(line))\n\t\t.join('\\n');\n};\n\nexport const select = <Value>(opts: SelectOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate: 'inactive' | 'active' | 'selected' | 'cancelled' | 'disabled'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tswitch (state) {\n\t\t\tcase 'disabled':\n\t\t\t\treturn `${styleText('gray', S_RADIO_INACTIVE)} ${computeLabel(label, (text) => styleText('gray', text))}${\n\t\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint ?? 'disabled'})`)}` : ''\n\t\t\t\t}`;\n\t\t\tcase 'selected':\n\t\t\t\treturn `${computeLabel(label, (text) => styleText('dim', text))}`;\n\t\t\tcase 'active':\n\t\t\t\treturn `${styleText('green', S_RADIO_ACTIVE)} ${label}${\n\t\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t\t}`;\n\t\t\tcase 'cancelled':\n\t\t\t\treturn `${computeLabel(label, (str) => styleText(['strikethrough', 'dim'], str))}`;\n\t\t\tdefault:\n\t\t\t\treturn `${styleText('dim', S_RADIO_INACTIVE)} ${computeLabel(label, (text) => styleText('dim', text))}`;\n\t\t}\n\t};\n\n\treturn new SelectPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst titlePrefix = `${symbol(this.state)} `;\n\t\t\tconst titlePrefixBar = `${symbolBar(this.state)} `;\n\t\t\tconst messageLines = wrapTextWithPrefix(\n\t\t\t\topts.output,\n\t\t\t\topts.message,\n\t\t\t\ttitlePrefixBar,\n\t\t\t\ttitlePrefix\n\t\t\t);\n\t\t\tconst title = `${hasGuide ? `${styleText('gray', S_BAR)}\\n` : ''}${messageLines}\\n`;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\tconst wrappedLines = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[this.cursor], 'selected'),\n\t\t\t\t\t\tsubmitPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLines}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\tconst wrappedLines = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[this.cursor], 'cancelled'),\n\t\t\t\t\t\tcancelPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrappedLines}${hasGuide ? `\\n${styleText('gray', S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst prefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : '';\n\t\t\t\t\tconst prefixEnd = hasGuide ? styleText('cyan', S_BAR_END) : '';\n\t\t\t\t\t// Calculate rowPadding: title lines + footer lines (S_BAR_END + trailing newline)\n\t\t\t\t\tconst titleLineCount = title.split('\\n').length;\n\t\t\t\t\tconst footerLineCount = hasGuide ? 2 : 1; // S_BAR_END + trailing newline (or just trailing newline)\n\t\t\t\t\treturn `${title}${prefix}${limitOptions({\n\t\t\t\t\t\toutput: opts.output,\n\t\t\t\t\t\tcursor: this.cursor,\n\t\t\t\t\t\toptions: this.options,\n\t\t\t\t\t\tmaxItems: opts.maxItems,\n\t\t\t\t\t\tcolumnPadding: prefix.length,\n\t\t\t\t\t\trowPadding: titleLineCount + footerLineCount,\n\t\t\t\t\t\tstyle: (item, active) =>\n\t\t\t\t\t\t\topt(item, item.disabled ? 'disabled' : active ? 'active' : 'inactive'),\n\t\t\t\t\t}).join(`\\n${prefix}`)}\\n${prefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value | symbol>;\n};\n","import { styleText } from 'node:util';\nimport { SelectKeyPrompt, settings, wrapTextWithPrefix } from '@clack/core';\nimport { type CommonOptions, S_BAR, S_BAR_END, symbol } from './common.js';\nimport type { Option } from './select.js';\n\nexport interface SelectKeyOptions<Value extends string> extends CommonOptions {\n\tmessage: string;\n\toptions: Option<Value>[];\n\tinitialValue?: Value;\n\tcaseSensitive?: boolean;\n}\n\nexport const selectKey = <Value extends string>(opts: SelectKeyOptions<Value>) => {\n\tconst opt = (\n\t\toption: Option<Value>,\n\t\tstate: 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive'\n\t) => {\n\t\tconst label = option.label ?? String(option.value);\n\t\tif (state === 'selected') {\n\t\t\treturn `${styleText('dim', label)}`;\n\t\t}\n\t\tif (state === 'cancelled') {\n\t\t\treturn `${styleText(['strikethrough', 'dim'], label)}`;\n\t\t}\n\t\tif (state === 'active') {\n\t\t\treturn `${styleText(['bgCyan', 'gray'], ` ${option.value} `)} ${label}${\n\t\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t\t}`;\n\t\t}\n\t\treturn `${styleText(['gray', 'bgWhite', 'inverse'], ` ${option.value} `)} ${label}${\n\t\t\toption.hint ? ` ${styleText('dim', `(${option.hint})`)}` : ''\n\t\t}`;\n\t};\n\n\treturn new SelectKeyPrompt({\n\t\toptions: opts.options,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\toutput: opts.output,\n\t\tinitialValue: opts.initialValue,\n\t\tcaseSensitive: opts.caseSensitive,\n\t\trender() {\n\t\t\tconst hasGuide = opts.withGuide ?? settings.withGuide;\n\t\t\tconst title = `${hasGuide ? `${styleText('gray', S_BAR)}\\n` : ''}${symbol(this.state)} ${opts.message}\\n`;\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst submitPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\tconst selectedOption =\n\t\t\t\t\t\tthis.options.find((opt) => opt.value === this.value) ?? opts.options[0];\n\t\t\t\t\tconst wrapped = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(selectedOption, 'selected'),\n\t\t\t\t\t\tsubmitPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrapped}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst cancelPrefix = hasGuide ? `${styleText('gray', S_BAR)} ` : '';\n\t\t\t\t\tconst wrapped = wrapTextWithPrefix(\n\t\t\t\t\t\topts.output,\n\t\t\t\t\t\topt(this.options[0], 'cancelled'),\n\t\t\t\t\t\tcancelPrefix\n\t\t\t\t\t);\n\t\t\t\t\treturn `${title}${wrapped}${hasGuide ? `\\n${styleText('gray', S_BAR)}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? styleText('cyan', S_BAR_END) : '';\n\t\t\t\t\tconst wrapped = this.options\n\t\t\t\t\t\t.map((option, i) =>\n\t\t\t\t\t\t\twrapTextWithPrefix(\n\t\t\t\t\t\t\t\topts.output,\n\t\t\t\t\t\t\t\topt(option, i === this.cursor ? 'active' : 'inactive'),\n\t\t\t\t\t\t\t\tdefaultPrefix\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\treturn `${title}${wrapped}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<Value | symbol>;\n};\n","import { stripVTControlCharacters as strip, styleText } from 'node:util';\nimport { S_BAR, S_ERROR, S_INFO, S_STEP_SUBMIT, S_SUCCESS, S_WARN } from './common.js';\nimport type { LogMessageOptions } from './log.js';\n\nconst prefix = `${styleText('gray', S_BAR)} `;\n\n// TODO (43081j): this currently doesn't support custom `output` writables\n// because we rely on `columns` existing (i.e. `process.stdout.columns).\n//\n// If we want to support `output` being passed in, we will need to use\n// a condition like `if (output insance Writable)` to check if it has columns\nexport const stream = {\n\tmessage: async (\n\t\titerable: Iterable<string> | AsyncIterable<string>,\n\t\t{ symbol = styleText('gray', S_BAR) }: LogMessageOptions = {}\n\t) => {\n\t\tprocess.stdout.write(`${styleText('gray', S_BAR)}\\n${symbol} `);\n\t\tlet lineWidth = 3;\n\t\tfor await (let chunk of iterable) {\n\t\t\tchunk = chunk.replace(/\\n/g, `\\n${prefix}`);\n\t\t\tif (chunk.includes('\\n')) {\n\t\t\t\tlineWidth = 3 + strip(chunk.slice(chunk.lastIndexOf('\\n'))).length;\n\t\t\t}\n\t\t\tconst chunkLen = strip(chunk).length;\n\t\t\tif (lineWidth + chunkLen < process.stdout.columns) {\n\t\t\t\tlineWidth += chunkLen;\n\t\t\t\tprocess.stdout.write(chunk);\n\t\t\t} else {\n\t\t\t\tprocess.stdout.write(`\\n${prefix}${chunk.trimStart()}`);\n\t\t\t\tlineWidth = 3 + strip(chunk.trimStart()).length;\n\t\t\t}\n\t\t}\n\t\tprocess.stdout.write('\\n');\n\t},\n\tinfo: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: styleText('blue', S_INFO) });\n\t},\n\tsuccess: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: styleText('green', S_SUCCESS) });\n\t},\n\tstep: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: styleText('green', S_STEP_SUBMIT) });\n\t},\n\twarn: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: styleText('yellow', S_WARN) });\n\t},\n\t/** alias for `log.warn()`. */\n\twarning: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.warn(iterable);\n\t},\n\terror: (iterable: Iterable<string> | AsyncIterable<string>) => {\n\t\treturn stream.message(iterable, { symbol: styleText('red', S_ERROR) });\n\t},\n};\n","import type { CommonOptions } from './common.js';\nimport { spinner } from './spinner.js';\n\nexport type Task = {\n\t/**\n\t * Task title\n\t */\n\ttitle: string;\n\t/**\n\t * Task function\n\t */\n\ttask: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;\n\n\t/**\n\t * If enabled === false the task will be skipped\n\t */\n\tenabled?: boolean;\n};\n\n/**\n * Define a group of tasks to be executed\n */\nexport const tasks = async (tasks: Task[], opts?: CommonOptions) => {\n\tfor (const task of tasks) {\n\t\tif (task.enabled === false) continue;\n\n\t\tconst s = spinner(opts);\n\t\ts.start(task.title);\n\t\tconst result = await task.task(s.message);\n\t\ts.stop(result || task.title);\n\t}\n};\n","import type { Writable } from 'node:stream';\nimport { styleText } from 'node:util';\nimport { getColumns } from '@clack/core';\nimport { erase } from 'sisteransi';\nimport {\n\ttype CommonOptions,\n\tisCI as isCIFn,\n\tisTTY as isTTYFn,\n\tS_BAR,\n\tS_STEP_SUBMIT,\n} from './common.js';\nimport { log } from './log.js';\n\nexport interface TaskLogOptions extends CommonOptions {\n\ttitle: string;\n\tlimit?: number;\n\tspacing?: number;\n\tretainLog?: boolean;\n}\n\nexport interface TaskLogMessageOptions {\n\traw?: boolean;\n}\n\nexport interface TaskLogCompletionOptions {\n\tshowLog?: boolean;\n}\n\ninterface BufferEntry {\n\theader?: string;\n\tvalue: string;\n\tfull: string;\n\tresult?: {\n\t\tstatus: 'success' | 'error';\n\t\tmessage: string;\n\t};\n}\n\nconst stripDestructiveANSI = (input: string): string => {\n\t// biome-ignore lint/suspicious/noControlCharactersInRegex: intentional\n\treturn input.replace(/\\x1b\\[(?:\\d+;)*\\d*[ABCDEFGHfJKSTsu]|\\x1b\\[(s|u)/g, '');\n};\n\n/**\n * Renders a log which clears on success and remains on failure\n */\nexport const taskLog = (opts: TaskLogOptions) => {\n\tconst output: Writable = opts.output ?? process.stdout;\n\tconst columns = getColumns(output);\n\tconst secondarySymbol = styleText('gray', S_BAR);\n\tconst spacing = opts.spacing ?? 1;\n\tconst barSize = 3;\n\tconst retainLog = opts.retainLog === true;\n\tconst isTTY = !isCIFn() && isTTYFn(output);\n\n\toutput.write(`${secondarySymbol}\\n`);\n\toutput.write(`${styleText('green', S_STEP_SUBMIT)} ${opts.title}\\n`);\n\tfor (let i = 0; i < spacing; i++) {\n\t\toutput.write(`${secondarySymbol}\\n`);\n\t}\n\n\tconst buffers: BufferEntry[] = [\n\t\t{\n\t\t\tvalue: '',\n\t\t\tfull: '',\n\t\t},\n\t];\n\tlet lastMessageWasRaw = false;\n\n\tconst clear = (clearTitle: boolean): void => {\n\t\tif (buffers.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet lines = 0;\n\n\t\tif (clearTitle) {\n\t\t\tlines += spacing + 2;\n\t\t}\n\n\t\tfor (const buffer of buffers) {\n\t\t\tconst { value, result } = buffer;\n\t\t\tlet text = result?.message ?? value;\n\n\t\t\tif (text.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (result === undefined && buffer.header !== undefined && buffer.header !== '') {\n\t\t\t\ttext += `\\n${buffer.header}`;\n\t\t\t}\n\n\t\t\tconst bufferHeight = text.split('\\n').reduce((count, line) => {\n\t\t\t\tif (line === '') {\n\t\t\t\t\treturn count + 1;\n\t\t\t\t}\n\t\t\t\treturn count + Math.ceil((line.length + barSize) / columns);\n\t\t\t}, 0);\n\n\t\t\tlines += bufferHeight;\n\t\t}\n\n\t\tif (lines > 0) {\n\t\t\tlines += 1;\n\t\t\toutput.write(erase.lines(lines));\n\t\t}\n\t};\n\tconst printBuffer = (buffer: BufferEntry, messageSpacing?: number, full?: boolean): void => {\n\t\tconst messages = full ? `${buffer.full}\\n${buffer.value}` : buffer.value;\n\t\tif (buffer.header !== undefined && buffer.header !== '') {\n\t\t\tlog.message(\n\t\t\t\tbuffer.header.split('\\n').map((line) => styleText('bold', line)),\n\t\t\t\t{\n\t\t\t\t\toutput,\n\t\t\t\t\tsecondarySymbol,\n\t\t\t\t\tsymbol: secondarySymbol,\n\t\t\t\t\tspacing: 0,\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\tlog.message(\n\t\t\tmessages.split('\\n').map((line) => styleText('dim', line)),\n\t\t\t{\n\t\t\t\toutput,\n\t\t\t\tsecondarySymbol,\n\t\t\t\tsymbol: secondarySymbol,\n\t\t\t\tspacing: messageSpacing ?? spacing,\n\t\t\t}\n\t\t);\n\t};\n\tconst renderBuffer = (): void => {\n\t\tfor (const buffer of buffers) {\n\t\t\tconst { header, value, full } = buffer;\n\t\t\tif ((header === undefined || header.length === 0) && value.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprintBuffer(buffer, undefined, retainLog === true && full.length > 0);\n\t\t}\n\t};\n\tconst message = (buffer: BufferEntry, msg: string, mopts?: TaskLogMessageOptions) => {\n\t\tclear(false);\n\t\tif ((mopts?.raw !== true || !lastMessageWasRaw) && buffer.value !== '') {\n\t\t\tbuffer.value += '\\n';\n\t\t}\n\t\tbuffer.value += stripDestructiveANSI(msg);\n\t\tlastMessageWasRaw = mopts?.raw === true;\n\t\tif (opts.limit !== undefined) {\n\t\t\tconst lines = buffer.value.split('\\n');\n\t\t\tconst linesToRemove = lines.length - opts.limit;\n\t\t\tif (linesToRemove > 0) {\n\t\t\t\tconst removedLines = lines.splice(0, linesToRemove);\n\t\t\t\tif (retainLog) {\n\t\t\t\t\tbuffer.full += (buffer.full === '' ? '' : '\\n') + removedLines.join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer.value = lines.join('\\n');\n\t\t}\n\t\tif (isTTY) {\n\t\t\tprintBuffers();\n\t\t}\n\t};\n\tconst printBuffers = (): void => {\n\t\tfor (const buffer of buffers) {\n\t\t\tif (buffer.result) {\n\t\t\t\tif (buffer.result.status === 'error') {\n\t\t\t\t\tlog.error(buffer.result.message, { output, secondarySymbol, spacing: 0 });\n\t\t\t\t} else {\n\t\t\t\t\tlog.success(buffer.result.message, { output, secondarySymbol, spacing: 0 });\n\t\t\t\t}\n\t\t\t} else if (buffer.value !== '') {\n\t\t\t\tprintBuffer(buffer, 0);\n\t\t\t}\n\t\t}\n\t};\n\tconst completeBuffer = (buffer: BufferEntry, result: BufferEntry['result']): void => {\n\t\tclear(false);\n\n\t\tbuffer.result = result;\n\n\t\tif (isTTY) {\n\t\t\tprintBuffers();\n\t\t}\n\t};\n\n\treturn {\n\t\tmessage(msg: string, mopts?: TaskLogMessageOptions) {\n\t\t\tmessage(buffers[0], msg, mopts);\n\t\t},\n\t\tgroup(name: string) {\n\t\t\tconst buffer: BufferEntry = {\n\t\t\t\theader: name,\n\t\t\t\tvalue: '',\n\t\t\t\tfull: '',\n\t\t\t};\n\t\t\tbuffers.push(buffer);\n\t\t\treturn {\n\t\t\t\tmessage(msg: string, mopts?: TaskLogMessageOptions) {\n\t\t\t\t\tmessage(buffer, msg, mopts);\n\t\t\t\t},\n\t\t\t\terror(message: string) {\n\t\t\t\t\tcompleteBuffer(buffer, {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsuccess(message: string) {\n\t\t\t\t\tcompleteBuffer(buffer, {\n\t\t\t\t\t\tstatus: 'success',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\terror(message: string, opts?: TaskLogCompletionOptions): void {\n\t\t\tclear(true);\n\t\t\tlog.error(message, { output, secondarySymbol, spacing: 1 });\n\t\t\tif (opts?.showLog !== false) {\n\t\t\t\trenderBuffer();\n\t\t\t}\n\t\t\t// clear buffer since error is an end state\n\t\t\tbuffers.splice(1, buffers.length - 1);\n\t\t\tbuffers[0].value = '';\n\t\t\tbuffers[0].full = '';\n\t\t},\n\t\tsuccess(message: string, opts?: TaskLogCompletionOptions): void {\n\t\t\tclear(true);\n\t\t\tlog.success(message, { output, secondarySymbol, spacing: 1 });\n\t\t\tif (opts?.showLog === true) {\n\t\t\t\trenderBuffer();\n\t\t\t}\n\t\t\t// clear buffer since success is an end state\n\t\t\tbuffers.splice(1, buffers.length - 1);\n\t\t\tbuffers[0].value = '';\n\t\t\tbuffers[0].full = '';\n\t\t},\n\t};\n};\n","import { styleText } from 'node:util';\nimport { settings, TextPrompt } from '@clack/core';\nimport { type CommonOptions, S_BAR, S_BAR_END, symbol } from './common.js';\n\nexport interface TextOptions extends CommonOptions {\n\tmessage: string;\n\tplaceholder?: string;\n\tdefaultValue?: string;\n\tinitialValue?: string;\n\tvalidate?: (value: string | undefined) => string | Error | undefined;\n}\n\nexport const text = (opts: TextOptions) => {\n\treturn new TextPrompt({\n\t\tvalidate: opts.validate,\n\t\tplaceholder: opts.placeholder,\n\t\tdefaultValue: opts.defaultValue,\n\t\tinitialValue: opts.initialValue,\n\t\toutput: opts.output,\n\t\tsignal: opts.signal,\n\t\tinput: opts.input,\n\t\trender() {\n\t\t\tconst hasGuide = opts?.withGuide ?? settings.withGuide;\n\t\t\tconst titlePrefix = `${hasGuide ? `${styleText('gray', S_BAR)}\\n` : ''}${symbol(this.state)} `;\n\t\t\tconst title = `${titlePrefix}${opts.message}\\n`;\n\t\t\tconst placeholder = opts.placeholder\n\t\t\t\t? styleText('inverse', opts.placeholder[0]) + styleText('dim', opts.placeholder.slice(1))\n\t\t\t\t: styleText(['inverse', 'hidden'], '_');\n\t\t\tconst userInput = !this.userInput ? placeholder : this.userInputWithCursor;\n\t\t\tconst value = this.value ?? '';\n\n\t\t\tswitch (this.state) {\n\t\t\t\tcase 'error': {\n\t\t\t\t\tconst errorText = this.error ? ` ${styleText('yellow', this.error)}` : '';\n\t\t\t\t\tconst errorPrefix = hasGuide ? `${styleText('yellow', S_BAR)} ` : '';\n\t\t\t\t\tconst errorPrefixEnd = hasGuide ? styleText('yellow', S_BAR_END) : '';\n\t\t\t\t\treturn `${title.trim()}\\n${errorPrefix}${userInput}\\n${errorPrefixEnd}${errorText}\\n`;\n\t\t\t\t}\n\t\t\t\tcase 'submit': {\n\t\t\t\t\tconst valueText = value ? ` ${styleText('dim', value)}` : '';\n\t\t\t\t\tconst submitPrefix = hasGuide ? styleText('gray', S_BAR) : '';\n\t\t\t\t\treturn `${title}${submitPrefix}${valueText}`;\n\t\t\t\t}\n\t\t\t\tcase 'cancel': {\n\t\t\t\t\tconst valueText = value ? ` ${styleText(['strikethrough', 'dim'], value)}` : '';\n\t\t\t\t\tconst cancelPrefix = hasGuide ? styleText('gray', S_BAR) : '';\n\t\t\t\t\treturn `${title}${cancelPrefix}${valueText}${value.trim() ? `\\n${cancelPrefix}` : ''}`;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst defaultPrefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : '';\n\t\t\t\t\tconst defaultPrefixEnd = hasGuide ? styleText('cyan', S_BAR_END) : '';\n\t\t\t\t\treturn `${title}${defaultPrefix}${userInput}\\n${defaultPrefixEnd}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}).prompt() as Promise<string | symbol>;\n};\n","import { createHash } from \"node:crypto\";\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n rmdirSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport const PACKAGE_ROOT = findPackageRoot(import.meta.url);\nexport const TEMPLATE_ROOT = resolveTemplateRoot(PACKAGE_ROOT);\n\nexport function findPackageRoot(fromUrl: string): string {\n let current = path.dirname(fileURLToPath(fromUrl));\n\n while (!existsSync(path.join(current, \"package.json\"))) {\n const parent = path.dirname(current);\n if (parent === current) {\n throw new Error(\"Could not locate package.json from current module.\");\n }\n\n current = parent;\n }\n\n return current;\n}\n\nfunction resolveTemplateRoot(packageRoot: string): string {\n const sibling = path.resolve(packageRoot, \"..\", \"docs\", \"template\");\n if (existsSync(sibling)) {\n return sibling;\n }\n\n const bundled = path.join(packageRoot, \"template\");\n if (existsSync(bundled)) {\n return bundled;\n }\n\n throw new Error(\n `Could not locate template root. Tried ${sibling} and ${bundled}.`,\n );\n}\n\nexport function readPackageFile(relativePath: string): string {\n if (relativePath === \"package.json\") {\n return readTextFile(path.join(PACKAGE_ROOT, relativePath));\n }\n\n return readTextFile(path.join(TEMPLATE_ROOT, relativePath));\n}\n\nexport function readTextFile(filePath: string): string {\n return readFileSync(filePath, \"utf8\");\n}\n\nexport function writeTextFile(filePath: string, content: string): void {\n ensureParentDir(filePath);\n writeFileSync(filePath, content, \"utf8\");\n}\n\nexport function ensureParentDir(filePath: string): void {\n mkdirSync(path.dirname(filePath), { recursive: true });\n}\n\nexport function normalizeRelativePath(relativePath: string): string {\n return relativePath.split(path.sep).join(\"/\");\n}\n\nexport function hashText(content: string): string {\n return createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nexport function readPackageMeta(): { name: string; version: string } {\n const raw = JSON.parse(readPackageFile(\"package.json\")) as {\n name: string;\n version: string;\n };\n\n return { name: raw.name, version: raw.version };\n}\n\nexport function createRunId(now = new Date()): string {\n return now.toISOString().replace(/[:.]/g, \"-\");\n}\n\nexport function pruneEmptyDirectories(startDir: string, stopDir: string): void {\n let current = startDir;\n const boundary = path.resolve(stopDir);\n\n while (current.startsWith(boundary) && current !== boundary) {\n if (!existsSync(current)) {\n current = path.dirname(current);\n continue;\n }\n\n const entries = readdirSync(current);\n if (entries.length > 0) {\n break;\n }\n\n rmSync(current, { recursive: true, force: true });\n current = path.dirname(current);\n }\n}\n\nexport function removeFileIfPresent(filePath: string): boolean {\n if (!existsSync(filePath)) {\n return false;\n }\n\n const stats = statSync(filePath);\n if (!stats.isFile()) {\n throw new Error(`Expected a regular file at ${filePath}, but found a different entry type.`);\n }\n\n rmSync(filePath, { force: false });\n return true;\n}\n\nexport function pruneDirectoryIfEmpty(directoryPath: string): boolean {\n if (!existsSync(directoryPath)) {\n return false;\n }\n\n const stats = statSync(directoryPath);\n if (!stats.isDirectory()) {\n throw new Error(`Expected a directory at ${directoryPath}, but found a different entry type.`);\n }\n\n if (readdirSync(directoryPath).length > 0) {\n return false;\n }\n\n rmdirSync(directoryPath);\n return true;\n}\n\nexport function formatInlineList(items: string[]): string {\n if (items.length === 0) {\n return \"\";\n }\n\n if (items.length === 1) {\n return items[0];\n }\n\n if (items.length === 2) {\n return `${items[0]} and ${items[1]}`;\n }\n\n return `${items.slice(0, -1).join(\", \")}, and ${items.at(-1)}`;\n}\n\nexport function relativePathToTarget(targetDir: string, relativePath: string): string {\n return path.isAbsolute(relativePath) ? path.normalize(relativePath) : path.join(targetDir, relativePath);\n}\n\nexport function exists(filePath: string): boolean {\n return existsSync(filePath);\n}\n","import path from \"node:path\";\nimport { readTextFile } from \"./utils\";\n\nexport interface SkillAssetEntry {\n source: string;\n installPath: string;\n}\n\nexport interface SkillRegistryEntry {\n name: string;\n source: string;\n entryPoint: string;\n installName: string;\n description: string;\n assets: SkillAssetEntry[];\n}\n\nexport interface SkillRegistry {\n skills: SkillRegistryEntry[];\n}\n\nconst REGISTRY_FILENAME = \"skill-registry.json\";\n\nexport function loadSkillRegistry(packageRoot: string): SkillRegistry {\n const registryPath = path.join(packageRoot, REGISTRY_FILENAME);\n\n let raw: string;\n try {\n raw = readTextFile(registryPath);\n } catch (cause) {\n throw new Error(`Skill registry not found at ${registryPath}`, { cause });\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (cause) {\n throw new Error(`Skill registry at ${registryPath} is not valid JSON`, {\n cause,\n });\n }\n\n if (\n !isPlainObject(parsed) ||\n !Array.isArray((parsed as { skills?: unknown }).skills)\n ) {\n throw new Error(\n `Skill registry at ${registryPath} must have a \\`skills\\` array`,\n );\n }\n\n const skills: SkillRegistryEntry[] = [];\n for (const [index, entry] of (\n parsed as { skills: unknown[] }\n ).skills.entries()) {\n const validated = validateEntry(entry, index);\n if (validated) {\n skills.push(validated);\n }\n }\n\n return { skills };\n}\n\nexport function getSkillRegistryNames(registry: SkillRegistry): string[] {\n return registry.skills.map((skill) => skill.name).sort();\n}\n\nfunction validateEntry(\n entry: unknown,\n index: number,\n): SkillRegistryEntry | null {\n if (!isPlainObject(entry)) {\n console.warn(\n `Skill registry entry at index ${index} is not an object; skipping.`,\n );\n return null;\n }\n\n const name = readRequiredString(entry, \"name\", `entry at index ${index}`);\n if (name === null) return null;\n\n const source = readRequiredString(entry, \"source\", `entry \\`${name}\\``);\n const entryPoint = readRequiredString(\n entry,\n \"entryPoint\",\n `entry \\`${name}\\``,\n );\n const installName = readRequiredString(\n entry,\n \"installName\",\n `entry \\`${name}\\``,\n );\n if (source === null || entryPoint === null || installName === null)\n return null;\n\n if (!isRemoteSource(source)) {\n console.warn(\n `Skill registry entry \\`${name}\\` must use a remote source URL; skipping.`,\n );\n return null;\n }\n\n if (!Array.isArray(entry.assets)) {\n console.warn(\n `Skill registry entry \\`${name}\\` is missing \\`assets\\` array; skipping.`,\n );\n return null;\n }\n\n const assets: SkillAssetEntry[] = [];\n for (const [assetIndex, asset] of entry.assets.entries()) {\n if (\n !isPlainObject(asset) ||\n typeof asset.source !== \"string\" ||\n typeof asset.installPath !== \"string\"\n ) {\n console.warn(\n `Skill \\`${name}\\` asset at index ${assetIndex} is invalid; skipping asset.`,\n );\n continue;\n }\n assets.push({ source: asset.source, installPath: asset.installPath });\n }\n\n return {\n name,\n source,\n entryPoint,\n installName,\n description: typeof entry.description === \"string\" ? entry.description : \"\",\n assets,\n };\n}\n\nfunction readRequiredString(\n entry: Record<string, unknown>,\n field: string,\n context: string,\n): string | null {\n const value = entry[field];\n if (typeof value !== \"string\" || value.length === 0) {\n console.warn(\n `Skill registry ${context} is missing required field \\`${field}\\`; skipping.`,\n );\n return null;\n }\n return value;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isRemoteSource(source: string): boolean {\n return (\n source.startsWith(\"https://\") ||\n source.startsWith(\"http://\") ||\n source.startsWith(\"github:\") ||\n source.startsWith(\"url:\")\n );\n}\n","export const CAPABILITIES = [\"designs\", \"plans\", \"prd\", \"work\"] as const;\n\nexport type Capability = (typeof CAPABILITIES)[number];\n\nexport const INSTRUCTION_KINDS = [\"AGENTS.md\", \"CLAUDE.md\"] as const;\n\nexport type InstructionKind = (typeof INSTRUCTION_KINDS)[number];\n\nexport const HARNESSES = [\"claude-code\", \"codex\"] as const;\n\nexport type Harness = (typeof HARNESSES)[number];\n\nexport const INSTRUCTION_KIND_TO_HARNESS: Record<InstructionKind, Harness> = {\n \"AGENTS.md\": \"codex\",\n \"CLAUDE.md\": \"claude-code\",\n};\n\nexport const HARNESS_TO_INSTRUCTION: Record<Harness, InstructionKind> = {\n \"claude-code\": \"CLAUDE.md\",\n codex: \"AGENTS.md\",\n};\n\nexport type ManagedFileConflictResolution = \"overwrite\" | \"skip\";\nexport type ManagedFileConflictResolutions = Partial<\n Record<string, ManagedFileConflictResolution>\n>;\nexport type ManagedFileConflictGroup =\n | \"agent-instructions\"\n | \"managed-files\"\n | \"prompts\"\n | \"references\"\n | \"skills\"\n | \"templates\";\nexport type ActionType =\n | \"create\"\n | \"noop\"\n | \"skip\"\n | \"update\"\n | \"update-conflict\"\n | \"skip-conflict\"\n | \"remove-managed\"\n | \"generate\";\n\nexport interface InstallSelections {\n capabilities: Record<Capability, boolean>;\n harnesses: Record<Harness, boolean>;\n skills: boolean;\n skillScope: \"project\" | \"global\";\n selectedSkills: string[];\n}\n\nexport function getActiveInstructionKinds(\n selections: Pick<InstallSelections, \"harnesses\">,\n): Set<InstructionKind> {\n const active = new Set<InstructionKind>();\n for (const harness of HARNESSES) {\n if (selections.harnesses[harness]) {\n active.add(HARNESS_TO_INSTRUCTION[harness]);\n }\n }\n return active;\n}\n\nexport interface CapabilityState {\n explicitSelection: boolean;\n effectiveSelection: boolean;\n missingPrerequisites: Capability[];\n disabledReason?: string;\n}\n\nexport interface InstallProfile {\n selections: InstallSelections;\n capabilityState: Record<Capability, CapabilityState>;\n effectiveCapabilities: Capability[];\n profileId: string;\n}\n\nexport interface ResolvedAsset {\n relativePath: string;\n assetClass: \"static\" | \"scoped-static\" | \"buildable\";\n sourceId: string;\n content: string;\n}\n\nexport interface ManifestFileEntry {\n hash: string;\n sourceId: string;\n}\n\nexport interface InstallManifest {\n schemaVersion: number;\n packageName: string;\n packageVersion: string;\n updatedAt: string;\n profileId: string;\n selections: InstallSelections;\n effectiveCapabilities: Capability[];\n files: Record<string, ManifestFileEntry>;\n skillFiles: string[];\n}\n\nexport interface ReviewableManagedFileConflict {\n relativePath: string;\n group: ManagedFileConflictGroup;\n sourceId: string;\n reason: string;\n instructionKind?: InstructionKind;\n}\n\nexport interface PlannedAction {\n type: ActionType;\n relativePath: string;\n sourceId?: string;\n content?: string;\n contentHash?: string;\n reason?: string;\n}\n\nexport interface InstallPlan {\n packageName: string;\n packageVersion: string;\n profile: InstallProfile;\n actions: PlannedAction[];\n desiredFiles: Record<string, ManifestFileEntry>;\n desiredSkillFiles: string[];\n conflictsRunId?: string;\n}\n\nexport interface PackageMeta {\n name: string;\n version: string;\n}\n\nexport interface ApplyResult {\n manifest: InstallManifest;\n appliedActions: PlannedAction[];\n conflictFiles: string[];\n}\n\nexport type AuditMode = \"manifest-present\" | \"manifest-missing\";\nexport type AuditPathKind = \"file\" | \"directory\";\nexport type AuditPathScope = \"project\" | \"home\" | \"external\";\nexport type AuditOwnershipSource =\n | \"manifest-file\"\n | \"manifest-skill-file\"\n | \"managed-state\"\n | \"fallback\";\nexport type AuditSkippedStatus = \"already-absent\" | \"excluded\";\nexport type AuditReasonCode =\n | \"root-instruction-content-match\"\n | \"managed-file-hash-match\"\n | \"managed-skill-file-content-match\"\n | \"managed-state-file\"\n | \"fallback-canonical-content-match\"\n | \"fallback-root-fingerprint-match\"\n | \"directory-eligible-for-prune\"\n | \"already-absent\"\n | \"inside-backup-root\"\n | \"outside-supported-roots\"\n | \"root-instruction-content-mismatch\"\n | \"managed-file-modified\"\n | \"manifest-skill-file-without-metadata\"\n | \"manifest-skill-file-content-mismatch\"\n | \"fallback-root-fingerprint-mismatch\"\n | \"fallback-ambiguous\"\n | \"directory-contains-unmanaged-descendants\"\n | \"directory-contains-preserved-descendants\";\n\nexport interface AuditReason {\n code: AuditReasonCode;\n message: string;\n}\n\nexport interface AuditBackupPath {\n scope: Exclude<AuditPathScope, \"external\"> | null;\n relativePath: string | null;\n}\n\nexport interface AuditOrderingMetadata {\n scopeOrder: number;\n depth: number;\n sortKey: string;\n pruneSortKey: string;\n}\n\nexport interface AuditPathMetadata {\n path: string;\n absolutePath: string;\n kind: AuditPathKind;\n scope: AuditPathScope;\n pathScope: AuditPathScope;\n backupRelativePath: string | null;\n backup: AuditBackupPath;\n ordering: AuditOrderingMetadata;\n}\n\nexport interface AuditManagedPathMetadata extends AuditPathMetadata {\n ownershipSource: AuditOwnershipSource;\n sourceId?: string;\n}\n\nexport interface AuditCandidateMetadata extends AuditPathMetadata {\n ownershipSource?: AuditOwnershipSource;\n sourceId?: string;\n}\n\nexport interface ManifestAuditRecord extends AuditManagedPathMetadata {\n manifestHash?: string;\n}\n\nexport interface ManifestAuditContext {\n manifestPath: string;\n managedFiles: ManifestAuditRecord[];\n skillFiles: ManifestAuditRecord[];\n priorSelections: InstallSelections;\n}\n\nexport interface AuditRemovableFile extends AuditManagedPathMetadata {\n kind: \"file\";\n reason: string;\n reasonCode: AuditReasonCode;\n expectedHash?: string;\n currentHash?: string;\n}\n\nexport interface AuditPrunableDirectory extends AuditPathMetadata {\n kind: \"directory\";\n reason: string;\n reasonCode: AuditReasonCode;\n removableDescendantPaths: string[];\n preservedDescendantPaths: string[];\n}\n\nexport interface AuditPreservedPath extends AuditCandidateMetadata {\n reason: string;\n reasonCode: AuditReasonCode;\n preservedDescendantPaths?: string[];\n}\n\nexport interface AuditSkippedPath extends AuditCandidateMetadata {\n reason: string;\n reasonCode: AuditReasonCode;\n status: AuditSkippedStatus;\n}\n\nexport interface AuditReport {\n mode: AuditMode;\n targetDir: string;\n manifestPath: string;\n removableFiles: AuditRemovableFile[];\n prunableDirectories: AuditPrunableDirectory[];\n preservedPaths: AuditPreservedPath[];\n skippedPaths: AuditSkippedPath[];\n}\n\nexport type LifecyclePermissionsMode = \"confirm\" | \"allow-all\";\n\nexport interface BackupDestinationPlan {\n backupRoot: string;\n dateStamp: string;\n directoryName: string;\n destinationDir: string;\n promotion?: {\n from: string;\n to: string;\n };\n}\n\nexport interface BackupCommandOptions {\n targetDir: string;\n permissions: LifecyclePermissionsMode;\n homeDir?: string;\n now?: Date;\n}\n\nexport interface BackupExecutionResult {\n status: \"completed\" | \"cancelled\" | \"noop\";\n targetDir: string;\n destinationDir: string | null;\n auditReport: AuditReport;\n copiedFiles: string[];\n materializedDirectories: string[];\n}\n","import { getSkillRegistryNames, loadSkillRegistry } from \"./skill-registry\";\nimport { hashText, formatInlineList, PACKAGE_ROOT } from \"./utils\";\nimport {\n CAPABILITIES,\n type Capability,\n type CapabilityState,\n type InstallProfile,\n type InstallSelections,\n} from \"./types\";\n\nexport const CAPABILITY_DEPENDENCIES: Record<Capability, Capability[]> = {\n designs: [],\n plans: [],\n prd: [\"plans\"],\n work: [\"plans\", \"prd\"],\n};\n\nexport function defaultSelections(): InstallSelections {\n return {\n capabilities: {\n designs: true,\n plans: true,\n prd: true,\n work: true,\n },\n harnesses: {\n \"claude-code\": true,\n codex: true,\n },\n skills: true,\n skillScope: \"project\",\n selectedSkills: getDefaultSelectedSkills(),\n };\n}\n\nexport function cloneSelections(\n selections: InstallSelections,\n): InstallSelections {\n return structuredClone(selections);\n}\n\nexport function resolveCapabilityState(\n selections: InstallSelections,\n): Record<Capability, CapabilityState> {\n const state = {} as Record<Capability, CapabilityState>;\n\n for (const capability of CAPABILITIES) {\n const missingPrerequisites = CAPABILITY_DEPENDENCIES[capability].filter(\n (dependency) => !state[dependency]?.effectiveSelection,\n );\n const explicitSelection = selections.capabilities[capability];\n const effectiveSelection =\n explicitSelection && missingPrerequisites.length === 0;\n\n state[capability] = {\n explicitSelection,\n effectiveSelection,\n missingPrerequisites,\n disabledReason:\n missingPrerequisites.length > 0\n ? `${capability} requires ${formatInlineList(missingPrerequisites)}`\n : undefined,\n };\n }\n\n return state;\n}\n\nexport function resolveInstallProfile(\n selections: InstallSelections,\n): InstallProfile {\n const capabilityState = resolveCapabilityState(selections);\n const effectiveCapabilities = CAPABILITIES.filter(\n (capability) => capabilityState[capability].effectiveSelection,\n );\n\n const profileId = hashText(\n JSON.stringify({\n capabilities: capabilityState,\n harnesses: selections.harnesses,\n skills: selections.skills,\n skillScope: selections.skillScope,\n selectedSkills: [...selections.selectedSkills].sort(),\n }),\n ).slice(0, 16);\n\n return {\n selections,\n capabilityState,\n effectiveCapabilities,\n profileId,\n };\n}\n\nexport function hasEffectiveCapabilities(profile: InstallProfile): boolean {\n return profile.effectiveCapabilities.length > 0;\n}\n\nexport function isFullDefaultProfile(profile: InstallProfile): boolean {\n return (\n CAPABILITIES.every(\n (capability) => profile.capabilityState[capability].effectiveSelection,\n ) &&\n profile.selections.harnesses[\"claude-code\"] &&\n profile.selections.harnesses.codex &&\n profile.selections.skills &&\n profile.selections.skillScope === \"project\" &&\n arraysEqual(\n [...profile.selections.selectedSkills].sort(),\n getDefaultSelectedSkills(),\n )\n );\n}\n\nfunction getDefaultSelectedSkills(): string[] {\n return getSkillRegistryNames(loadSkillRegistry(PACKAGE_ROOT));\n}\n\nfunction arraysEqual(left: string[], right: string[]): boolean {\n return (\n left.length === right.length &&\n left.every((value, index) => value === right[index])\n );\n}\n","import os from \"node:os\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n AuditPathKind,\n AuditPathMetadata,\n Capability,\n InstallManifest,\n InstallProfile,\n InstallSelections,\n ManifestAuditContext,\n ManifestAuditRecord,\n ManifestFileEntry,\n PackageMeta,\n} from \"./types\";\nimport { CAPABILITIES, HARNESSES } from \"./types\";\nimport { normalizeRelativePath, readTextFile, writeTextFile } from \"./utils\";\n\nexport const MANIFEST_SCHEMA_VERSION = 1;\nexport const MAKE_DOCS_STATE_RELATIVE_DIR = \".make-docs\";\nexport const MANIFEST_RELATIVE_PATH = `${MAKE_DOCS_STATE_RELATIVE_DIR}/manifest.json`;\nexport const CONFLICTS_RELATIVE_DIR = `${MAKE_DOCS_STATE_RELATIVE_DIR}/conflicts`;\n\nexport function getManifestPath(targetDir: string): string {\n return path.join(targetDir, MANIFEST_RELATIVE_PATH);\n}\n\nexport function loadManifest(targetDir: string): InstallManifest | null {\n const manifestPath = getManifestPath(targetDir);\n if (!existsSync(manifestPath)) {\n return null;\n }\n\n const parsed = JSON.parse(readTextFile(manifestPath)) as unknown;\n return validateAndMigrateManifest(parsed, manifestPath);\n}\n\nexport function migrateSelections(selections: unknown): InstallSelections {\n assertPlainObject(selections, \"selections\");\n assertNoRemovedAssetFields(selections, \"selections\");\n\n const legacy = selections as InstallSelections & {\n instructionKinds?: Record<string, boolean>;\n optionalSkills?: unknown;\n selectedSkills?: unknown;\n };\n if (\"optionalSkills\" in legacy) {\n throw new Error(\"selections.optionalSkills is no longer supported\");\n }\n const selectedSkills = validateSelectedSkills(legacy.selectedSkills);\n\n if (legacy.instructionKinds && !legacy.harnesses) {\n assertPlainObject(legacy.instructionKinds, \"selections.instructionKinds\");\n const ik = legacy.instructionKinds;\n const migrated: InstallSelections = {\n capabilities: validateCapabilities(legacy.capabilities),\n harnesses: {\n \"claude-code\": validateBoolean(\n ik[\"CLAUDE.md\"] ?? false,\n \"selections.instructionKinds.CLAUDE.md\",\n ),\n codex: validateBoolean(\n ik[\"AGENTS.md\"] ?? false,\n \"selections.instructionKinds.AGENTS.md\",\n ),\n },\n skills:\n legacy.skills === undefined\n ? true\n : validateBoolean(legacy.skills, \"selections.skills\"),\n skillScope: validateSkillScope(legacy.skillScope ?? \"project\"),\n selectedSkills,\n };\n return migrated;\n }\n\n return {\n capabilities: validateCapabilities(legacy.capabilities),\n harnesses: validateHarnesses(legacy.harnesses),\n skills: validateBoolean(legacy.skills, \"selections.skills\"),\n skillScope: validateSkillScope(legacy.skillScope ?? \"project\"),\n selectedSkills,\n };\n}\n\nexport function createManifest(\n packageMeta: PackageMeta,\n profile: InstallProfile,\n files: Record<string, ManifestFileEntry>,\n skillFiles: string[],\n): InstallManifest {\n return {\n schemaVersion: MANIFEST_SCHEMA_VERSION,\n packageName: packageMeta.name,\n packageVersion: packageMeta.version,\n updatedAt: new Date().toISOString(),\n profileId: profile.profileId,\n selections: profile.selections,\n effectiveCapabilities: profile.effectiveCapabilities,\n files,\n skillFiles: Array.from(new Set(skillFiles)).sort(),\n };\n}\n\nexport function writeManifest(\n targetDir: string,\n manifest: InstallManifest,\n): string {\n const manifestPath = getManifestPath(targetDir);\n writeTextFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\\n`);\n return manifestPath;\n}\n\nexport function getManifestAuditContext(\n targetDir: string,\n manifest: InstallManifest,\n homeDir = os.homedir(),\n): ManifestAuditContext {\n const managedFiles = Object.entries(manifest.files)\n .map(([managedPath, entry]) =>\n createManifestAuditRecord(\n targetDir,\n homeDir,\n managedPath,\n \"manifest-file\",\n entry,\n ),\n )\n .sort(compareAuditRecords);\n\n const skillFiles = Array.from(new Set(manifest.skillFiles))\n .map((managedPath) =>\n createManifestAuditRecord(\n targetDir,\n homeDir,\n managedPath,\n \"manifest-skill-file\",\n manifest.files[managedPath],\n ),\n )\n .sort(compareAuditRecords);\n\n return {\n manifestPath: getManifestPath(targetDir),\n managedFiles,\n skillFiles,\n priorSelections: structuredClone(manifest.selections),\n };\n}\n\nexport function createAuditPathMetadata(\n targetDir: string,\n auditPath: string,\n kind: AuditPathKind,\n homeDir = os.homedir(),\n): AuditPathMetadata {\n const normalizedTargetDir = path.resolve(targetDir);\n const absolutePath = path.isAbsolute(auditPath)\n ? path.normalize(auditPath)\n : path.resolve(normalizedTargetDir, auditPath);\n const normalizedHomeDir = path.resolve(homeDir);\n const projectRelativePath = getContainedRelativePath(\n normalizedTargetDir,\n absolutePath,\n );\n const homeRelativePath = getContainedRelativePath(\n normalizedHomeDir,\n absolutePath,\n );\n\n const pathScope =\n projectRelativePath !== null\n ? \"project\"\n : homeRelativePath !== null\n ? \"home\"\n : \"external\";\n const displayPath =\n pathScope === \"project\"\n ? normalizeRelativePath(projectRelativePath ?? auditPath)\n : normalizeRelativePath(absolutePath);\n const backupRelativePath =\n pathScope === \"project\"\n ? normalizeRelativePath(projectRelativePath ?? auditPath)\n : pathScope === \"home\"\n ? normalizeRelativePath(path.join(\"_home\", homeRelativePath ?? \"\"))\n : null;\n const depth =\n displayPath === \".\"\n ? 0\n : displayPath.split(\"/\").filter((segment) => segment.length > 0).length;\n const scopeOrder = pathScope === \"project\" ? 0 : pathScope === \"home\" ? 1 : 2;\n\n return {\n path: displayPath,\n absolutePath,\n kind,\n scope: pathScope,\n pathScope,\n backupRelativePath,\n backup: {\n scope: pathScope === \"external\" ? null : pathScope,\n relativePath: backupRelativePath,\n },\n ordering: {\n scopeOrder,\n depth,\n sortKey: `${scopeOrder}:${displayPath}`,\n pruneSortKey: `${scopeOrder}:${String(10_000 - depth).padStart(5, \"0\")}:${displayPath}`,\n },\n };\n}\n\nfunction migrateSkillFiles(skillFiles: unknown): string[] {\n if (Array.isArray(skillFiles)) {\n return skillFiles.filter(\n (value): value is string => typeof value === \"string\",\n );\n }\n\n if (isPlainObject(skillFiles)) {\n return Object.keys(skillFiles);\n }\n\n return [];\n}\n\nfunction validateAndMigrateManifest(\n value: unknown,\n manifestPath: string,\n): InstallManifest {\n try {\n assertPlainObject(value, \"manifest\");\n assertNoRemovedAssetFields(value, \"manifest\");\n\n if (!(\"skillFiles\" in value)) {\n throw new Error(\"manifest.skillFiles is required\");\n }\n\n const skillFiles = migrateSkillFiles(value.skillFiles);\n const selections = migrateSelections(value.selections);\n const files = validateManifestFiles(value.files);\n\n const schemaVersion = validateNumber(\n value.schemaVersion,\n \"manifest.schemaVersion\",\n );\n if (schemaVersion !== MANIFEST_SCHEMA_VERSION) {\n throw new Error(\n `manifest.schemaVersion must be ${MANIFEST_SCHEMA_VERSION}`,\n );\n }\n\n return {\n schemaVersion,\n packageName: validateString(value.packageName, \"manifest.packageName\"),\n packageVersion: validateString(\n value.packageVersion,\n \"manifest.packageVersion\",\n ),\n updatedAt: validateString(value.updatedAt, \"manifest.updatedAt\"),\n profileId: validateString(value.profileId, \"manifest.profileId\"),\n selections,\n effectiveCapabilities: validateEffectiveCapabilities(\n value.effectiveCapabilities,\n ),\n files,\n skillFiles,\n };\n } catch (error) {\n const reason =\n error instanceof Error ? error.message : \"invalid manifest shape\";\n throw new Error(\n `Stale or malformed make-docs manifest at ${manifestPath}: ${reason}. Fix or remove the stale manifest and rerun bare \\`make-docs\\` to rebuild it.`,\n );\n }\n}\n\nfunction assertNoRemovedAssetFields(\n value: Record<string, unknown>,\n label: string,\n): void {\n for (const field of [\"prompts\", \"templatesMode\", \"referencesMode\"]) {\n if (field in value) {\n throw new Error(`${label}.${field} is no longer supported`);\n }\n }\n}\n\nfunction validateCapabilities(value: unknown): Record<Capability, boolean> {\n assertPlainObject(value, \"selections.capabilities\");\n const capabilities = {} as Record<Capability, boolean>;\n\n for (const capability of CAPABILITIES) {\n capabilities[capability] = validateBoolean(\n value[capability],\n `selections.capabilities.${capability}`,\n );\n }\n\n return capabilities;\n}\n\nfunction validateHarnesses(value: unknown): InstallSelections[\"harnesses\"] {\n assertPlainObject(value, \"selections.harnesses\");\n const harnesses = {} as InstallSelections[\"harnesses\"];\n\n for (const harness of HARNESSES) {\n harnesses[harness] = validateBoolean(\n value[harness],\n `selections.harnesses.${harness}`,\n );\n }\n\n return harnesses;\n}\n\nfunction validateSkillScope(value: unknown): InstallSelections[\"skillScope\"] {\n if (value !== \"project\" && value !== \"global\") {\n throw new Error(\"selections.skillScope must be project or global\");\n }\n\n return value;\n}\n\nfunction validateManifestFiles(\n value: unknown,\n): Record<string, ManifestFileEntry> {\n assertPlainObject(value, \"manifest.files\");\n const files: Record<string, ManifestFileEntry> = {};\n\n for (const [managedPath, entry] of Object.entries(value)) {\n assertPlainObject(entry, `manifest.files.${managedPath}`);\n files[managedPath] = {\n hash: validateString(entry.hash, `manifest.files.${managedPath}.hash`),\n sourceId: validateString(\n entry.sourceId,\n `manifest.files.${managedPath}.sourceId`,\n ),\n };\n }\n\n return files;\n}\n\nfunction validateEffectiveCapabilities(value: unknown): Capability[] {\n if (!Array.isArray(value)) {\n throw new Error(\"manifest.effectiveCapabilities must be an array\");\n }\n\n return value.map((capability, index) => {\n if (\n typeof capability !== \"string\" ||\n !CAPABILITIES.includes(capability as Capability)\n ) {\n throw new Error(\n `manifest.effectiveCapabilities.${index} must be a valid capability`,\n );\n }\n return capability as Capability;\n });\n}\n\nfunction validateString(value: unknown, label: string): string {\n if (typeof value !== \"string\") {\n throw new Error(`${label} must be a string`);\n }\n\n return value;\n}\n\nfunction validateNumber(value: unknown, label: string): number {\n if (typeof value !== \"number\") {\n throw new Error(`${label} must be a number`);\n }\n\n return value;\n}\n\nfunction validateBoolean(value: unknown, label: string): boolean {\n if (typeof value !== \"boolean\") {\n throw new Error(`${label} must be a boolean`);\n }\n\n return value;\n}\n\nfunction assertPlainObject(\n value: unknown,\n label: string,\n): asserts value is Record<string, unknown> {\n if (!isPlainObject(value)) {\n throw new Error(`${label} must be an object`);\n }\n}\n\nfunction validateSelectedSkills(value: unknown): string[] {\n if (!Array.isArray(value)) {\n throw new Error(\"selections.selectedSkills must be an array\");\n }\n\n return Array.from(\n new Set(\n value.map((skill, index) =>\n validateString(skill, `selections.selectedSkills.${index}`),\n ),\n ),\n ).sort();\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction createManifestAuditRecord(\n targetDir: string,\n homeDir: string,\n managedPath: string,\n ownershipSource: ManifestAuditRecord[\"ownershipSource\"],\n manifestEntry?: ManifestFileEntry,\n): ManifestAuditRecord {\n return {\n ...createAuditPathMetadata(targetDir, managedPath, \"file\", homeDir),\n ownershipSource,\n sourceId: manifestEntry?.sourceId,\n manifestHash: manifestEntry?.hash,\n };\n}\n\nfunction compareAuditRecords(\n left: ManifestAuditRecord,\n right: ManifestAuditRecord,\n): number {\n return left.ordering.sortKey.localeCompare(right.ordering.sortKey);\n}\n\nfunction getContainedRelativePath(\n root: string,\n candidate: string,\n): string | null {\n const relative = path.relative(root, candidate);\n if (relative === \"\") {\n return \".\";\n }\n\n if (relative.startsWith(\"..\") || path.isAbsolute(relative)) {\n return null;\n }\n\n return relative;\n}\n","import type { Capability, InstallProfile } from \"./types\";\n\nexport interface PromptRule {\n relativePath: string;\n requires: Capability[];\n}\n\nexport const PROMPT_RULES: PromptRule[] = [\n {\n relativePath: \"docs/assets/prompts/docs-path-hygiene-cleanup.prompt.md\",\n requires: [],\n },\n {\n relativePath: \"docs/assets/prompts/request-to-design.prompt.md\",\n requires: [\"designs\"],\n },\n {\n relativePath: \"docs/assets/prompts/designs-to-plan.prompt.md\",\n requires: [\"designs\", \"plans\"],\n },\n {\n relativePath: \"docs/assets/prompts/designs-to-plan-change.prompt.md\",\n requires: [\"designs\", \"plans\"],\n },\n {\n relativePath: \"docs/assets/prompts/plan-to-prd-change.prompt.md\",\n requires: [\"plans\", \"prd\"],\n },\n {\n relativePath: \"docs/assets/prompts/plan-to-prd-green-field.prompt.md\",\n requires: [\"plans\", \"prd\"],\n },\n {\n relativePath: \"docs/assets/prompts/prd-change-to-work.prompt.md\",\n requires: [\"prd\", \"work\"],\n },\n {\n relativePath: \"docs/assets/prompts/prd-to-work-full-prd.prompt.md\",\n requires: [\"prd\", \"work\"],\n },\n {\n relativePath: \"docs/assets/prompts/prd-to-work-prd-feature.prompt.md\",\n requires: [\"prd\", \"work\"],\n },\n {\n relativePath: \"docs/assets/prompts/work-to-guides.prompt.md\",\n requires: [\"work\"],\n },\n {\n relativePath: \"docs/assets/prompts/update-readme-green-field.prompt.md\",\n requires: [\"designs\", \"plans\"],\n },\n {\n relativePath: \"docs/assets/prompts/session-to-history-record.prompt.md\",\n requires: [],\n },\n {\n relativePath: \"docs/assets/prompts/work-to-commit-message.prompt.md\",\n requires: [],\n },\n];\n\nconst PLAN_TEMPLATE_PATHS = [\n \"docs/assets/templates/plan-overview.md\",\n \"docs/assets/templates/plan-prd.md\",\n \"docs/assets/templates/plan-prd-decompose.md\",\n \"docs/assets/templates/plan-prd-change.md\",\n];\n\nconst PRD_TEMPLATE_PATHS = [\n \"docs/assets/templates/prd-architecture.md\",\n \"docs/assets/templates/prd-change-addition.md\",\n \"docs/assets/templates/prd-change-revision.md\",\n \"docs/assets/templates/prd-glossary.md\",\n \"docs/assets/templates/prd-index.md\",\n \"docs/assets/templates/prd-overview.md\",\n \"docs/assets/templates/prd-reference.md\",\n \"docs/assets/templates/prd-risk-register.md\",\n \"docs/assets/templates/prd-subsystem.md\",\n];\n\nconst WORK_TEMPLATE_PATHS = [\n \"docs/assets/templates/work-index.md\",\n \"docs/assets/templates/work-phase.md\",\n];\n\nconst ALWAYS_TEMPLATE_PATHS = [\n \"docs/assets/templates/guide-developer.md\",\n \"docs/assets/templates/guide-user.md\",\n \"docs/assets/templates/history-record.md\",\n];\n\nconst REQUIRED_REFERENCE_PATHS = {\n designs: [\"docs/assets/references/design-workflow.md\", \"docs/assets/references/design-contract.md\"],\n plans: [\n \"docs/assets/references/planning-workflow.md\",\n \"docs/assets/references/output-contract.md\",\n \"docs/assets/references/prd-change-management.md\",\n ],\n prd: [\n \"docs/assets/references/execution-workflow.md\",\n \"docs/assets/references/output-contract.md\",\n \"docs/assets/references/prd-change-management.md\",\n ],\n work: [\n \"docs/assets/references/execution-workflow.md\",\n \"docs/assets/references/output-contract.md\",\n \"docs/assets/references/prd-change-management.md\",\n ],\n} as const;\n\nconst ALWAYS_REFERENCE_PATHS = [\n \"docs/assets/references/guide-contract.md\",\n \"docs/assets/references/wave-model.md\",\n \"docs/assets/references/history-record-contract.md\",\n \"docs/assets/references/commit-message-convention.md\",\n \"docs/assets/references/path-and-link-hygiene.md\",\n];\n\nconst ALWAYS_SCRIPT_PATHS = [\".make-docs/scripts/check_path_hygiene.py\"];\n\nexport function profileHasCapabilities(\n profile: InstallProfile,\n capabilities: Capability[],\n): boolean {\n return capabilities.every(\n (capability) => profile.capabilityState[capability].effectiveSelection,\n );\n}\n\nexport function getPromptPaths(profile: InstallProfile): string[] {\n return PROMPT_RULES.filter((rule) => profileHasCapabilities(profile, rule.requires)).map(\n (rule) => rule.relativePath,\n );\n}\n\nexport function getScriptPaths(_profile: InstallProfile): string[] {\n return [...ALWAYS_SCRIPT_PATHS];\n}\n\nexport function getTemplatePaths(profile: InstallProfile): string[] {\n const paths = new Set<string>();\n\n for (const templatePath of ALWAYS_TEMPLATE_PATHS) {\n paths.add(templatePath);\n }\n\n if (profile.capabilityState.designs.effectiveSelection) {\n paths.add(\"docs/assets/templates/design.md\");\n }\n\n if (profile.capabilityState.plans.effectiveSelection) {\n for (const templatePath of PLAN_TEMPLATE_PATHS) {\n paths.add(templatePath);\n }\n }\n\n if (profile.capabilityState.prd.effectiveSelection) {\n for (const templatePath of PRD_TEMPLATE_PATHS) {\n paths.add(templatePath);\n }\n }\n\n if (profile.capabilityState.work.effectiveSelection) {\n for (const templatePath of WORK_TEMPLATE_PATHS) {\n paths.add(templatePath);\n }\n }\n\n return Array.from(paths).sort();\n}\n\nexport function getReferencePaths(profile: InstallProfile): string[] {\n const paths = new Set<string>();\n\n for (const referencePath of ALWAYS_REFERENCE_PATHS) {\n paths.add(referencePath);\n }\n\n for (const capability of Object.keys(REQUIRED_REFERENCE_PATHS) as Capability[]) {\n if (profile.capabilityState[capability].effectiveSelection) {\n for (const referencePath of REQUIRED_REFERENCE_PATHS[capability]) {\n paths.add(referencePath);\n }\n }\n }\n\n if (profile.effectiveCapabilities.length > 0) {\n paths.add(\"docs/assets/references/harness-capability-matrix.md\");\n }\n\n return Array.from(paths).sort();\n}\n\nexport function getReferenceDirInstalled(profile: InstallProfile): boolean {\n return getReferencePaths(profile).length > 0;\n}\n\nexport function getTemplateDirInstalled(profile: InstallProfile): boolean {\n return getTemplatePaths(profile).length > 0;\n}\n\nexport function getPromptsDirInstalled(profile: InstallProfile): boolean {\n return getPromptPaths(profile).length > 0;\n}\n","import { isFullDefaultProfile } from \"./profile\";\nimport { getPromptPaths } from \"./rules\";\nimport type { InstallProfile } from \"./types\";\nimport { formatInlineList, readPackageFile } from \"./utils\";\n\nconst ROOT_INSTRUCTIONS = new Set([\"AGENTS.md\", \"CLAUDE.md\"]);\nconst DOCS_ROUTER_INSTRUCTIONS = new Set([\"docs/AGENTS.md\", \"docs/CLAUDE.md\"]);\nconst TEMPLATE_ROUTER_INSTRUCTIONS = new Set([\n \"docs/assets/templates/AGENTS.md\",\n \"docs/assets/templates/CLAUDE.md\",\n]);\nconst PROMPTS_ROUTER_INSTRUCTIONS = new Set([\n \"docs/assets/prompts/AGENTS.md\",\n \"docs/assets/prompts/CLAUDE.md\",\n]);\nconst REFERENCES_ROUTER_INSTRUCTIONS = new Set([\n \"docs/assets/references/AGENTS.md\",\n \"docs/assets/references/CLAUDE.md\",\n]);\nconst ARCHIVE_ROUTER_INSTRUCTIONS = new Set([\n \"docs/assets/archive/AGENTS.md\",\n \"docs/assets/archive/CLAUDE.md\",\n]);\nconst ASSETS_ROUTER_INSTRUCTIONS = new Set([\n \"docs/assets/AGENTS.md\",\n \"docs/assets/CLAUDE.md\",\n \"docs/assets/history/AGENTS.md\",\n \"docs/assets/history/CLAUDE.md\",\n]);\nconst DESIGN_REFERENCE_RENDERERS = new Set([\n \"docs/assets/references/design-workflow.md\",\n \"docs/assets/references/design-contract.md\",\n \"docs/assets/templates/design.md\",\n]);\nconst GUIDES_ROUTER_INSTRUCTIONS = new Set([\n \"docs/guides/AGENTS.md\",\n \"docs/guides/CLAUDE.md\",\n]);\n\nexport function isBuildablePath(relativePath: string): boolean {\n return (\n ROOT_INSTRUCTIONS.has(relativePath) ||\n DOCS_ROUTER_INSTRUCTIONS.has(relativePath) ||\n TEMPLATE_ROUTER_INSTRUCTIONS.has(relativePath) ||\n PROMPTS_ROUTER_INSTRUCTIONS.has(relativePath) ||\n REFERENCES_ROUTER_INSTRUCTIONS.has(relativePath) ||\n ARCHIVE_ROUTER_INSTRUCTIONS.has(relativePath) ||\n ASSETS_ROUTER_INSTRUCTIONS.has(relativePath) ||\n DESIGN_REFERENCE_RENDERERS.has(relativePath) ||\n GUIDES_ROUTER_INSTRUCTIONS.has(relativePath)\n );\n}\n\nexport function renderBuildableAsset(relativePath: string, profile: InstallProfile): string {\n if (isFullDefaultProfile(profile)) {\n return readPackageFile(relativePath);\n }\n\n if (ROOT_INSTRUCTIONS.has(relativePath)) {\n return readPackageFile(relativePath);\n }\n\n switch (relativePath) {\n case \"docs/AGENTS.md\":\n case \"docs/CLAUDE.md\":\n return renderDocsRouter(profile);\n case \"docs/assets/templates/AGENTS.md\":\n case \"docs/assets/templates/CLAUDE.md\":\n return renderTemplatesRouter(profile);\n case \"docs/assets/prompts/AGENTS.md\":\n case \"docs/assets/prompts/CLAUDE.md\":\n return renderPromptsRouter(profile);\n case \"docs/assets/references/AGENTS.md\":\n case \"docs/assets/references/CLAUDE.md\":\n return readPackageFile(relativePath);\n case \"docs/assets/archive/AGENTS.md\":\n case \"docs/assets/archive/CLAUDE.md\":\n return readPackageFile(relativePath);\n case \"docs/assets/AGENTS.md\":\n case \"docs/assets/CLAUDE.md\":\n return renderAssetsRouter();\n case \"docs/assets/history/AGENTS.md\":\n case \"docs/assets/history/CLAUDE.md\":\n return renderHistoryAssetsRouter();\n case \"docs/assets/references/design-workflow.md\":\n return renderDesignWorkflow(profile);\n case \"docs/assets/references/design-contract.md\":\n return renderDesignContract(profile);\n case \"docs/assets/templates/design.md\":\n return renderDesignTemplate(profile);\n case \"docs/guides/AGENTS.md\":\n case \"docs/guides/CLAUDE.md\":\n return renderGuidesRouter(profile);\n default:\n throw new Error(`No buildable renderer registered for ${relativePath}.`);\n }\n}\n\nfunction renderDocsRouter(profile: InstallProfile): string {\n const lines = [\n \"# Documentation Router\",\n \"\",\n \"Use `docs/` only as a router. Do not create generated files directly in this directory.\",\n \"- Source Markdown uses semantic line breaks; for path and link hygiene, use project-relative paths and relative Markdown links, and read `docs/assets/references/path-and-link-hygiene.md` when auditing or deciding whether an absolute path is warranted.\",\n ];\n\n if (profile.capabilityState.designs.effectiveSelection) {\n lines.push(\n \"- For design docs, read `docs/assets/references/design-workflow.md`, `docs/assets/references/design-contract.md`, and `docs/assets/templates/design.md`, then continue in `docs/designs/`.\",\n );\n }\n\n if (profile.capabilityState.plans.effectiveSelection) {\n lines.push(\n \"- For plans, read `docs/assets/references/planning-workflow.md` and the selected plan template in `docs/assets/templates/`, then continue in `docs/plans/`.\",\n );\n }\n\n if (\n profile.capabilityState.prd.effectiveSelection &&\n profile.capabilityState.work.effectiveSelection\n ) {\n lines.push(\n \"- For PRD or work generation, read `docs/assets/references/execution-workflow.md`, `docs/assets/references/output-contract.md`, and the selected template in `docs/assets/templates/`, then continue in `docs/prd/` or `docs/work/`; work phase tasks use `- [ ] t1: ...` checkbox items and acceptance criteria use plain bullets.\",\n );\n } else if (profile.capabilityState.prd.effectiveSelection) {\n lines.push(\n \"- For PRD generation, read `docs/assets/references/execution-workflow.md`, `docs/assets/references/output-contract.md`, and the selected template in `docs/assets/templates/`, then continue in `docs/prd/`.\",\n );\n }\n\n if (\n profile.capabilityState.plans.effectiveSelection ||\n profile.capabilityState.prd.effectiveSelection ||\n profile.capabilityState.work.effectiveSelection\n ) {\n lines.push(\n profile.capabilityState.prd.effectiveSelection || profile.capabilityState.work.effectiveSelection\n ? \"- For requirement changes, also read `docs/assets/references/prd-change-management.md` before choosing change templates or delta outputs.\"\n : \"- For requirement-change plans, also read `docs/assets/references/prd-change-management.md` before choosing the change-planning template.\",\n );\n }\n\n if (profile.capabilityState.prd.effectiveSelection) {\n lines.push(\n \"- For gaps, drift, unresolved questions, risks, decisions, or closeout findings, first update `docs/prd/03-open-questions-and-risk-register.md` when it exists; do not create separate questions, decisions, risks, gaps, or architecture-decision files unless the user explicitly asks.\",\n );\n }\n\n lines.push(\n \"- For guides, continue in `docs/guides/`. Before writing, read `docs/assets/references/guide-contract.md`, inspect existing guides for overlap, choose `developer`, `user`, `both`, `update-existing`, `link-only`, or `none`, and use the matching template (`docs/assets/templates/guide-developer.md` or `docs/assets/templates/guide-user.md`).\",\n \"- After guide work, reconcile overlapping existing guides with reciprocal links, `related` frontmatter, or concise supplemental context when it improves discoverability.\",\n \"- Use `## Future Coverage` inside guides for downstream-dependent guide updates. Do not create design docs, architecture decisions, or PRD risk-register items solely to remember future guide work.\",\n \"- For history records, continue in `docs/assets/history/` — read `docs/assets/references/history-record-contract.md` and `docs/assets/templates/history-record.md` before writing.\",\n );\n\n if (getPromptPaths(profile).length > 0) {\n lines.push(\n \"- For reusable prompt starters, use `docs/assets/prompts/`; prompts are optional starters, not authority.\",\n );\n }\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction renderGuidesRouter(profile: InstallProfile): string {\n return [\n \"# Guides for Devs and Users\",\n \"\",\n \"Use `docs/guides` only as a router. Do not create generated files directly in this directory.\",\n \"\",\n \"- Before writing any guide, read `docs/assets/references/guide-contract.md`, inspect existing guides for overlap, and decide whether the right outcome is `developer`, `user`, `both`, `update-existing`, `link-only`, or `none`.\",\n \"- **User guides** are stored in `docs/guides/user/`. They explain the shipped product from a user's perspective, from novice orientation through advanced workflows. Use `docs/assets/templates/guide-user.md` when creating one.\",\n \"- **Developer guides** are stored in `docs/guides/developer/`. They help contributors, maintainers, integrators, and operators navigate the codebase, docs, contracts, validation, extension points, and safe-change workflows. Use `docs/assets/templates/guide-developer.md` when creating one.\",\n \"- Prefer updating an existing guide when it already owns the topic. Use cross-links and `related` frontmatter instead of duplicating full guides across audiences.\",\n \"- After creating or updating guides, re-check overlapping guides and add reciprocal links, `related` frontmatter, or concise supplemental context when the new work improves their discoverability.\",\n \"- If current confirmed behavior is useful but downstream work will expand it, write the current coverage now and add `## Future Coverage` for the blocked guide update.\",\n \"- Do not create design docs, architecture decisions, or PRD risk-register items solely to remember future guide work.\",\n \"- History records are not guides. Route them through `docs/assets/history/` instead.\",\n \"- If the `docs/guides/user` or `docs/guides/developer` directories do not exist, create them ONLY when first writing a guide that belongs in the specific sub-folder.\",\n \"\",\n \"Documentation must be easy to understand, easy to use, and easy to follow, with links to supporting sections or documents where necessary and where possible.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderAssetsRouter(): string {\n return [\n \"# Document Assets Router\",\n \"\",\n \"This router describes the target `docs/assets/` document-resource namespace.\",\n \"\",\n \"- Archive records belong in `docs/assets/archive/`.\",\n \"- History records belong in `docs/assets/history/`; read `docs/assets/references/history-record-contract.md` and `docs/assets/templates/history-record.md` before writing.\",\n \"- Reusable prompts, references, and templates belong in `docs/assets/prompts/`, `docs/assets/references/`, and `docs/assets/templates/`.\",\n \"- make-docs runtime state does not belong under `docs/assets/`; canonical state lives at `.make-docs/manifest.json` and `.make-docs/conflicts/<run-id>/`.\",\n \"- Do not create `docs/assets/config/`, `docs/assets/state/`, `docs/assets/manifest.json`, or `docs/assets/conflicts/`.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderHistoryAssetsRouter(): string {\n return [\n \"# History Assets Router\",\n \"\",\n \"This directory stores session history records.\",\n \"\",\n \"- Before writing, read `docs/assets/references/history-record-contract.md` and `docs/assets/templates/history-record.md`.\",\n \"- When W/R/P is known, create records at `docs/assets/history/YYYY-MM-DD-w{W}-r{R}-p{P}-<slug>.md`.\",\n \"- If only W/R is known, create records at `docs/assets/history/YYYY-MM-DD-w{W}-r{R}-<slug>.md`.\",\n \"- If no coordinate is known, create records at `docs/assets/history/YYYY-MM-DD-<slug>.md`.\",\n \"- Keep stage and task detail only in `coordinate` frontmatter, not filenames.\",\n \"- Include only known frontmatter fields; do not invent unknown client, model, or provider values.\",\n \"- Keep records concise: breadcrumbs for a future auditor, not live logs.\",\n \"- Use relative Markdown links when referencing files touched during the session.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderTemplatesRouter(profile: InstallProfile): string {\n const templateFamilies: string[] = [];\n\n if (profile.capabilityState.designs.effectiveSelection) {\n templateFamilies.push(\"`design.md` for design docs\");\n }\n templateFamilies.push(\"`guide-developer.md` and `guide-user.md` for guides\");\n\n const wildcardFamilies: string[] = [];\n if (profile.capabilityState.plans.effectiveSelection) {\n wildcardFamilies.push(\"`plan-*`\");\n }\n if (profile.capabilityState.prd.effectiveSelection) {\n wildcardFamilies.push(\"`prd-*`\");\n }\n if (profile.capabilityState.work.effectiveSelection) {\n wildcardFamilies.push(\"`work-*`\");\n }\n\n if (wildcardFamilies.length > 0) {\n templateFamilies.push(\n `the matching ${formatInlineList(wildcardFamilies)} template for the target artifact`,\n );\n }\n\n const usageLine =\n templateFamilies.length > 0\n ? `- Use ${formatInlineList(templateFamilies)}.`\n : \"- Install at least one documentation capability before using templates.\";\n\n return [\n \"# Templates Router\",\n \"\",\n \"This directory contains structural starting points for generated docs.\",\n \"- Copy the relevant template shape into the target output file; do not write outputs here.\",\n usageLine,\n \"- Resolve workflow and contract questions in `docs/assets/references/`, then continue in the target output directory router.\",\n \"- Do not modify template files unless the user explicitly asks.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderPromptsRouter(profile: InstallProfile): string {\n const outputs: string[] = [];\n\n if (profile.capabilityState.plans.effectiveSelection) {\n outputs.push(\"plans\");\n }\n if (profile.capabilityState.prd.effectiveSelection) {\n outputs.push(\"PRDs\");\n }\n if (profile.capabilityState.work.effectiveSelection) {\n outputs.push(\"work backlogs\");\n }\n if (profile.capabilityState.designs.effectiveSelection) {\n outputs.push(\"design docs\");\n }\n\n const outputText =\n outputs.length > 0\n ? `- Do not write generated ${formatInlineList(outputs)} here.`\n : \"- Do not write generated outputs here.\";\n\n return [\n \"# Prompts Router\",\n \"\",\n \"This directory stores reusable prompt starters, not authoritative rules and not generated outputs.\",\n \"- Use it only when the user wants a stored prompt or a reusable workflow kickoff.\",\n \"- Keep placeholder tokens explicit unless the user asks to instantiate them.\",\n \"- When executing a prompt, read the target workflow in `docs/assets/references/`, the matching template in `docs/assets/templates/`, and the router in the target output directory.\",\n outputText,\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderDesignWorkflow(profile: InstallProfile): string {\n if (\n profile.capabilityState.plans.effectiveSelection &&\n hasDesignPlanningPrompts(profile)\n ) {\n return readPackageFile(\"docs/assets/references/design-workflow.md\");\n }\n\n if (profile.capabilityState.plans.effectiveSelection) {\n return [\n \"# Design Workflow\",\n \"\",\n \"## Purpose\",\n \"\",\n \"Use this workflow when the user wants to turn a request into one or more design docs before planning, PRD generation, or backlog generation.\",\n \"\",\n \"This workflow ends with design docs in `docs/designs/` using the form `docs/designs/YYYY-MM-DD-<slug>.md`. It does not draft a plan.\",\n \"\",\n \"## Preflight\",\n \"\",\n \"Before writing:\",\n \"\",\n \"1. Inspect `docs/designs/` for related design docs.\",\n \"2. Inspect related plans, PRD docs, or work backlogs only as needed for context or route classification.\",\n \"3. Determine whether the request belongs to the same decision area as an existing design.\",\n \"4. Choose whether to update an existing design or create a new dated design doc.\",\n \"\",\n \"## Create Vs Update Rules\",\n \"\",\n \"- Prefer updating an existing design when the request clearly concerns the same decision area and the existing doc can absorb the change without obscuring prior intent.\",\n \"- Create a new dated design doc when no clear related design exists, when the request spans a distinct decision area, or when a substantial direction change would make the existing design misleading.\",\n \"- One design doc is the default output unit. Create more than one only when the request clearly spans multiple distinct decision areas.\",\n \"\",\n \"## Lineage Rules\",\n \"\",\n \"- If a generated update materially changes prior design intent, add an optional `## Design Lineage` section before `## Intended Follow-On`.\",\n \"- Use `## Design Lineage` to record:\",\n \" - `Update Mode:` `updated-existing` or `new-doc-related`\",\n \" - `Prior Design Docs:` relative links to the earlier design docs\",\n \" - `Reason:` a short explanation of why the prior design was updated or why a related new design doc was needed\",\n \"- If the request is only a minor clarification and does not materially change prior design intent, the lineage section is optional.\",\n \"\",\n \"## Intended Follow-On Rules\",\n \"\",\n \"- Every generated design doc must include `## Intended Follow-On`.\",\n \"- Allowed `Route` values:\",\n \" - `baseline-plan`\",\n \" - `change-plan`\",\n \"- Planning prompt links are unavailable in this profile because the required planning assets are not installed locally.\",\n \"- Record:\",\n \" - `Next Step:` rerun `npx @brucewaynedecoy/make-docs@next reconfigure` and enable `plans` if you want local planning prompts\",\n \" - `Why:` a short explanation of why the selected route is the correct downstream workflow\",\n \"\",\n \"## Stop Rule\",\n \"\",\n \"- Stop after the design docs are created or updated.\",\n \"- Do not draft a plan as part of the request-to-design workflow.\",\n \"\",\n \"## Validation Checklist\",\n \"\",\n \"Before closing the task, confirm:\",\n \"\",\n \"1. The output lives in `docs/designs/` and follows `YYYY-MM-DD-<slug>.md` naming.\",\n \"2. The generated design uses the required design template structure.\",\n \"3. The create-vs-update choice is justified by the current design tree.\",\n \"4. `## Design Lineage` is present when the design materially updates prior intent.\",\n \"5. `## Intended Follow-On` uses `baseline-plan` or `change-plan` without linking to missing prompt files.\",\n \"\",\n ].join(\"\\n\");\n }\n\n return [\n \"# Design Workflow\",\n \"\",\n \"## Purpose\",\n \"\",\n \"Use this workflow when the user wants to turn a request into one or more design docs before later planning work.\",\n \"\",\n \"This workflow ends with design docs in `docs/designs/` using the form `docs/designs/YYYY-MM-DD-<slug>.md`. Local planning assets are not installed in this profile.\",\n \"\",\n \"## Preflight\",\n \"\",\n \"Before writing:\",\n \"\",\n \"1. Inspect `docs/designs/` for related design docs.\",\n \"2. Inspect related plans, PRD docs, or work backlogs only as needed for context or route classification.\",\n \"3. Determine whether the request belongs to the same decision area as an existing design.\",\n \"4. Choose whether to update an existing design or create a new dated design doc.\",\n \"\",\n \"## Create Vs Update Rules\",\n \"\",\n \"- Prefer updating an existing design when the request clearly concerns the same decision area and the existing doc can absorb the change without obscuring prior intent.\",\n \"- Create a new dated design doc when no clear related design exists, when the request spans a distinct decision area, or when a substantial direction change would make the existing design misleading.\",\n \"- One design doc is the default output unit. Create more than one only when the request clearly spans multiple distinct decision areas.\",\n \"\",\n \"## Lineage Rules\",\n \"\",\n \"- If a generated update materially changes prior design intent, add an optional `## Design Lineage` section before `## Intended Follow-On`.\",\n \"- Use `## Design Lineage` to record:\",\n \" - `Update Mode:` `updated-existing` or `new-doc-related`\",\n \" - `Prior Design Docs:` relative links to the earlier design docs\",\n \" - `Reason:` a short explanation of why the prior design was updated or why a related new design doc was needed\",\n \"- If the request is only a minor clarification and does not materially change prior design intent, the lineage section is optional.\",\n \"\",\n \"## Intended Follow-On Rules\",\n \"\",\n \"- Every generated design doc must include `## Intended Follow-On`.\",\n \"- Because the `plans` capability is not installed in this profile, do not link to prompt starter files that are not installed locally.\",\n \"- Record the follow-on as:\",\n \" - `Route:` `planning-not-installed`\",\n \" - `Next Step:` rerun `npx @brucewaynedecoy/make-docs@next reconfigure` and enable `plans`\",\n \" - `Why:` a short explanation of whether the next step should be baseline planning or change planning once planning assets are installed\",\n \"\",\n \"## Stop Rule\",\n \"\",\n \"- Stop after the design docs are created or updated.\",\n \"- Do not draft a plan as part of the request-to-design workflow.\",\n \"\",\n \"## Validation Checklist\",\n \"\",\n \"Before closing the task, confirm:\",\n \"\",\n \"1. The output lives in `docs/designs/` and follows `YYYY-MM-DD-<slug>.md` naming.\",\n \"2. The generated design uses the required design template structure.\",\n \"3. The create-vs-update choice is justified by the current design tree.\",\n \"4. `## Design Lineage` is present when the design materially updates prior intent.\",\n \"5. `## Intended Follow-On` records that local planning assets are not installed and names rerunning the installer as the next step.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderDesignContract(profile: InstallProfile): string {\n if (\n profile.capabilityState.plans.effectiveSelection &&\n hasDesignPlanningPrompts(profile)\n ) {\n return readPackageFile(\"docs/assets/references/design-contract.md\");\n }\n\n if (profile.capabilityState.plans.effectiveSelection) {\n return [\n \"# Design Contract\",\n \"\",\n \"## Purpose\",\n \"\",\n \"Use this contract for agent-generated design docs under `docs/designs/`.\",\n \"\",\n \"User-authored design docs may not fully conform. Apply this contract to newly generated design docs and to substantial agent-authored updates.\",\n \"\",\n \"## Required Path\",\n \"\",\n \"- `docs/designs/YYYY-MM-DD-<slug>.md`\",\n \"\",\n \"`YYYY-MM-DD` is today's date (never backdated). `<slug>` is lowercase, hyphens only.\",\n \"\",\n \"## Required Headings\",\n \"\",\n \"Generated design docs must include:\",\n \"\",\n \"- `## Purpose`\",\n \"- `## Context`\",\n \"- `## Decision`\",\n \"- `## Alternatives Considered`\",\n \"- `## Consequences`\",\n \"- `## Intended Follow-On`\",\n \"\",\n \"## Intended Follow-On Contract\",\n \"\",\n \"The `## Intended Follow-On` section must include:\",\n \"\",\n \"- `Route:` `baseline-plan` or `change-plan`\",\n \"- `Next Step:` rerun `npx @brucewaynedecoy/make-docs@next reconfigure` and enable `plans` if you want local planning prompts\",\n \"- `Why:` a short explanation of why that route is the correct downstream workflow\",\n \"\",\n \"Do not add a `Next Prompt` link when the required planning prompts are not installed locally.\",\n \"\",\n \"## Optional Design Lineage\",\n \"\",\n \"Add `## Design Lineage` when a generated design materially updates prior design intent or when a new design doc is closely related to an earlier design.\",\n \"\",\n \"When present, include:\",\n \"\",\n \"- `Update Mode:` `updated-existing` or `new-doc-related`\",\n \"- `Prior Design Docs:` relative Markdown links\",\n \"- `Reason:` a short explanation of the lineage relationship\",\n \"\",\n \"## Link Rules\",\n \"\",\n \"- Use relative Markdown links between design docs and related plans, PRD docs, or work items.\",\n \"- If the required planning prompts are not installed locally, do not create broken prompt links.\",\n \"\",\n ].join(\"\\n\");\n }\n\n return [\n \"# Design Contract\",\n \"\",\n \"## Purpose\",\n \"\",\n \"Use this contract for agent-generated design docs under `docs/designs/`.\",\n \"\",\n \"User-authored design docs may not fully conform. Apply this contract to newly generated design docs and to substantial agent-authored updates.\",\n \"\",\n \"## Required Path\",\n \"\",\n \"- `docs/designs/YYYY-MM-DD-{{DESIGN NAME}}.md`\",\n \"\",\n \"## Required Headings\",\n \"\",\n \"Generated design docs must include:\",\n \"\",\n \"- `## Purpose`\",\n \"- `## Context`\",\n \"- `## Decision`\",\n \"- `## Alternatives Considered`\",\n \"- `## Consequences`\",\n \"- `## Intended Follow-On`\",\n \"\",\n \"## Intended Follow-On Contract\",\n \"\",\n \"The `## Intended Follow-On` section must include:\",\n \"\",\n \"- `Route:` `planning-not-installed`\",\n \"- `Next Step:` rerun `npx @brucewaynedecoy/make-docs@next reconfigure` and enable `plans` if you want local planning prompts and templates\",\n \"- `Why:` a short explanation of what planning should happen later\",\n \"\",\n \"Do not add a `Next Prompt` link when planning assets are not installed locally.\",\n \"\",\n \"## Optional Design Lineage\",\n \"\",\n \"Add `## Design Lineage` when a generated design materially updates prior design intent or when a new design doc is closely related to an earlier design.\",\n \"\",\n \"When present, include:\",\n \"\",\n \"- `Update Mode:` `updated-existing` or `new-doc-related`\",\n \"- `Prior Design Docs:` relative Markdown links\",\n \"- `Reason:` a short explanation of the lineage relationship\",\n \"\",\n \"## Link Rules\",\n \"\",\n \"- Use relative Markdown links between design docs and related plans, PRD docs, or work items.\",\n \"- If planning assets are not installed locally, do not create broken prompt links.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderDesignTemplate(profile: InstallProfile): string {\n if (profile.capabilityState.plans.effectiveSelection) {\n return readPackageFile(\"docs/assets/templates/design.md\");\n }\n\n return [\n \"# {{TITLE}}\",\n \"\",\n \"> Filename: `YYYY-MM-DD-<slug>.md`. See `docs/assets/references/design-contract.md` for naming and structural rules.\",\n \"\",\n \"## Purpose\",\n \"\",\n \"Explain what decision this document captures and why it exists.\",\n \"\",\n \"## Context\",\n \"\",\n \"Describe the problem, constraints, forces, and existing conditions that shape the decision.\",\n \"\",\n \"## Decision\",\n \"\",\n \"Describe the chosen approach clearly enough that planning can proceed from it once planning assets are installed.\",\n \"\",\n \"## Alternatives Considered\",\n \"\",\n \"List the meaningful alternatives and why they were not chosen.\",\n \"\",\n \"## Consequences\",\n \"\",\n \"Describe outcomes, trade-offs, risks, and follow-on implications.\",\n \"\",\n \"## Intended Follow-On\",\n \"\",\n \"- Route: planning-not-installed\",\n \"- Next Step: Re-run `npx @brucewaynedecoy/make-docs@next reconfigure` and enable `plans` to install local planning prompts and templates.\",\n \"- Why: Explain whether this design should later feed a baseline plan or a change plan.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction hasDesignPlanningPrompts(profile: InstallProfile): boolean {\n return getPromptPaths(profile).some(\n (relativePath) =>\n relativePath === \"docs/assets/prompts/designs-to-plan.prompt.md\" ||\n relativePath === \"docs/assets/prompts/designs-to-plan-change.prompt.md\",\n );\n}\n","import {\n getPromptPaths,\n getPromptsDirInstalled,\n getReferenceDirInstalled,\n getReferencePaths,\n getScriptPaths,\n getTemplateDirInstalled,\n getTemplatePaths,\n} from \"./rules\";\nimport { renderBuildableAsset, isBuildablePath } from \"./renderers\";\nimport type { InstallProfile, InstructionKind, ResolvedAsset } from \"./types\";\nimport { getActiveInstructionKinds } from \"./types\";\nimport { readPackageFile } from \"./utils\";\n\nfunction buildAsset(profile: InstallProfile, relativePath: string): ResolvedAsset {\n const assetClass = isBuildablePath(relativePath) ? \"buildable\" : \"scoped-static\";\n const content =\n assetClass === \"buildable\"\n ? renderBuildableAsset(relativePath, profile)\n : readPackageFile(relativePath);\n\n return {\n relativePath,\n assetClass,\n sourceId:\n assetClass === \"buildable\" ? `build:${relativePath}` : `file:${relativePath}`,\n content,\n };\n}\n\nfunction addInstructionAssets(\n profile: InstallProfile,\n activeInstructionKind: InstructionKind,\n relativePaths: Set<string>,\n): void {\n relativePaths.add(activeInstructionKind);\n relativePaths.add(`docs/${activeInstructionKind}`);\n relativePaths.add(`docs/assets/${activeInstructionKind}`);\n relativePaths.add(`docs/assets/history/${activeInstructionKind}`);\n relativePaths.add(`docs/guides/${activeInstructionKind}`);\n relativePaths.add(`docs/assets/archive/${activeInstructionKind}`);\n\n if (profile.capabilityState.designs.effectiveSelection) {\n relativePaths.add(`docs/designs/${activeInstructionKind}`);\n }\n\n if (profile.capabilityState.plans.effectiveSelection) {\n relativePaths.add(`docs/plans/${activeInstructionKind}`);\n }\n\n if (profile.capabilityState.prd.effectiveSelection) {\n relativePaths.add(`docs/prd/${activeInstructionKind}`);\n }\n\n if (profile.capabilityState.work.effectiveSelection) {\n relativePaths.add(`docs/work/${activeInstructionKind}`);\n }\n\n if (getReferenceDirInstalled(profile)) {\n relativePaths.add(`docs/assets/references/${activeInstructionKind}`);\n }\n\n if (getTemplateDirInstalled(profile)) {\n relativePaths.add(`docs/assets/templates/${activeInstructionKind}`);\n }\n\n if (getPromptsDirInstalled(profile)) {\n relativePaths.add(`docs/assets/prompts/${activeInstructionKind}`);\n }\n}\n\nexport function getDesiredAssets(profile: InstallProfile): ResolvedAsset[] {\n const relativePaths = new Set<string>();\n\n for (const referencePath of getReferencePaths(profile)) {\n relativePaths.add(referencePath);\n }\n\n for (const templatePath of getTemplatePaths(profile)) {\n relativePaths.add(templatePath);\n }\n\n for (const promptPath of getPromptPaths(profile)) {\n relativePaths.add(promptPath);\n }\n\n for (const scriptPath of getScriptPaths(profile)) {\n relativePaths.add(scriptPath);\n }\n\n for (const instructionKind of getActiveInstructionKinds(profile.selections)) {\n addInstructionAssets(profile, instructionKind, relativePaths);\n }\n\n return Array.from(relativePaths)\n .sort()\n .map((relativePath) => buildAsset(profile, relativePath));\n}\n","import * as os from \"node:os\";\nimport path from \"node:path\";\nimport { resolveSkillSource } from \"./skill-resolver\";\nimport { loadSkillRegistry, type SkillRegistryEntry } from \"./skill-registry\";\nimport {\n HARNESSES,\n type Harness,\n type InstallSelections,\n type ResolvedAsset,\n} from \"./types\";\nimport { PACKAGE_ROOT } from \"./utils\";\n\nconst HARNESS_SKILL_DIRS: Record<Harness, string> = {\n \"claude-code\": \".claude/skills\",\n codex: \".agents/skills\",\n};\n\nexport interface WizardSkillChoice {\n name: string;\n description: string;\n}\n\nexport async function getDesiredSkillAssets(\n selections: InstallSelections,\n): Promise<ResolvedAsset[]> {\n if (!selections.skills) {\n return [];\n }\n\n const registry = loadSkillRegistry(PACKAGE_ROOT);\n const selectedSkills = new Set(selections.selectedSkills);\n const selectedEntries = registry.skills.filter((entry) =>\n selectedSkills.has(entry.name),\n );\n\n if (selectedEntries.length === 0) {\n return [];\n }\n\n const installRoot = selections.skillScope === \"project\" ? \".\" : os.homedir();\n const desiredAssets = (\n await Promise.all(\n HARNESSES.flatMap((harness) => {\n if (!selections.harnesses[harness]) {\n return [];\n }\n\n return selectedEntries.map((entry) =>\n buildSkillAssets(entry, harness, installRoot),\n );\n }),\n )\n ).flat();\n\n return desiredAssets.sort((left, right) =>\n left.relativePath.localeCompare(right.relativePath),\n );\n}\n\nexport function getRecommendedSkillChoices(): WizardSkillChoice[] {\n const registry = loadSkillRegistry(PACKAGE_ROOT);\n\n const toChoice = (\n entry: Pick<SkillRegistryEntry, \"name\" | \"description\">,\n ): WizardSkillChoice => ({\n name: entry.name,\n description: entry.description,\n });\n\n return registry.skills\n .map(toChoice)\n .sort((left, right) => left.name.localeCompare(right.name));\n}\n\nasync function buildSkillAssets(\n entry: SkillRegistryEntry,\n harness: Harness,\n installRoot: string,\n): Promise<ResolvedAsset[]> {\n const resolvedSkill = await resolveSkillSource(\n entry.source,\n entry.entryPoint,\n entry.assets,\n );\n const skillInstallRoot = getInstallPath(\n installRoot,\n HARNESS_SKILL_DIRS[harness],\n entry.installName,\n );\n\n const desiredAssets: ResolvedAsset[] = [\n {\n relativePath: getInstallPath(skillInstallRoot, entry.entryPoint),\n assetClass: \"static\",\n sourceId: getSkillSourceId(entry, harness),\n content: resolvedSkill.entryPointContent,\n },\n ];\n\n resolvedSkill.assets.forEach((asset) => {\n desiredAssets.push({\n relativePath: getInstallPath(skillInstallRoot, asset.installPath),\n assetClass: \"static\",\n sourceId: getSkillAssetSourceId(harness, entry.name, asset.installPath),\n content:\n typeof asset.content === \"string\"\n ? asset.content\n : asset.content.toString(\"utf8\"),\n });\n });\n\n return desiredAssets;\n}\n\nfunction getInstallPath(...segments: string[]): string {\n return path.join(...segments);\n}\n\nfunction getSkillSourceId(entry: SkillRegistryEntry, harness: Harness): string {\n return `skill:${harness}:${entry.name}`;\n}\n\nfunction getSkillAssetSourceId(\n harness: Harness,\n skillName: string,\n installPath: string,\n): string {\n return `skill-asset:${harness}:${skillName}:${installPath}`;\n}\n","import path from \"node:path\";\nimport type { SkillAssetEntry } from \"./skill-registry\";\n\nconst URL_PROTOCOL = \"url:\";\nconst GITHUB_PROTOCOL = \"github:\";\nconst DEFAULT_GITHUB_REF = \"main\";\nconst RAW_GITHUB_HOST = \"raw.githubusercontent.com\";\n\ninterface ResolvedDirectory {\n location: string;\n virtualPath: string;\n}\n\ninterface ResolvedFile {\n location: string;\n virtualPath: string;\n}\n\nconst remoteTextCache = new Map<string, Promise<string>>();\nconst remoteBinaryCache = new Map<string, Promise<Buffer>>();\n\nexport interface ResolvedSkillAsset {\n installPath: string;\n content: string | Buffer;\n sourcePath: string;\n}\n\nexport interface ResolvedSkill {\n entryPointContent: string;\n assets: ResolvedSkillAsset[];\n}\n\nexport class UnsupportedProtocolError extends Error {\n constructor(public readonly protocol: string) {\n super(`Unsupported skill source protocol: \\`${protocol}\\``);\n this.name = \"UnsupportedProtocolError\";\n }\n}\n\nexport async function resolveSkillSource(\n source: string,\n entryPoint: string,\n assets: SkillAssetEntry[],\n): Promise<ResolvedSkill> {\n const sourceDir = resolveSourceDirectory(source);\n const entryPointFile = resolveRelativeFile(entryPoint, sourceDir);\n const entryPointContent = await readSourceText(entryPointFile);\n\n const resolvedAssets = await Promise.all(\n assets.map(async (asset) => {\n const file = resolveSourceFile(asset.source, sourceDir);\n return {\n installPath: asset.installPath,\n content: isMarkdownPath(file.virtualPath)\n ? await readSourceText(file)\n : await readSourceBinary(file),\n sourcePath: file.virtualPath,\n };\n }),\n );\n\n return {\n entryPointContent,\n assets: resolvedAssets,\n };\n}\n\nfunction resolveSourceDirectory(source: string): ResolvedDirectory {\n if (!isRemoteSource(source)) {\n throw new UnsupportedProtocolError(extractProtocol(source));\n }\n\n const location = normalizeRemoteSource(source, { directory: true });\n return {\n location,\n virtualPath: toRemoteVirtualPath(location),\n };\n}\n\nfunction resolveSourceFile(source: string, baseDir: ResolvedDirectory): ResolvedFile {\n if (isRemoteSource(source)) {\n const location = normalizeRemoteSource(source, { directory: false });\n return {\n location,\n virtualPath: toRemoteVirtualPath(location),\n };\n }\n\n return resolveRelativeFile(source, baseDir);\n}\n\nfunction resolveRelativeFile(relativePath: string, baseDir: ResolvedDirectory): ResolvedFile {\n const nextUrl = new URL(relativePath, ensureTrailingSlash(baseDir.location)).href;\n const location = normalizeRemoteSource(nextUrl, { directory: false });\n return {\n location,\n virtualPath: toRemoteVirtualPath(location),\n };\n}\n\nasync function readSourceText(file: ResolvedFile): Promise<string> {\n return fetchRemoteText(file.location);\n}\n\nasync function readSourceBinary(file: ResolvedFile): Promise<Buffer> {\n return fetchRemoteBinary(file.location);\n}\n\nfunction isRemoteSource(source: string): boolean {\n return (\n source.startsWith(URL_PROTOCOL) ||\n source.startsWith(GITHUB_PROTOCOL) ||\n source.startsWith(\"https://\") ||\n source.startsWith(\"http://\")\n );\n}\n\nfunction normalizeRemoteSource(source: string, options: { directory: boolean }): string {\n if (source.startsWith(GITHUB_PROTOCOL)) {\n return normalizeGithubProtocol(source, options);\n }\n\n const rawSource = source.startsWith(URL_PROTOCOL)\n ? source.slice(URL_PROTOCOL.length)\n : source;\n const url = new URL(rawSource);\n\n if (url.hostname === \"github.com\") {\n return normalizeGithubUrl(url, options);\n }\n\n if (url.hostname === RAW_GITHUB_HOST) {\n return options.directory ? ensureTrailingSlash(url.href) : stripTrailingSlash(url.href);\n }\n\n return options.directory ? ensureTrailingSlash(url.href) : stripTrailingSlash(url.href);\n}\n\nfunction normalizeGithubProtocol(\n source: string,\n options: { directory: boolean },\n): string {\n const rawSource = source.slice(GITHUB_PROTOCOL.length);\n const atIndex = rawSource.lastIndexOf(\"@\");\n const withoutRef = atIndex === -1 ? rawSource : rawSource.slice(0, atIndex);\n const ref = atIndex === -1 ? DEFAULT_GITHUB_REF : rawSource.slice(atIndex + 1);\n const segments = withoutRef.split(\"/\").filter(Boolean);\n\n if (segments.length < 3) {\n throw new Error(\n `GitHub skill source \\`${source}\\` must use github:<owner>/<repo>/<path>[@<ref>]`,\n );\n }\n\n const [owner, repo, ...pathSegments] = segments;\n return buildGithubRawUrl(owner, repo, ref, pathSegments, options.directory);\n}\n\nfunction normalizeGithubUrl(url: URL, options: { directory: boolean }): string {\n const segments = url.pathname.split(\"/\").filter(Boolean);\n\n if (segments.length < 4) {\n throw new Error(\n `GitHub skill source \\`${url.href}\\` must point to a tree or blob URL.`,\n );\n }\n\n const [owner, repo, mode, ref, ...pathSegments] = segments;\n if (mode !== \"tree\" && mode !== \"blob\") {\n throw new Error(\n `GitHub skill source \\`${url.href}\\` must use /tree/ or /blob/ paths.`,\n );\n }\n\n return buildGithubRawUrl(owner, repo, ref, pathSegments, options.directory || mode === \"tree\");\n}\n\nfunction buildGithubRawUrl(\n owner: string,\n repo: string,\n ref: string,\n pathSegments: string[],\n directory: boolean,\n): string {\n const pathname = pathSegments.join(\"/\");\n const base = `https://${RAW_GITHUB_HOST}/${owner}/${repo}/${ref}/${pathname}`;\n return directory ? ensureTrailingSlash(base) : stripTrailingSlash(base);\n}\n\nfunction ensureTrailingSlash(value: string): string {\n return value.endsWith(\"/\") ? value : `${value}/`;\n}\n\nfunction stripTrailingSlash(value: string): string {\n return value.endsWith(\"/\") ? value.slice(0, -1) : value;\n}\n\nfunction toRemoteVirtualPath(source: string): string {\n const url = new URL(source);\n const joined = path.posix.join(\"/\", url.host, url.pathname);\n return joined.endsWith(\"/\") ? joined.slice(0, -1) : joined;\n}\n\nasync function fetchRemoteText(url: string): Promise<string> {\n const cached = remoteTextCache.get(url);\n if (cached) {\n return cached;\n }\n\n const request = fetchRemote(url, \"text\") as Promise<string>;\n remoteTextCache.set(url, request);\n return request;\n}\n\nasync function fetchRemoteBinary(url: string): Promise<Buffer> {\n const cached = remoteBinaryCache.get(url);\n if (cached) {\n return cached;\n }\n\n const request = fetchRemote(url, \"binary\") as Promise<Buffer>;\n remoteBinaryCache.set(url, request);\n return request;\n}\n\nasync function fetchRemote(url: string, mode: \"text\" | \"binary\"): Promise<string | Buffer> {\n const response = await fetch(url, {\n headers: {\n \"User-Agent\": \"make-docs-cli\",\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch skill source \\`${url}\\`: ${response.status} ${response.statusText}`,\n );\n }\n\n if (mode === \"text\") {\n return response.text();\n }\n\n return Buffer.from(await response.arrayBuffer());\n}\n\nfunction isMarkdownPath(filePath: string): boolean {\n return path.posix.extname(filePath).toLowerCase() === \".md\";\n}\n\nfunction extractProtocol(uri: string): string {\n if (/^https?:\\/\\//.test(uri)) {\n const url = new URL(uri);\n return `${url.protocol}//`;\n }\n\n const colon = uri.indexOf(\":\");\n return colon === -1 ? uri : uri.slice(0, colon + 1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAM,MAAM;AACZ,QAAM,MAAM,GAAG,GAAG;AAClB,QAAM,OAAO;AAEb,QAAM,SAAS;AAAA,MACb,GAAGA,IAAGC,IAAG;AACP,YAAI,CAACA,GAAG,QAAO,GAAG,GAAG,GAAGD,KAAI,CAAC;AAC7B,eAAO,GAAG,GAAG,GAAGC,KAAI,CAAC,IAAID,KAAI,CAAC;AAAA,MAChC;AAAA,MACA,KAAKA,IAAGC,IAAG;AACT,YAAI,MAAM;AAEV,YAAID,KAAI,EAAG,QAAO,GAAG,GAAG,GAAG,CAACA,EAAC;AAAA,iBACpBA,KAAI,EAAG,QAAO,GAAG,GAAG,GAAGA,EAAC;AAEjC,YAAIC,KAAI,EAAG,QAAO,GAAG,GAAG,GAAG,CAACA,EAAC;AAAA,iBACpBA,KAAI,EAAG,QAAO,GAAG,GAAG,GAAGA,EAAC;AAEjC,eAAO;AAAA,MACT;AAAA,MACA,IAAI,CAAC,QAAQ,MAAM,GAAG,GAAG,GAAG,KAAK;AAAA,MACjC,MAAM,CAAC,QAAQ,MAAM,GAAG,GAAG,GAAG,KAAK;AAAA,MACnC,SAAS,CAAC,QAAQ,MAAM,GAAG,GAAG,GAAG,KAAK;AAAA,MACtC,UAAU,CAAC,QAAQ,MAAM,GAAG,GAAG,GAAG,KAAK;AAAA,MACvC,UAAU,CAAC,QAAQ,MAAM,GAAG,GAAG,IAAI,OAAO,KAAK;AAAA,MAC/C,UAAU,CAAC,QAAQ,MAAM,GAAG,GAAG,IAAI,OAAO,KAAK;AAAA,MAC/C,MAAM,GAAG,GAAG;AAAA,MACZ,MAAM,GAA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A4B;AACrD,SAAOE,MAAK,KAAK,GAAG,QAAQ;AAC9B;AAEA,SAAS,iBAAiB,OAA2B,SAA0B;AAC7E,SAAO,SAAS,OAAO,IAAI,MAAM,IAAI;AACvC;AAEA,SAAS,sBACP,SACA,WACA,aACQ;AACR,SAAO,eAAe,OAAO,IAAI,SAAS,IAAI,WAAW;AAC3D;","names":["x","y","findCursor","cursor","delta","options","opt","newCursor","maxCursor","clampedCursor","isAmbiguous","x","isFullWidth","isWide","ANSI_RE","CONTROL_RE","TAB_RE","EMOJI_RE","LATIN_RE","MODIFIER_RE","NO_TRUNCATION","getStringTruncatedWidth","input","truncationOptions","widthOptions","LIMIT","ELLIPSIS","ELLIPSIS_WIDTH","ANSI_WIDTH","CONTROL_WIDTH","TAB_WIDTH","AMBIGUOUS_WIDTH","EMOJI_WIDTH","FULL_WIDTH_WIDTH","REGULAR_WIDTH","WIDE_WIDTH","indexPrev","index","length","lengthExtra","truncationEnabled","truncationIndex","truncationLimit","unmatchedStart","unmatchedEnd","width","widthExtra","outer","unmatched","char","codePoint","fastStringWidth","fastStringTruncatedWidth","ESC","CSI","END_CODE","ANSI_ESCAPE_BELL","ANSI_CSI","ANSI_OSC","ANSI_SGR_TERMINATOR","ANSI_ESCAPE_LINK","GROUP_REGEX","getClosingCode","openingCode","wrapAnsiCode","code","wrapAnsiHyperlink","url","wordLengths","words","character","stringWidth","wrapWord","rows","word","columns","characters","isInsideEscape","isInsideLinkEscape","lastRow","visible","currentCharacter","nextCharacter","rawCharacterIndex","characterLength","stringVisibleTrimSpacesRight","string","last","exec","returnValue","escapeCode","escapeUrl","lengths","rowLength","remainingColumns","breaksStartingThisLine","row","preString","pre","currentPre","nextPre","preStringIndex","groups","closingCode","wrapAnsi","line","actions","settings","isActionKey","key","action","settings","value","diffLines","a","b","aLines","bLines","numLines","diff","i","isWindows","CANCEL_SYMBOL","isCancel","setRawMode","input","getColumns","output","getRows","wrapTextWithPrefix","text","prefix","startPrefix","columns","stdout","wrapAnsi","line","index","Prompt","options","trackValue","input","stdin","render","signal","opts","event","params","cb","data","cbs","cleanup","subscriber","resolve","CANCEL_SYMBOL","readline","setRawMode","cursor","char","_key","value","write","key","settings","problem","isActionKey","lines","frame","diff","diffLines","rows","diffOffsetAfter","diffOffsetBefore","diffLine","erase","adjustedDiffLine","newLines","ConfirmPrompt","Prompt","opts","confirm","cursor","Prompt","option","enabledOptions","allSelected","v","value","notSelected","selected","opts","cursor","findCursor","char","key","SelectPrompt","Prompt","opts","initialCursor","value","cursor","findCursor","key","isUnicodeSupported","process","unicode","unicodeOr","c","fallback","unicode","S_STEP_ACTIVE","S_STEP_CANCEL","S_STEP_ERROR","S_STEP_SUBMIT","S_BAR_START","S_BAR","S_BAR_END","S_BAR_START_RIGHT","S_BAR_END_RIGHT","S_RADIO_ACTIVE","S_RADIO_INACTIVE","S_CHECKBOX_ACTIVE","S_CHECKBOX_SELECTED","S_CHECKBOX_INACTIVE","S_PASSWORD_MASK","S_BAR_H","S_CORNER_TOP_RIGHT","S_CONNECT_LEFT","S_CORNER_BOTTOM_RIGHT","S_CORNER_BOTTOM_LEFT","S_CORNER_TOP_LEFT","S_INFO","S_SUCCESS","S_WARN","S_ERROR","symbol","state","styleText","symbolBar","isAmbiguous","x","isFullWidth","isWide","ANSI_RE","CONTROL_RE","TAB_RE","EMOJI_RE","LATIN_RE","MODIFIER_RE","NO_TRUNCATION","getStringTruncatedWidth","input","truncationOptions","widthOptions","LIMIT","ELLIPSIS","ELLIPSIS_WIDTH","ANSI_WIDTH","CONTROL_WIDTH","TAB_WIDTH","AMBIGUOUS_WIDTH","EMOJI_WIDTH","FULL_WIDTH_WIDTH","REGULAR_WIDTH","WIDE_WIDTH","indexPrev","index","length","lengthExtra","truncationEnabled","truncationIndex","truncationLimit","unmatchedStart","unmatchedEnd","width","widthExtra","outer","unmatched","char","codePoint","fastStringWidth","options","fastStringTruncatedWidth","ESC","CSI","END_CODE","ANSI_ESCAPE_BELL","ANSI_CSI","ANSI_OSC","ANSI_SGR_TERMINATOR","ANSI_ESCAPE_LINK","GROUP_REGEX","getClosingCode","openingCode","wrapAnsiCode","code","wrapAnsiHyperlink","url","wordLengths","words","character","stringWidth","wrapWord","rows","word","columns","characters","isInsideEscape","isInsideLinkEscape","lastRow","visible","currentCharacter","nextCharacter","rawCharacterIndex","characterLength","stringVisibleTrimSpacesRight","string","last","exec","returnValue","escapeCode","escapeUrl","lengths","rowLength","remainingColumns","breaksStartingThisLine","row","preString","pre","currentPre","nextPre","preStringIndex","groups","closingCode","wrapAnsi","line","trimLines","initialLineCount","startIndex","endIndex","maxLines","lineCount","removals","i","group","limitOptions","cursor","style","output","maxItems","columnPadding","rowPadding","maxWidth","getColumns","getRows","overflowFormat","outputMaxItems","computedMaxItems","slidingWindowLocation","shouldRenderTopEllipsis","shouldRenderBottomEllipsis","slidingWindowLocationEnd","lineGroups","slidingWindowLocationWithEllipsis","slidingWindowLocationEndWithEllipsis","wrappedLines","precedingRemovals","followingRemovals","newLineCount","cursorGroupIndex","trimLinesLocal","result","lineGroup","confirm","opts","active","inactive","ConfirmPrompt","hasGuide","settings","title","styleText","S_BAR","symbol","value","submitPrefix","cancelPrefix","defaultPrefix","defaultPrefixEnd","S_BAR_END","S_RADIO_ACTIVE","S_RADIO_INACTIVE","intro","title","opts","output","prefix","settings","styleText","S_BAR_START","outro","message","S_BAR","S_BAR_END","computeLabel","label","format","line","multiselect","opt","option","state","S_CHECKBOX_INACTIVE","str","S_CHECKBOX_ACTIVE","S_CHECKBOX_SELECTED","text","required","MultiSelectPrompt","selected","wrappedMessage","wrapTextWithPrefix","symbolBar","symbol","value","styleOption","active","submitText","optionValue","wrappedSubmitText","wrappedLabel","footer","ln","i","titleLineCount","footerLineCount","limitOptions","defaultNoteFormatter","wrapWithFormat","width","wrapMsg","wrapAnsi","maxWidthNormal","sum","stringWidth","maxWidthFormat","wrapWidth","note","process","hasGuide","lines","getColumns","titleLen","len","msg","leadingBorder","bottomLeft","S_CONNECT_LEFT","S_CORNER_BOTTOM_LEFT","S_STEP_SUBMIT","S_BAR_H","S_CORNER_TOP_RIGHT","S_CORNER_BOTTOM_RIGHT","S_PROGRESS_CHAR","unicodeOr","computeLabel","label","format","line","select","opts","opt","option","state","styleText","S_RADIO_INACTIVE","text","S_RADIO_ACTIVE","str","SelectPrompt","hasGuide","settings","titlePrefix","symbol","titlePrefixBar","symbolBar","messageLines","wrapTextWithPrefix","title","S_BAR","submitPrefix","wrappedLines","cancelPrefix","prefix","prefixEnd","S_BAR_END","titleLineCount","footerLineCount","limitOptions","item","active","prefix","styleText","S_BAR","path","path","existsSync","path","path","existsSync","isPlainObject","os","path","path","isRemoteSource","path"]}