@jordond/kit 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +139 -2
  2. package/bin/kit +39 -0
  3. package/dist/_verb-28xmg3d3.js +116 -0
  4. package/dist/android-fs3sesnn.js +60 -0
  5. package/dist/build-ak20h5cd.js +42 -0
  6. package/dist/builtins-bj2yypm6.js +10 -0
  7. package/dist/bump-hsfmz2rn.js +124 -0
  8. package/dist/certs-w5v0877b.js +76 -0
  9. package/dist/check-771pracn.js +33 -0
  10. package/dist/check-jf1apke7.js +54 -0
  11. package/dist/cleanup-hrcvxmh2.js +18 -0
  12. package/dist/cli/builtins.d.ts +13 -0
  13. package/dist/cli/command.d.ts +106 -0
  14. package/dist/cli/discover.d.ts +10 -0
  15. package/dist/cli/main.d.ts +1 -0
  16. package/dist/cli/plugin.d.ts +7 -0
  17. package/dist/cli/usage.d.ts +3 -0
  18. package/dist/cli-19me2qqg.js +1056 -0
  19. package/dist/cli-1htjx51v.js +80 -0
  20. package/dist/cli-51ha0t4k.js +70 -0
  21. package/dist/cli-540nme4e.js +46 -0
  22. package/dist/cli-5d61x8vg.js +675 -0
  23. package/dist/cli-5wasc5mr.js +76 -0
  24. package/dist/cli-699g070n.js +104 -0
  25. package/dist/cli-7wvrehng.js +23 -0
  26. package/dist/cli-cc13vv98.js +2023 -0
  27. package/dist/cli-dht27t4r.js +41 -0
  28. package/dist/cli-fqfan92n.js +135 -0
  29. package/dist/cli-fqxtcj42.js +75 -0
  30. package/dist/cli-g519ev8e.js +89 -0
  31. package/dist/cli-gqy1xp9t.js +97 -0
  32. package/dist/cli-qhs8ww91.js +51 -0
  33. package/dist/cli-qq1ktr8q.js +234 -0
  34. package/dist/cli-r6g14qrk.js +195 -0
  35. package/dist/cli-re3ntm60.js +48 -0
  36. package/dist/cli-sx073w8p.js +191 -0
  37. package/dist/cli-vt6582gp.js +122 -0
  38. package/dist/cli-xax5grx1.js +108 -0
  39. package/dist/cli-xjpjdc2c.js +70 -0
  40. package/dist/cli-y3mjprpv.js +31 -0
  41. package/dist/cli-zf47bkgh.js +227 -0
  42. package/dist/cli.d.ts +1 -0
  43. package/dist/cli.js +35 -0
  44. package/dist/cloudflare-xf7e2dn3.js +43 -0
  45. package/dist/command-j1etpmj6.js +21 -0
  46. package/dist/commands/_verb.d.ts +15 -0
  47. package/dist/commands/build.d.ts +11 -0
  48. package/dist/commands/check.d.ts +8 -0
  49. package/dist/commands/completion.d.ts +15 -0
  50. package/dist/commands/config.d.ts +2 -0
  51. package/dist/commands/db/create.d.ts +7 -0
  52. package/dist/commands/db/exec.d.ts +16 -0
  53. package/dist/commands/db/list.d.ts +11 -0
  54. package/dist/commands/db/migrate.d.ts +11 -0
  55. package/dist/commands/deploy.d.ts +18 -0
  56. package/dist/commands/deps.d.ts +72 -0
  57. package/dist/commands/dev.d.ts +8 -0
  58. package/dist/commands/doctor.d.ts +63 -0
  59. package/dist/commands/env/check.d.ts +7 -0
  60. package/dist/commands/env/init.d.ts +2 -0
  61. package/dist/commands/env/push.d.ts +16 -0
  62. package/dist/commands/env/sync.d.ts +2 -0
  63. package/dist/commands/fastlane.d.ts +2 -0
  64. package/dist/commands/format.d.ts +11 -0
  65. package/dist/commands/gradle.d.ts +2 -0
  66. package/dist/commands/init.d.ts +70 -0
  67. package/dist/commands/lint.d.ts +12 -0
  68. package/dist/commands/release/android.d.ts +30 -0
  69. package/dist/commands/release/certs.d.ts +7 -0
  70. package/dist/commands/release/ios.d.ts +22 -0
  71. package/dist/commands/release/service.d.ts +6 -0
  72. package/dist/commands/test.d.ts +2 -0
  73. package/dist/commands/typecheck.d.ts +2 -0
  74. package/dist/commands/version/bump.d.ts +17 -0
  75. package/dist/commands/version/show.d.ts +2 -0
  76. package/dist/commands/wrangler.d.ts +2 -0
  77. package/dist/commands/xcode.d.ts +10 -0
  78. package/dist/completion-m051yvzk.js +38 -0
  79. package/dist/concurrent-zdz69ye5.js +96 -0
  80. package/dist/config/load.d.ts +6 -0
  81. package/dist/config/schema.d.ts +139 -0
  82. package/dist/config-c8yh5m9j.js +22 -0
  83. package/dist/create-j7ve677k.js +38 -0
  84. package/dist/creds-rhxhmpe6.js +22 -0
  85. package/dist/deploy-af2v2jhj.js +152 -0
  86. package/dist/deps-1apnsrre.js +334 -0
  87. package/dist/dev-6dv5xbv2.js +114 -0
  88. package/dist/doctor-cr3hcfvt.js +377 -0
  89. package/dist/errors-1fjbr7ee.js +10 -0
  90. package/dist/exec-wa94sqwn.js +53 -0
  91. package/dist/fastlane-2kjyfqjg.js +26 -0
  92. package/dist/fastlane-qsjmbxtj.js +38 -0
  93. package/dist/format-rehf6c8g.js +39 -0
  94. package/dist/git-3gyyfk0x.js +24 -0
  95. package/dist/gradle-wv77a2f1.js +39 -0
  96. package/dist/index-cx34x4np.js +874 -0
  97. package/dist/index-erv82p4z.js +1528 -0
  98. package/dist/index-jqfz6hfy.js +2659 -0
  99. package/dist/index-mm4ht8yh.js +9 -0
  100. package/dist/index-s3ehw02w.js +1610 -0
  101. package/dist/index.d.ts +11 -0
  102. package/dist/index.js +55 -0
  103. package/dist/init-gtkmx54a.js +76 -0
  104. package/dist/init-kck1p6gj.js +250 -0
  105. package/dist/init-n38980zv.js +78 -0
  106. package/dist/ios-f6pwcqqt.js +50 -0
  107. package/dist/lib/cleanup.d.ts +21 -0
  108. package/dist/lib/cloudflare.d.ts +97 -0
  109. package/dist/lib/concurrent.d.ts +21 -0
  110. package/dist/lib/env/init.d.ts +22 -0
  111. package/dist/lib/env/load.d.ts +12 -0
  112. package/dist/lib/env/push.d.ts +54 -0
  113. package/dist/lib/env/render.d.ts +52 -0
  114. package/dist/lib/env/schema.d.ts +49 -0
  115. package/dist/lib/errors.d.ts +14 -0
  116. package/dist/lib/fastlane.d.ts +36 -0
  117. package/dist/lib/git.d.ts +36 -0
  118. package/dist/lib/log.d.ts +17 -0
  119. package/dist/lib/pm.d.ts +8 -0
  120. package/dist/lib/proc.d.ts +73 -0
  121. package/dist/lib/prompt.d.ts +32 -0
  122. package/dist/lib/release/creds.d.ts +26 -0
  123. package/dist/lib/release/mobile.d.ts +41 -0
  124. package/dist/lib/release/notes.d.ts +15 -0
  125. package/dist/lib/release/preflight.d.ts +30 -0
  126. package/dist/lib/release/version.d.ts +25 -0
  127. package/dist/lib/secrets.d.ts +32 -0
  128. package/dist/lib/steps.d.ts +38 -0
  129. package/dist/lib/targets.d.ts +46 -0
  130. package/dist/lib/toml.d.ts +15 -0
  131. package/dist/lint-e0j22mab.js +39 -0
  132. package/dist/list-fzwqsfsk.js +34 -0
  133. package/dist/load-dxhacsn4.js +137 -0
  134. package/dist/log-g1ebh60s.js +15 -0
  135. package/dist/main-jrcgdccz.js +1965 -0
  136. package/dist/migrate-4ncx9tqj.js +38 -0
  137. package/dist/mobile-9n86ytzx.js +384 -0
  138. package/dist/notes-1zsa7qac.js +21 -0
  139. package/dist/picocolors-0dxagz5d.js +6 -0
  140. package/dist/pm-5q5vz6w3.js +14 -0
  141. package/dist/proc-jv4bcyyx.js +33 -0
  142. package/dist/prompt-3wwegvqc.js +15 -0
  143. package/dist/push-acejr9gj.js +124 -0
  144. package/dist/push-fq5syn8c.js +117 -0
  145. package/dist/render-vn40fp54.js +22 -0
  146. package/dist/service-xekpd27p.js +102 -0
  147. package/dist/show-jw5bx55h.js +50 -0
  148. package/dist/steps-9knqpszw.js +16 -0
  149. package/dist/sync-9z8n875s.js +53 -0
  150. package/dist/targets-bywmzbtj.js +22 -0
  151. package/dist/test-8jws3x98.js +26 -0
  152. package/dist/toml-3fxsdkhr.js +14 -0
  153. package/dist/typecheck-1hn3hgz9.js +24 -0
  154. package/dist/version-4tz72w42.js +26 -0
  155. package/dist/wrangler-412fadcz.js +46 -0
  156. package/dist/xcode-qzyee632.js +75 -0
  157. package/fastlane/Fastfile +413 -0
  158. package/fastlane/Gemfile +21 -0
  159. package/fastlane/Gemfile.lock +275 -0
  160. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom +15 -0
  161. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.md5 +1 -0
  162. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.sha1 +1 -0
  163. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.sha256 +1 -0
  164. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.sha512 +1 -0
  165. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml +13 -0
  166. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.md5 +1 -0
  167. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  168. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  169. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  170. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom +15 -0
  171. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.md5 +1 -0
  172. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.sha1 +1 -0
  173. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.sha256 +1 -0
  174. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.sha512 +1 -0
  175. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml +13 -0
  176. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.md5 +1 -0
  177. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  178. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  179. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  180. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom +15 -0
  181. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.md5 +1 -0
  182. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.sha1 +1 -0
  183. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.sha256 +1 -0
  184. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.sha512 +1 -0
  185. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml +13 -0
  186. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.md5 +1 -0
  187. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  188. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  189. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  190. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom +15 -0
  191. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.md5 +1 -0
  192. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.sha1 +1 -0
  193. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.sha256 +1 -0
  194. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.sha512 +1 -0
  195. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml +13 -0
  196. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.md5 +1 -0
  197. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  198. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  199. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  200. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar +0 -0
  201. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.md5 +1 -0
  202. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.sha1 +1 -0
  203. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.sha256 +1 -0
  204. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.sha512 +1 -0
  205. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module +64 -0
  206. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.md5 +1 -0
  207. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.sha1 +1 -0
  208. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.sha256 +1 -0
  209. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.sha512 +1 -0
  210. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom +12 -0
  211. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.md5 +1 -0
  212. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.sha1 +1 -0
  213. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.sha256 +1 -0
  214. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.sha512 +1 -0
  215. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml +13 -0
  216. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.md5 +1 -0
  217. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.sha1 +1 -0
  218. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.sha256 +1 -0
  219. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.sha512 +1 -0
  220. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar +0 -0
  221. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.md5 +1 -0
  222. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.sha1 +1 -0
  223. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.sha256 +1 -0
  224. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.sha512 +1 -0
  225. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module +64 -0
  226. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.md5 +1 -0
  227. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.sha1 +1 -0
  228. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.sha256 +1 -0
  229. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.sha512 +1 -0
  230. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom +12 -0
  231. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.md5 +1 -0
  232. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.sha1 +1 -0
  233. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.sha256 +1 -0
  234. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.sha512 +1 -0
  235. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml +13 -0
  236. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.md5 +1 -0
  237. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.sha1 +1 -0
  238. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.sha256 +1 -0
  239. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.sha512 +1 -0
  240. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom +15 -0
  241. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.md5 +1 -0
  242. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.sha1 +1 -0
  243. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.sha256 +1 -0
  244. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.sha512 +1 -0
  245. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml +13 -0
  246. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.md5 +1 -0
  247. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  248. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  249. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  250. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom +15 -0
  251. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.md5 +1 -0
  252. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.sha1 +1 -0
  253. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.sha256 +1 -0
  254. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.sha512 +1 -0
  255. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml +13 -0
  256. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.md5 +1 -0
  257. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  258. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  259. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  260. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom +15 -0
  261. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.md5 +1 -0
  262. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.sha1 +1 -0
  263. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.sha256 +1 -0
  264. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.sha512 +1 -0
  265. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml +13 -0
  266. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.md5 +1 -0
  267. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  268. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  269. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  270. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom +15 -0
  271. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.md5 +1 -0
  272. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.sha1 +1 -0
  273. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.sha256 +1 -0
  274. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.sha512 +1 -0
  275. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml +13 -0
  276. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.md5 +1 -0
  277. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  278. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  279. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  280. package/package.json +58 -4
  281. package/templates/lefthook.yml +6 -0
  282. package/templates/mise.toml +6 -0
  283. package/templates/new/.env.example +20 -0
  284. package/templates/new/.github/workflows/ci.yml +45 -0
  285. package/templates/new/apps/client/fastlane/Fastfile +1 -0
  286. package/templates/new/apps/client/gradle/libs.versions.toml +25 -0
  287. package/templates/new/apps/client/settings.gradle.kts +25 -0
  288. package/templates/new/kit.config.ts +15 -0
@@ -0,0 +1,2023 @@
1
+ // @bun
2
+ import {
3
+ redact
4
+ } from "./cli-51ha0t4k.js";
5
+ import {
6
+ ProcError,
7
+ runLines
8
+ } from "./cli-fqfan92n.js";
9
+ import {
10
+ interrupted
11
+ } from "./cli-fqxtcj42.js";
12
+ import {
13
+ require_picocolors
14
+ } from "./cli-5wasc5mr.js";
15
+ import {
16
+ __require,
17
+ __toESM
18
+ } from "./cli-re3ntm60.js";
19
+
20
+ // src/lib/steps.ts
21
+ import { Writable as Writable2 } from "stream";
22
+
23
+ // node_modules/listr2/dist/index.mjs
24
+ import EventEmitter, { setMaxListeners } from "events";
25
+ import { inspect, styleText } from "util";
26
+ import { format } from "util";
27
+ import { EOL } from "os";
28
+ import { StringDecoder } from "string_decoder";
29
+ import { Writable } from "stream";
30
+ import { randomUUID } from "crypto";
31
+ var ANSI_ESCAPE_CODES = {
32
+ CURSOR_HIDE: "\x1B[?25l",
33
+ CURSOR_SHOW: "\x1B[?25h"
34
+ };
35
+ var ListrTaskState = /* @__PURE__ */ function(ListrTaskState2) {
36
+ ListrTaskState2["WAITING"] = "WAITING";
37
+ ListrTaskState2["STARTED"] = "STARTED";
38
+ ListrTaskState2["COMPLETED"] = "COMPLETED";
39
+ ListrTaskState2["FAILED"] = "FAILED";
40
+ ListrTaskState2["SKIPPED"] = "SKIPPED";
41
+ ListrTaskState2["ROLLING_BACK"] = "ROLLING_BACK";
42
+ ListrTaskState2["ROLLED_BACK"] = "ROLLED_BACK";
43
+ ListrTaskState2["RETRY"] = "RETRY";
44
+ ListrTaskState2["PAUSED"] = "PAUSED";
45
+ ListrTaskState2["PROMPT"] = "PROMPT";
46
+ ListrTaskState2["PROMPT_COMPLETED"] = "PROMPT_COMPLETED";
47
+ ListrTaskState2["PROMPT_FAILED"] = "PROMPT_FAILED";
48
+ ListrTaskState2["CANCELLED"] = "CANCELLED";
49
+ return ListrTaskState2;
50
+ }({});
51
+ var EventManager = class {
52
+ emitter = new EventEmitter;
53
+ constructor() {
54
+ this.emitter.setMaxListeners(0);
55
+ }
56
+ emit(dispatch, args) {
57
+ this.emitter.emit(dispatch, args);
58
+ }
59
+ on(dispatch, handler) {
60
+ if (!handler)
61
+ return;
62
+ this.emitter.addListener(dispatch, handler);
63
+ }
64
+ once(dispatch, handler) {
65
+ if (!handler)
66
+ return;
67
+ this.emitter.once(dispatch, handler);
68
+ }
69
+ off(dispatch, handler) {
70
+ if (handler)
71
+ this.emitter.off(dispatch, handler);
72
+ else
73
+ this.emitter.removeAllListeners(dispatch);
74
+ }
75
+ complete() {
76
+ this.emitter.removeAllListeners();
77
+ }
78
+ };
79
+ var ListrError = class extends Error {
80
+ error;
81
+ type;
82
+ task;
83
+ path;
84
+ constructor(error, type, task) {
85
+ super(error.message);
86
+ this.error = error;
87
+ this.type = type;
88
+ this.task = task;
89
+ this.name = "ListrError";
90
+ this.path = task.path;
91
+ this.stack = error?.stack;
92
+ }
93
+ };
94
+ var ListrRendererError = class extends Error {
95
+ };
96
+ var PromptError = class extends Error {
97
+ };
98
+ var ListrTaskFailure = class {
99
+ error;
100
+ constructor(error) {
101
+ this.error = error;
102
+ }
103
+ };
104
+ function isObservable(obj) {
105
+ return !!obj && typeof obj === "object" && typeof obj.subscribe === "function";
106
+ }
107
+ function isReadable(obj) {
108
+ return !!obj && typeof obj === "object" && obj.readable === true && typeof obj.read === "function" && typeof obj.on === "function";
109
+ }
110
+ function isUnicodeSupported() {
111
+ return !!process.env["LISTR_FORCE_UNICODE"] || process.platform !== "win32" || !!process.env.CI || !!process.env.WT_SESSION || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty";
112
+ }
113
+ var CLEAR_LINE_REGEX = "(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+";
114
+ function cleanseAnsi(chunk) {
115
+ return String(chunk).replace(new RegExp(CLEAR_LINE_REGEX, "gmi"), "").trim();
116
+ }
117
+ var color = Object.fromEntries(Object.keys(inspect.colors).map((color2) => [color2, (text) => styleText(color2, String(text))]));
118
+ function indent(string, count) {
119
+ return string.replace(/^(?!\s*$)/gm, " ".repeat(count));
120
+ }
121
+ var FIGURES_MAIN = {
122
+ warning: "\u26A0",
123
+ info: "\u2139",
124
+ cross: "\u2716",
125
+ arrowDown: "\u2193",
126
+ tick: "\u2714",
127
+ arrowRight: "\u2192",
128
+ pointer: "\u276F",
129
+ checkboxOn: "\u2612",
130
+ arrowLeft: "\u2190",
131
+ squareSmallFilled: "\u25FC",
132
+ pointerSmall: "\u203A",
133
+ circleSlash: "\u2298"
134
+ };
135
+ var FIGURES_FALLBACK = {
136
+ ...FIGURES_MAIN,
137
+ warning: "\u203C",
138
+ info: "i",
139
+ cross: "\xD7",
140
+ tick: "\u221A",
141
+ pointer: ">",
142
+ checkboxOn: "[\xD7]",
143
+ squareSmallFilled: "\u25A0",
144
+ circleSlash: "\xF8"
145
+ };
146
+ var figures = isUnicodeSupported() ? FIGURES_MAIN : FIGURES_FALLBACK;
147
+ function splat(message, ...splat2) {
148
+ return format(String(message), ...splat2);
149
+ }
150
+ var LISTR_LOGGER_STYLE = {
151
+ icon: {
152
+ ["STARTED"]: figures.pointer,
153
+ ["FAILED"]: figures.cross,
154
+ ["SKIPPED"]: figures.arrowDown,
155
+ ["COMPLETED"]: figures.tick,
156
+ ["OUTPUT"]: figures.pointerSmall,
157
+ ["TITLE"]: figures.arrowRight,
158
+ ["RETRY"]: figures.warning,
159
+ ["ROLLBACK"]: figures.arrowLeft,
160
+ ["PAUSED"]: figures.squareSmallFilled,
161
+ ["CANCELLED"]: figures.circleSlash
162
+ },
163
+ color: {
164
+ ["STARTED"]: color.yellow,
165
+ ["FAILED"]: color.red,
166
+ ["SKIPPED"]: color.yellow,
167
+ ["COMPLETED"]: color.green,
168
+ ["RETRY"]: color.yellowBright,
169
+ ["ROLLBACK"]: color.redBright,
170
+ ["PAUSED"]: color.yellowBright,
171
+ ["CANCELLED"]: color.red
172
+ }
173
+ };
174
+ var LISTR_LOGGER_STDERR_LEVELS = [
175
+ "RETRY",
176
+ "ROLLBACK",
177
+ "FAILED"
178
+ ];
179
+ var ListrLogger = class {
180
+ options;
181
+ process;
182
+ constructor(options) {
183
+ this.options = options;
184
+ this.options = {
185
+ useIcons: true,
186
+ toStderr: [],
187
+ ...options ?? {}
188
+ };
189
+ this.options.fields ??= {};
190
+ this.options.fields.prefix ??= [];
191
+ this.options.fields.suffix ??= [];
192
+ this.process = this.options.processOutput ?? new ProcessOutput;
193
+ }
194
+ log(level, message, options) {
195
+ const output = this.format(level, message, options);
196
+ if (this.options.toStderr.includes(level)) {
197
+ this.process.toStderr(output);
198
+ return;
199
+ }
200
+ this.process.toStdout(output);
201
+ }
202
+ toStdout(message, options, eol = true) {
203
+ this.process.toStdout(this.format(null, message, options), eol);
204
+ }
205
+ toStderr(message, options, eol = true) {
206
+ this.process.toStderr(this.format(null, message, options), eol);
207
+ }
208
+ wrap(message, options) {
209
+ if (!message)
210
+ return message;
211
+ return this.applyFormat(`[${message}]`, options);
212
+ }
213
+ splat(...args) {
214
+ const message = args.shift() ?? "";
215
+ return args.length === 0 ? message : splat(message, args);
216
+ }
217
+ suffix(message, ...suffixes) {
218
+ suffixes.filter(Boolean).forEach((suffix) => {
219
+ message += this.spacing(message);
220
+ if (typeof suffix === "string")
221
+ message += this.wrap(suffix);
222
+ else if (typeof suffix === "object") {
223
+ suffix.args ??= [];
224
+ if (typeof suffix.condition === "function" ? !suffix.condition(...suffix.args) : !(suffix.condition ?? true))
225
+ return message;
226
+ message += this.wrap(typeof suffix.field === "function" ? suffix.field(...suffix.args) : suffix.field, { format: suffix?.format(...suffix.args) });
227
+ }
228
+ });
229
+ return message;
230
+ }
231
+ prefix(message, ...prefixes) {
232
+ prefixes.filter(Boolean).forEach((prefix) => {
233
+ message = this.spacing(message) + message;
234
+ if (typeof prefix === "string")
235
+ message = this.wrap(prefix) + message;
236
+ else if (typeof prefix === "object") {
237
+ prefix.args ??= [];
238
+ if (typeof prefix.condition === "function" ? !prefix.condition(...prefix.args) : !(prefix.condition ?? true))
239
+ return message;
240
+ message = this.wrap(typeof prefix.field === "function" ? prefix.field(...prefix.args) : prefix.field, { format: prefix?.format() }) + message;
241
+ }
242
+ });
243
+ return message;
244
+ }
245
+ fields(message, options) {
246
+ if (this.options?.fields?.prefix)
247
+ message = this.prefix(message, ...this.options.fields.prefix);
248
+ if (options?.prefix)
249
+ message = this.prefix(message, ...options.prefix);
250
+ if (options?.suffix)
251
+ message = this.suffix(message, ...options.suffix);
252
+ if (this.options?.fields?.suffix)
253
+ message = this.suffix(message, ...this.options.fields.suffix);
254
+ return message;
255
+ }
256
+ icon(level, icon) {
257
+ if (!level)
258
+ return null;
259
+ if (!icon) {
260
+ const i = this.options.icon?.[level];
261
+ icon = typeof i === "function" ? i() : i;
262
+ }
263
+ const coloring = this.options.color?.[level];
264
+ if (icon && coloring)
265
+ icon = coloring(icon);
266
+ return icon;
267
+ }
268
+ format(level, message, options) {
269
+ if (!Array.isArray(message))
270
+ message = [message];
271
+ message = this.splat(message.shift(), ...message).toString().split(EOL).filter((m) => !m || m.trim() !== "").map((m) => {
272
+ return this.style(level, this.fields(m, {
273
+ prefix: Array.isArray(options?.prefix) ? options.prefix : [options?.prefix],
274
+ suffix: Array.isArray(options?.suffix) ? options.suffix : [options?.suffix]
275
+ }));
276
+ }).join(EOL);
277
+ return message;
278
+ }
279
+ style(level, message) {
280
+ if (!level || !message)
281
+ return message;
282
+ const icon = this.icon(level, !this.options.useIcons && this.wrap(level));
283
+ if (icon)
284
+ message = icon + " " + message;
285
+ return message;
286
+ }
287
+ applyFormat(message, options) {
288
+ if (options?.format)
289
+ return options.format(message);
290
+ return message;
291
+ }
292
+ spacing(message) {
293
+ return typeof message === "undefined" || message.trim() === "" ? "" : " ";
294
+ }
295
+ };
296
+ var ProcessOutputBuffer = class {
297
+ options;
298
+ buffer = [];
299
+ decoder = new StringDecoder;
300
+ constructor(options) {
301
+ this.options = options;
302
+ }
303
+ get all() {
304
+ return this.buffer;
305
+ }
306
+ get last() {
307
+ return this.buffer.at(-1);
308
+ }
309
+ get length() {
310
+ return this.buffer.length;
311
+ }
312
+ write(data, ...args) {
313
+ const callback = args[args.length - 1];
314
+ this.buffer.push({
315
+ time: Date.now(),
316
+ stream: this.options?.stream,
317
+ entry: this.decoder.write(typeof data === "string" ? Buffer.from(data, typeof args[0] === "string" ? args[0] : undefined) : Buffer.from(data))
318
+ });
319
+ if (this.options?.limit)
320
+ this.buffer = this.buffer.slice(-this.options.limit);
321
+ if (typeof callback === "function")
322
+ callback();
323
+ return true;
324
+ }
325
+ reset() {
326
+ this.buffer = [];
327
+ }
328
+ };
329
+ var ProcessOutputStream = class {
330
+ stream;
331
+ method;
332
+ buffer;
333
+ constructor(stream) {
334
+ this.stream = stream;
335
+ this.method = stream.write;
336
+ this.buffer = new ProcessOutputBuffer({ stream });
337
+ }
338
+ get out() {
339
+ const self = this;
340
+ return new Proxy(this.stream, { get(target, prop, receiver) {
341
+ if (prop === "write")
342
+ return self.write.bind(self);
343
+ return Reflect.get(target, prop, receiver);
344
+ } });
345
+ }
346
+ hijack() {
347
+ this.stream.write = this.buffer.write.bind(this.buffer);
348
+ }
349
+ release() {
350
+ this.stream.write = this.method;
351
+ const buffer = [...this.buffer.all];
352
+ this.buffer.reset();
353
+ return buffer;
354
+ }
355
+ write(...args) {
356
+ return this.method.apply(this.stream, args);
357
+ }
358
+ };
359
+ var ProcessOutput = class {
360
+ options;
361
+ stream;
362
+ active;
363
+ constructor(stdout, stderr, options) {
364
+ this.options = options;
365
+ this.stream = {
366
+ stdout: new ProcessOutputStream(stdout ?? process.stdout),
367
+ stderr: new ProcessOutputStream(stderr ?? process.stderr)
368
+ };
369
+ this.options = {
370
+ dump: ["stdout", "stderr"],
371
+ leaveEmptyLine: true,
372
+ ...options
373
+ };
374
+ }
375
+ get stdout() {
376
+ return this.stream.stdout.out;
377
+ }
378
+ get stderr() {
379
+ return this.stream.stderr.out;
380
+ }
381
+ hijack() {
382
+ if (this.active)
383
+ throw new Error("ProcessOutput has been already hijacked!");
384
+ this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_HIDE);
385
+ Object.values(this.stream).forEach((stream) => stream.hijack());
386
+ this.active = true;
387
+ }
388
+ release() {
389
+ const output = Object.entries(this.stream).map(([name, stream]) => ({
390
+ name,
391
+ buffer: stream.release()
392
+ })).filter((output2) => this.options.dump.includes(output2.name)).flatMap((output2) => output2.buffer).sort((a, b) => a.time - b.time).map((message) => {
393
+ return {
394
+ ...message,
395
+ entry: cleanseAnsi(message.entry)
396
+ };
397
+ }).filter((message) => message.entry);
398
+ if (output.length > 0) {
399
+ if (this.options.leaveEmptyLine)
400
+ this.stdout.write(EOL);
401
+ output.forEach((message) => {
402
+ (message.stream ?? this.stdout).write(message.entry + EOL);
403
+ });
404
+ }
405
+ this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW);
406
+ this.active = false;
407
+ }
408
+ toStdout(buffer, eol = true) {
409
+ if (eol)
410
+ buffer = buffer + EOL;
411
+ return this.stream.stdout.write(buffer);
412
+ }
413
+ toStderr(buffer, eol = true) {
414
+ if (eol)
415
+ buffer = buffer + EOL;
416
+ return this.stream.stderr.write(buffer);
417
+ }
418
+ };
419
+ function createWritable(cb) {
420
+ const writable = new Writable;
421
+ writable.rows = Infinity;
422
+ writable.columns = Infinity;
423
+ writable.write = (chunk) => {
424
+ cb(chunk.toString());
425
+ return true;
426
+ };
427
+ return writable;
428
+ }
429
+ var Spinner = class {
430
+ spinner = !isUnicodeSupported() ? [
431
+ "-",
432
+ "\\",
433
+ "|",
434
+ "/"
435
+ ] : [
436
+ "\u280B",
437
+ "\u2819",
438
+ "\u2839",
439
+ "\u2838",
440
+ "\u283C",
441
+ "\u2834",
442
+ "\u2826",
443
+ "\u2827",
444
+ "\u2807",
445
+ "\u280F"
446
+ ];
447
+ id;
448
+ spinnerPosition = 0;
449
+ spin() {
450
+ this.spinnerPosition = ++this.spinnerPosition % this.spinner.length;
451
+ }
452
+ fetch() {
453
+ return this.spinner[this.spinnerPosition];
454
+ }
455
+ isRunning() {
456
+ return !!this.id;
457
+ }
458
+ start(cb, interval = 100) {
459
+ this.id = setInterval(() => {
460
+ this.spin();
461
+ if (cb)
462
+ cb();
463
+ }, interval);
464
+ }
465
+ stop() {
466
+ clearInterval(this.id);
467
+ this.id = undefined;
468
+ }
469
+ };
470
+ var LISTR_DEFAULT_RENDERER_STYLE = {
471
+ icon: {
472
+ ["SKIPPED_WITH_COLLAPSE"]: figures.arrowDown,
473
+ ["SKIPPED_WITHOUT_COLLAPSE"]: figures.warning,
474
+ ["OUTPUT"]: figures.pointerSmall,
475
+ ["OUTPUT_WITH_BOTTOMBAR"]: figures.pointerSmall,
476
+ ["PENDING"]: figures.pointer,
477
+ ["COMPLETED"]: figures.tick,
478
+ ["COMPLETED_WITH_FAILED_SUBTASKS"]: figures.warning,
479
+ ["COMPLETED_WITH_SISTER_TASKS_FAILED"]: figures.squareSmallFilled,
480
+ ["RETRY"]: figures.warning,
481
+ ["ROLLING_BACK"]: figures.warning,
482
+ ["ROLLED_BACK"]: figures.arrowLeft,
483
+ ["FAILED"]: figures.cross,
484
+ ["FAILED_WITH_SUBTASKS"]: figures.pointer,
485
+ ["WAITING"]: figures.squareSmallFilled,
486
+ ["PAUSED"]: figures.squareSmallFilled,
487
+ ["CANCELLED"]: figures.circleSlash
488
+ },
489
+ color: {
490
+ ["SKIPPED_WITH_COLLAPSE"]: color.yellow,
491
+ ["SKIPPED_WITHOUT_COLLAPSE"]: color.yellow,
492
+ ["PENDING"]: color.yellow,
493
+ ["COMPLETED"]: color.green,
494
+ ["COMPLETED_WITH_FAILED_SUBTASKS"]: color.yellow,
495
+ ["COMPLETED_WITH_SISTER_TASKS_FAILED"]: color.red,
496
+ ["RETRY"]: color.yellowBright,
497
+ ["ROLLING_BACK"]: color.redBright,
498
+ ["ROLLED_BACK"]: color.redBright,
499
+ ["FAILED"]: color.red,
500
+ ["FAILED_WITH_SUBTASKS"]: color.red,
501
+ ["WAITING"]: color.dim,
502
+ ["PAUSED"]: color.yellowBright,
503
+ ["CANCELLED"]: color.red
504
+ }
505
+ };
506
+ function parseTimer(duration) {
507
+ const seconds = Math.floor(duration / 1000);
508
+ const minutes = Math.floor(seconds / 60);
509
+ let parsedTime;
510
+ if (seconds === 0 && minutes === 0)
511
+ parsedTime = `0.${Math.floor(duration / 100)}s`;
512
+ if (seconds > 0)
513
+ parsedTime = `${seconds % 60}s`;
514
+ if (minutes > 0)
515
+ parsedTime = `${minutes}m${parsedTime}`;
516
+ return parsedTime;
517
+ }
518
+ var PRESET_TIMER = {
519
+ condition: true,
520
+ field: parseTimer,
521
+ format: () => color.dim
522
+ };
523
+ var DefaultRenderer = class DefaultRenderer2 {
524
+ tasks;
525
+ options;
526
+ events;
527
+ static nonTTY = false;
528
+ static rendererOptions = {
529
+ indentation: 2,
530
+ clearOutput: false,
531
+ showSubtasks: true,
532
+ collapseSubtasks: true,
533
+ collapseSkips: true,
534
+ showSkipMessage: true,
535
+ suffixSkips: false,
536
+ collapseErrors: true,
537
+ showErrorMessage: true,
538
+ suffixRetries: true,
539
+ lazy: false,
540
+ removeEmptyLines: true,
541
+ formatOutput: "wrap",
542
+ pausedTimer: {
543
+ ...PRESET_TIMER,
544
+ format: () => color.yellowBright
545
+ }
546
+ };
547
+ static rendererTaskOptions = { outputBar: true };
548
+ prompt;
549
+ activePrompt;
550
+ spinner;
551
+ logger;
552
+ updater;
553
+ truncate;
554
+ wrap;
555
+ buffer = {
556
+ output: /* @__PURE__ */ new Map,
557
+ bottom: /* @__PURE__ */ new Map
558
+ };
559
+ cache = {
560
+ render: /* @__PURE__ */ new Map,
561
+ rendererOptions: /* @__PURE__ */ new Map,
562
+ rendererTaskOptions: /* @__PURE__ */ new Map
563
+ };
564
+ constructor(tasks, options, events) {
565
+ this.tasks = tasks;
566
+ this.options = options;
567
+ this.events = events;
568
+ this.options = {
569
+ ...DefaultRenderer2.rendererOptions,
570
+ ...this.options,
571
+ icon: {
572
+ ...LISTR_DEFAULT_RENDERER_STYLE.icon,
573
+ ...options?.icon ?? {}
574
+ },
575
+ color: {
576
+ ...LISTR_DEFAULT_RENDERER_STYLE.color,
577
+ ...options?.color ?? {}
578
+ }
579
+ };
580
+ this.spinner = this.options.spinner ?? new Spinner;
581
+ this.logger = this.options.logger ?? new ListrLogger({
582
+ useIcons: true,
583
+ toStderr: []
584
+ });
585
+ this.logger.options.icon = this.options.icon;
586
+ this.logger.options.color = this.options.color;
587
+ }
588
+ async render() {
589
+ const { createLogUpdate } = await import("./index-s3ehw02w.js");
590
+ const { default: truncate } = await import("./index-cx34x4np.js");
591
+ const { default: wrap } = await import("./index-mm4ht8yh.js");
592
+ this.updater = createLogUpdate(this.logger.process.stdout);
593
+ this.truncate = truncate;
594
+ this.wrap = wrap;
595
+ this.logger.process.hijack();
596
+ if (!this.options?.lazy)
597
+ this.spinner.start(() => {
598
+ this.update();
599
+ });
600
+ this.events.on("SHOUD_REFRESH_RENDER", this.refresh);
601
+ }
602
+ update() {
603
+ this.updater(this.create());
604
+ }
605
+ end() {
606
+ this.spinner.stop();
607
+ this.events.off("SHOUD_REFRESH_RENDER", this.refresh);
608
+ this.updater.clear();
609
+ this.updater.done();
610
+ if (!this.options.clearOutput)
611
+ this.logger.process.toStdout(this.create({ prompt: false }));
612
+ this.logger.process.release();
613
+ }
614
+ create(options) {
615
+ options = {
616
+ tasks: true,
617
+ bottomBar: true,
618
+ prompt: true,
619
+ ...options
620
+ };
621
+ const render = [];
622
+ const renderTasks = this.renderer(this.tasks);
623
+ const renderBottomBar = this.renderBottomBar();
624
+ const renderPrompt = this.renderPrompt();
625
+ if (options.tasks && renderTasks.length > 0)
626
+ render.push(...renderTasks);
627
+ if (options.bottomBar && renderBottomBar.length > 0) {
628
+ if (render.length > 0)
629
+ render.push("");
630
+ render.push(...renderBottomBar);
631
+ }
632
+ if (options.prompt && renderPrompt.length > 0) {
633
+ if (render.length > 0)
634
+ render.push("");
635
+ render.push(...renderPrompt);
636
+ }
637
+ return render.join(EOL);
638
+ }
639
+ style(task, output = false) {
640
+ const rendererOptions = this.cache.rendererOptions.get(task.id);
641
+ if (task.isSkipped()) {
642
+ if (output || rendererOptions.collapseSkips)
643
+ return this.logger.icon("SKIPPED_WITH_COLLAPSE");
644
+ else if (rendererOptions.collapseSkips === false)
645
+ return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE");
646
+ }
647
+ if (output) {
648
+ if (this.shouldOutputToBottomBar(task))
649
+ return this.logger.icon("OUTPUT_WITH_BOTTOMBAR");
650
+ return this.logger.icon("OUTPUT");
651
+ }
652
+ if (task.hasSubtasks()) {
653
+ if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle()))
654
+ return this.logger.icon("PENDING");
655
+ else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed()))
656
+ return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");
657
+ else if (task.hasFailed())
658
+ return this.logger.icon("FAILED_WITH_SUBTASKS");
659
+ }
660
+ if (task.isStarted() || task.isPrompt())
661
+ return this.logger.icon("PENDING", !this.options?.lazy && this.spinner.fetch());
662
+ else if (task.isCompleted())
663
+ return this.logger.icon("COMPLETED");
664
+ else if (task.isRetrying())
665
+ return this.logger.icon("RETRY", !this.options?.lazy && this.spinner.fetch());
666
+ else if (task.isRollingBack())
667
+ return this.logger.icon("ROLLING_BACK", !this.options?.lazy && this.spinner.fetch());
668
+ else if (task.hasRolledBack())
669
+ return this.logger.icon("ROLLED_BACK");
670
+ else if (task.hasFailed())
671
+ return this.logger.icon("FAILED");
672
+ else if (task.isCancelled())
673
+ return this.logger.icon("CANCELLED");
674
+ else if (task.isPaused())
675
+ return this.logger.icon("PAUSED");
676
+ return this.logger.icon("WAITING");
677
+ }
678
+ format(message, icon, level) {
679
+ if (message.trim() === "")
680
+ return [];
681
+ if (icon)
682
+ message = icon + " " + message;
683
+ let parsed;
684
+ const columns = (this.logger.process.stdout.columns ?? 80) - level * this.options.indentation - 2;
685
+ switch (this.options.formatOutput) {
686
+ case "truncate":
687
+ parsed = message.split(EOL).map((s, i) => {
688
+ return this.truncate(this.indent(s, i), columns);
689
+ });
690
+ break;
691
+ case "wrap":
692
+ parsed = this.wrap(message, columns, {
693
+ hard: true,
694
+ trim: false
695
+ }).split(EOL).map((s, i) => this.indent(s, i));
696
+ break;
697
+ default:
698
+ throw new ListrRendererError("Format option for the renderer is wrong.");
699
+ }
700
+ if (this.options.removeEmptyLines)
701
+ parsed = parsed.filter(Boolean);
702
+ return parsed.map((str) => indent(str, level * this.options.indentation));
703
+ }
704
+ shouldOutputToOutputBar(task) {
705
+ const outputBar = this.cache.rendererTaskOptions.get(task.id).outputBar;
706
+ return typeof outputBar === "number" && outputBar !== 0 || typeof outputBar === "boolean" && outputBar !== false;
707
+ }
708
+ shouldOutputToBottomBar(task) {
709
+ const bottomBar = this.cache.rendererTaskOptions.get(task.id).bottomBar;
710
+ return typeof bottomBar === "number" && bottomBar !== 0 || typeof bottomBar === "boolean" && bottomBar !== false || !task.hasTitle();
711
+ }
712
+ refresh = () => {
713
+ this.update();
714
+ };
715
+ renderer(tasks, level = 0) {
716
+ return tasks.flatMap((task) => {
717
+ if (!task.isEnabled())
718
+ return [];
719
+ if (this.cache.render.has(task.id))
720
+ return this.cache.render.get(task.id);
721
+ this.calculate(task);
722
+ this.setupBuffer(task);
723
+ const rendererOptions = this.cache.rendererOptions.get(task.id);
724
+ const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
725
+ const output = [];
726
+ if (task.isPrompt()) {
727
+ if (this.activePrompt && this.activePrompt !== task.id)
728
+ throw new ListrRendererError("Only one prompt can be active at the given time, please re-evaluate your task design.");
729
+ else if (!this.activePrompt) {
730
+ task.on("PROMPT", (prompt) => {
731
+ const cleansed = cleanseAnsi(prompt);
732
+ if (cleansed)
733
+ this.prompt = cleansed;
734
+ });
735
+ task.on("STATE", (state) => {
736
+ if (state === "PROMPT_COMPLETED" || task.hasFinalized() || task.hasReset()) {
737
+ this.prompt = null;
738
+ this.activePrompt = null;
739
+ task.off("PROMPT");
740
+ }
741
+ });
742
+ this.activePrompt = task.id;
743
+ }
744
+ }
745
+ if (task.hasTitle()) {
746
+ if (!(tasks.some((task2) => task2.hasFailed()) && !task.hasFailed() && task.options.exitOnError !== false && !(task.isCompleted() || task.isSkipped() || task.isCancelled()))) {
747
+ if (task.hasFailed() && rendererOptions.collapseErrors)
748
+ output.push(...this.format(!task.hasSubtasks() && task.message.error && rendererOptions.showErrorMessage ? task.message.error : task.title, this.style(task), level));
749
+ else if (task.isSkipped() && rendererOptions.collapseSkips)
750
+ output.push(...this.format(this.logger.suffix(task.message.skip && rendererOptions.showSkipMessage ? task.message.skip : task.title, {
751
+ field: "SKIPPED",
752
+ condition: rendererOptions.suffixSkips,
753
+ format: () => color.dim
754
+ }), this.style(task), level));
755
+ else if (task.isRetrying())
756
+ output.push(...this.format(this.logger.suffix(task.title, {
757
+ field: `RETRY:${task.message.retry.count}`,
758
+ format: () => color.yellow,
759
+ condition: rendererOptions.suffixRetries
760
+ }), this.style(task), level));
761
+ else if (task.isCompleted() && task.hasTitle() && assertFunctionOrSelf(rendererTaskOptions.timer?.condition, task.message.duration))
762
+ output.push(...this.format(this.logger.suffix(task?.title, {
763
+ ...rendererTaskOptions.timer,
764
+ args: [task.message.duration]
765
+ }), this.style(task), level));
766
+ else if (task.isPaused())
767
+ output.push(...this.format(this.logger.suffix(task.title, {
768
+ ...rendererOptions.pausedTimer,
769
+ args: [task.message.paused - Date.now()]
770
+ }), this.style(task), level));
771
+ else
772
+ output.push(...this.format(task.title, this.style(task), level));
773
+ } else
774
+ output.push(...this.format(task.title, this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"), level));
775
+ }
776
+ if (!task.hasSubtasks() || !rendererOptions.showSubtasks) {
777
+ if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks))
778
+ output.push(...this.dump(task, level, "FAILED"));
779
+ else if (task.isSkipped() && rendererOptions.collapseSkips === false && (rendererOptions.showSkipMessage || !rendererOptions.showSubtasks))
780
+ output.push(...this.dump(task, level, "SKIPPED"));
781
+ }
782
+ if (task.isPending() || rendererTaskOptions.persistentOutput)
783
+ output.push(...this.renderOutputBar(task, level));
784
+ if (rendererOptions.showSubtasks !== false && task.hasSubtasks() && (task.isPending() || task.hasFinalized() && !task.hasTitle() || task.isCompleted() && rendererOptions.collapseSubtasks === false && !task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === true) || task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === false) || task.subtasks.some((subtask) => subtask.hasFailed()) || task.subtasks.some((subtask) => subtask.hasRolledBack()) || task.subtasks.some((subtask) => subtask.isCancelled()))) {
785
+ const subtaskLevel = !task.hasTitle() ? level : level + 1;
786
+ const subtaskRender = this.renderer(task.subtasks, subtaskLevel);
787
+ output.push(...subtaskRender);
788
+ }
789
+ if (task.hasFinalized()) {
790
+ if (!rendererTaskOptions.persistentOutput) {
791
+ this.buffer.bottom.delete(task.id);
792
+ this.buffer.output.delete(task.id);
793
+ }
794
+ }
795
+ if (task.isClosed()) {
796
+ this.cache.render.set(task.id, output);
797
+ this.reset(task);
798
+ }
799
+ return output;
800
+ });
801
+ }
802
+ renderOutputBar(task, level) {
803
+ const output = this.buffer.output.get(task.id);
804
+ if (!output)
805
+ return [];
806
+ return output.all.flatMap((o) => this.dump(task, level, "OUTPUT", o.entry));
807
+ }
808
+ renderBottomBar() {
809
+ if (this.buffer.bottom.size === 0)
810
+ return [];
811
+ return Array.from(this.buffer.bottom.values()).flatMap((output) => output.all).sort((a, b) => a.time - b.time).map((output) => output.entry);
812
+ }
813
+ renderPrompt() {
814
+ if (!this.prompt)
815
+ return [];
816
+ return [this.prompt];
817
+ }
818
+ calculate(task) {
819
+ if (this.cache.rendererOptions.has(task.id) && this.cache.rendererTaskOptions.has(task.id))
820
+ return;
821
+ const rendererOptions = {
822
+ ...this.options,
823
+ ...task.rendererOptions
824
+ };
825
+ this.cache.rendererOptions.set(task.id, rendererOptions);
826
+ this.cache.rendererTaskOptions.set(task.id, {
827
+ ...DefaultRenderer2.rendererTaskOptions,
828
+ timer: rendererOptions.timer,
829
+ ...task.rendererTaskOptions
830
+ });
831
+ }
832
+ setupBuffer(task) {
833
+ if (this.buffer.bottom.has(task.id) || this.buffer.output.has(task.id))
834
+ return;
835
+ if (task.hasFinalized())
836
+ return;
837
+ const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
838
+ if (this.shouldOutputToBottomBar(task) && !this.buffer.bottom.has(task.id)) {
839
+ this.buffer.bottom.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.bottomBar === "number" ? rendererTaskOptions.bottomBar : 1 }));
840
+ task.on("OUTPUT", (output) => {
841
+ const data = this.dump(task, -1, "OUTPUT", output);
842
+ this.buffer.bottom.get(task.id).write(data.join(EOL));
843
+ });
844
+ task.on("OUTPUT_RESET", () => {
845
+ this.buffer.bottom.get(task.id)?.reset();
846
+ });
847
+ task.on("STATE", (state) => {
848
+ if (state === "RETRY" || state === "ROLLING_BACK")
849
+ this.buffer.bottom.delete(task.id);
850
+ });
851
+ } else if (this.shouldOutputToOutputBar(task) && !this.buffer.output.has(task.id)) {
852
+ this.buffer.output.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.outputBar === "number" ? rendererTaskOptions.outputBar : 1 }));
853
+ task.on("OUTPUT", (output) => {
854
+ this.buffer.output.get(task.id).write(output);
855
+ });
856
+ task.on("OUTPUT_RESET", () => {
857
+ this.buffer.output.get(task.id)?.reset();
858
+ });
859
+ task.on("STATE", (state) => {
860
+ if (state === "RETRY" || state === "ROLLING_BACK")
861
+ this.buffer.output.delete(task.id);
862
+ });
863
+ }
864
+ }
865
+ reset(task) {
866
+ this.cache.rendererOptions.delete(task.id);
867
+ this.cache.rendererTaskOptions.delete(task.id);
868
+ this.buffer.output.delete(task.id);
869
+ }
870
+ dump(task, level, source = "OUTPUT", data) {
871
+ if (!data)
872
+ switch (source) {
873
+ case "OUTPUT":
874
+ data = task.output;
875
+ break;
876
+ case "SKIPPED":
877
+ data = task.message.skip;
878
+ break;
879
+ case "FAILED":
880
+ data = task.message.error;
881
+ }
882
+ if (task.hasTitle() && source === "FAILED" && data === task.title || typeof data !== "string")
883
+ return [];
884
+ if (source === "OUTPUT")
885
+ data = cleanseAnsi(data);
886
+ return this.format(data, this.style(task, true), level + 1);
887
+ }
888
+ indent(str, i) {
889
+ return i > 0 ? indent(str.trimEnd(), this.options.indentation) : str.trimEnd();
890
+ }
891
+ };
892
+ var SilentRenderer = class {
893
+ tasks;
894
+ options;
895
+ static nonTTY = true;
896
+ static rendererOptions;
897
+ static rendererTaskOptions;
898
+ constructor(tasks, options) {
899
+ this.tasks = tasks;
900
+ this.options = options;
901
+ }
902
+ render() {}
903
+ end() {}
904
+ };
905
+ var SimpleRenderer = class SimpleRenderer2 {
906
+ tasks;
907
+ options;
908
+ static nonTTY = true;
909
+ static rendererOptions = { pausedTimer: {
910
+ ...PRESET_TIMER,
911
+ field: (time) => `PAUSED:${time}`,
912
+ format: () => color.yellowBright
913
+ } };
914
+ static rendererTaskOptions = {};
915
+ logger;
916
+ cache = {
917
+ rendererOptions: /* @__PURE__ */ new Map,
918
+ rendererTaskOptions: /* @__PURE__ */ new Map
919
+ };
920
+ constructor(tasks, options) {
921
+ this.tasks = tasks;
922
+ this.options = options;
923
+ this.options = {
924
+ ...SimpleRenderer2.rendererOptions,
925
+ ...options,
926
+ icon: {
927
+ ...LISTR_LOGGER_STYLE.icon,
928
+ ...options?.icon ?? {}
929
+ },
930
+ color: {
931
+ ...LISTR_LOGGER_STYLE.color,
932
+ ...options?.color ?? {}
933
+ }
934
+ };
935
+ this.logger = this.options.logger ?? new ListrLogger({
936
+ useIcons: true,
937
+ toStderr: LISTR_LOGGER_STDERR_LEVELS
938
+ });
939
+ this.logger.options.icon = this.options.icon;
940
+ this.logger.options.color = this.options.color;
941
+ if (this.options.timestamp)
942
+ this.logger.options.fields.prefix.unshift(this.options.timestamp);
943
+ }
944
+ end() {}
945
+ render() {
946
+ this.renderer(this.tasks);
947
+ }
948
+ renderer(tasks) {
949
+ tasks.forEach((task) => {
950
+ this.calculate(task);
951
+ task.once("CLOSED", () => {
952
+ this.reset(task);
953
+ });
954
+ const rendererOptions = this.cache.rendererOptions.get(task.id);
955
+ const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
956
+ task.on("SUBTASK", (subtasks) => {
957
+ this.renderer(subtasks);
958
+ });
959
+ task.on("STATE", (state) => {
960
+ if (!task.hasTitle())
961
+ return;
962
+ if (state === "STARTED")
963
+ this.logger.log("STARTED", task.title);
964
+ else if (state === "COMPLETED") {
965
+ const timer = rendererTaskOptions?.timer;
966
+ this.logger.log("COMPLETED", task.title, timer && { suffix: {
967
+ ...timer,
968
+ condition: !!task.message?.duration && timer.condition,
969
+ args: [task.message.duration]
970
+ } });
971
+ } else if (state === "PROMPT") {
972
+ this.logger.process.hijack();
973
+ task.on("PROMPT", (prompt) => {
974
+ this.logger.process.toStderr(prompt, false);
975
+ });
976
+ } else if (state === "PROMPT_COMPLETED") {
977
+ task.off("PROMPT");
978
+ this.logger.process.release();
979
+ } else if (state === "CANCELLED")
980
+ this.logger.log("CANCELLED", task.title);
981
+ });
982
+ task.on("OUTPUT", (output) => {
983
+ this.logger.log("OUTPUT", output);
984
+ });
985
+ task.on("MESSAGE", (message) => {
986
+ if (message.error)
987
+ this.logger.log("FAILED", task.title, { suffix: {
988
+ field: `FAILED: ${message.error}`,
989
+ format: () => color.red
990
+ } });
991
+ else if (message.skip)
992
+ this.logger.log("SKIPPED", task.title, { suffix: {
993
+ field: `SKIPPED: ${message.skip}`,
994
+ format: () => color.yellow
995
+ } });
996
+ else if (message.rollback)
997
+ this.logger.log("ROLLBACK", task.title, { suffix: {
998
+ field: `ROLLBACK: ${message.rollback}`,
999
+ format: () => color.red
1000
+ } });
1001
+ else if (message.retry)
1002
+ this.logger.log("RETRY", task.title, { suffix: {
1003
+ field: `RETRY:${message.retry.count}`,
1004
+ format: () => color.red
1005
+ } });
1006
+ else if (message.paused) {
1007
+ const timer = rendererOptions?.pausedTimer;
1008
+ this.logger.log("PAUSED", task.title, timer && { suffix: {
1009
+ ...timer,
1010
+ condition: !!message?.paused && timer.condition,
1011
+ args: [message.paused - Date.now()]
1012
+ } });
1013
+ }
1014
+ });
1015
+ });
1016
+ }
1017
+ calculate(task) {
1018
+ if (this.cache.rendererOptions.has(task.id) && this.cache.rendererTaskOptions.has(task.id))
1019
+ return;
1020
+ const rendererOptions = {
1021
+ ...this.options,
1022
+ ...task.rendererOptions
1023
+ };
1024
+ this.cache.rendererOptions.set(task.id, rendererOptions);
1025
+ this.cache.rendererTaskOptions.set(task.id, {
1026
+ ...SimpleRenderer2.rendererTaskOptions,
1027
+ timer: rendererOptions.timer,
1028
+ ...task.rendererTaskOptions
1029
+ });
1030
+ }
1031
+ reset(task) {
1032
+ this.cache.rendererOptions.delete(task.id);
1033
+ this.cache.rendererTaskOptions.delete(task.id);
1034
+ }
1035
+ };
1036
+ var TestRendererSerializer = class {
1037
+ options;
1038
+ constructor(options) {
1039
+ this.options = options;
1040
+ }
1041
+ serialize(event, data, task) {
1042
+ return JSON.stringify(this.generate(event, data, task));
1043
+ }
1044
+ generate(event, data, task) {
1045
+ const output = {
1046
+ event,
1047
+ data
1048
+ };
1049
+ if (typeof this.options?.task !== "boolean") {
1050
+ const t = Object.fromEntries(this.options.task.map((entity) => {
1051
+ const property = task[entity];
1052
+ if (typeof property === "function")
1053
+ return [entity, property.call(task)];
1054
+ return [entity, property];
1055
+ }));
1056
+ if (Object.keys(task).length > 0)
1057
+ output.task = t;
1058
+ }
1059
+ return output;
1060
+ }
1061
+ };
1062
+ var TestRenderer = class TestRenderer2 {
1063
+ tasks;
1064
+ options;
1065
+ static nonTTY = true;
1066
+ static rendererOptions = {
1067
+ subtasks: true,
1068
+ state: Object.values(ListrTaskState),
1069
+ output: true,
1070
+ prompt: true,
1071
+ title: true,
1072
+ messages: [
1073
+ "skip",
1074
+ "error",
1075
+ "retry",
1076
+ "rollback",
1077
+ "paused"
1078
+ ],
1079
+ messagesToStderr: [
1080
+ "error",
1081
+ "rollback",
1082
+ "retry"
1083
+ ],
1084
+ task: [
1085
+ "hasRolledBack",
1086
+ "isRollingBack",
1087
+ "isCompleted",
1088
+ "isSkipped",
1089
+ "hasFinalized",
1090
+ "hasSubtasks",
1091
+ "title",
1092
+ "hasReset",
1093
+ "hasTitle",
1094
+ "isPrompt",
1095
+ "isPaused",
1096
+ "isPending",
1097
+ "isCancelled",
1098
+ "isStarted",
1099
+ "hasFailed",
1100
+ "isEnabled",
1101
+ "isRetrying",
1102
+ "path"
1103
+ ]
1104
+ };
1105
+ static rendererTaskOptions;
1106
+ logger;
1107
+ serializer;
1108
+ constructor(tasks, options) {
1109
+ this.tasks = tasks;
1110
+ this.options = options;
1111
+ this.options = {
1112
+ ...TestRenderer2.rendererOptions,
1113
+ ...this.options
1114
+ };
1115
+ this.logger = this.options.logger ?? new ListrLogger({ useIcons: false });
1116
+ this.serializer = new TestRendererSerializer(this.options);
1117
+ }
1118
+ render() {
1119
+ this.renderer(this.tasks);
1120
+ }
1121
+ end() {}
1122
+ renderer(tasks) {
1123
+ tasks.forEach((task) => {
1124
+ if (this.options.subtasks)
1125
+ task.on("SUBTASK", (subtasks) => {
1126
+ this.renderer(subtasks);
1127
+ });
1128
+ if (this.options.state)
1129
+ task.on("STATE", (state) => {
1130
+ this.logger.toStdout(this.serializer.serialize("STATE", state, task));
1131
+ });
1132
+ if (this.options.output)
1133
+ task.on("OUTPUT", (data) => {
1134
+ this.logger.toStdout(this.serializer.serialize("OUTPUT", data, task));
1135
+ });
1136
+ if (this.options.prompt)
1137
+ task.on("PROMPT", (prompt) => {
1138
+ this.logger.toStdout(this.serializer.serialize("PROMPT", prompt, task));
1139
+ });
1140
+ if (this.options.title)
1141
+ task.on("TITLE", (title) => {
1142
+ this.logger.toStdout(this.serializer.serialize("TITLE", title, task));
1143
+ });
1144
+ task.on("MESSAGE", (message) => {
1145
+ const parsed = Object.fromEntries(Object.entries(message).map(([key, value]) => {
1146
+ if (this.options.messages.includes(key))
1147
+ return [key, value];
1148
+ }).filter(Boolean));
1149
+ if (Object.keys(parsed).length > 0) {
1150
+ const output = this.serializer.serialize("MESSAGE", parsed, task);
1151
+ if (this.options.messagesToStderr.some((state) => Object.keys(parsed).includes(state)))
1152
+ this.logger.toStderr(output);
1153
+ else
1154
+ this.logger.toStdout(output);
1155
+ }
1156
+ });
1157
+ });
1158
+ }
1159
+ };
1160
+ var VerboseRenderer = class VerboseRenderer2 {
1161
+ tasks;
1162
+ options;
1163
+ static nonTTY = true;
1164
+ static rendererOptions = {
1165
+ logTitleChange: false,
1166
+ pausedTimer: {
1167
+ ...PRESET_TIMER,
1168
+ format: () => color.yellowBright
1169
+ }
1170
+ };
1171
+ static rendererTaskOptions;
1172
+ logger;
1173
+ cache = {
1174
+ rendererOptions: /* @__PURE__ */ new Map,
1175
+ rendererTaskOptions: /* @__PURE__ */ new Map
1176
+ };
1177
+ constructor(tasks, options) {
1178
+ this.tasks = tasks;
1179
+ this.options = options;
1180
+ this.options = {
1181
+ ...VerboseRenderer2.rendererOptions,
1182
+ ...this.options,
1183
+ icon: {
1184
+ ...LISTR_LOGGER_STYLE.icon,
1185
+ ...options?.icon ?? {}
1186
+ },
1187
+ color: {
1188
+ ...LISTR_LOGGER_STYLE.color,
1189
+ ...options?.color ?? {}
1190
+ }
1191
+ };
1192
+ this.logger = this.options.logger ?? new ListrLogger({
1193
+ useIcons: false,
1194
+ toStderr: LISTR_LOGGER_STDERR_LEVELS
1195
+ });
1196
+ this.logger.options.icon = this.options.icon;
1197
+ this.logger.options.color = this.options.color;
1198
+ if (this.options.timestamp)
1199
+ this.logger.options.fields.prefix.unshift(this.options.timestamp);
1200
+ }
1201
+ render() {
1202
+ this.renderer(this.tasks);
1203
+ }
1204
+ end() {}
1205
+ renderer(tasks) {
1206
+ tasks.forEach((task) => {
1207
+ this.calculate(task);
1208
+ task.once("CLOSED", () => {
1209
+ this.reset(task);
1210
+ });
1211
+ const rendererOptions = this.cache.rendererOptions.get(task.id);
1212
+ const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
1213
+ task.on("SUBTASK", (subtasks) => {
1214
+ this.renderer(subtasks);
1215
+ });
1216
+ task.on("STATE", (state) => {
1217
+ if (!task.hasTitle())
1218
+ return;
1219
+ if (state === "STARTED")
1220
+ this.logger.log("STARTED", task.title);
1221
+ else if (state === "COMPLETED") {
1222
+ const timer = rendererTaskOptions.timer;
1223
+ this.logger.log("COMPLETED", task.title, timer && { suffix: {
1224
+ ...timer,
1225
+ condition: !!task.message?.duration && timer.condition,
1226
+ args: [task.message.duration]
1227
+ } });
1228
+ } else if (state === "CANCELLED")
1229
+ this.logger.log("CANCELLED", task.title);
1230
+ });
1231
+ task.on("OUTPUT", (data) => {
1232
+ this.logger.log("OUTPUT", data);
1233
+ });
1234
+ task.on("PROMPT", (prompt) => {
1235
+ const cleansed = cleanseAnsi(prompt);
1236
+ if (cleansed)
1237
+ this.logger.log("PROMPT", cleansed);
1238
+ });
1239
+ if (this.options?.logTitleChange !== false)
1240
+ task.on("TITLE", (title) => {
1241
+ this.logger.log("TITLE", title);
1242
+ });
1243
+ task.on("MESSAGE", (message) => {
1244
+ if (message?.error)
1245
+ this.logger.log("FAILED", message.error);
1246
+ else if (message?.skip)
1247
+ this.logger.log("SKIPPED", message.skip);
1248
+ else if (message?.rollback)
1249
+ this.logger.log("ROLLBACK", message.rollback);
1250
+ else if (message?.retry)
1251
+ this.logger.log("RETRY", task.title, { suffix: message.retry.count.toString() });
1252
+ else if (message?.paused) {
1253
+ const timer = rendererOptions?.pausedTimer;
1254
+ this.logger.log("PAUSED", task.title, timer && { suffix: {
1255
+ ...timer,
1256
+ condition: !!message?.paused && timer.condition,
1257
+ args: [message.paused - Date.now()]
1258
+ } });
1259
+ }
1260
+ });
1261
+ });
1262
+ }
1263
+ calculate(task) {
1264
+ if (this.cache.rendererOptions.has(task.id) && this.cache.rendererTaskOptions.has(task.id))
1265
+ return;
1266
+ const rendererOptions = {
1267
+ ...this.options,
1268
+ ...task.rendererOptions
1269
+ };
1270
+ this.cache.rendererOptions.set(task.id, rendererOptions);
1271
+ this.cache.rendererTaskOptions.set(task.id, {
1272
+ ...VerboseRenderer2.rendererTaskOptions,
1273
+ timer: rendererOptions.timer,
1274
+ ...task.rendererTaskOptions
1275
+ });
1276
+ }
1277
+ reset(task) {
1278
+ this.cache.rendererOptions.delete(task.id);
1279
+ this.cache.rendererTaskOptions.delete(task.id);
1280
+ }
1281
+ };
1282
+ var RENDERERS = {
1283
+ default: DefaultRenderer,
1284
+ simple: SimpleRenderer,
1285
+ verbose: VerboseRenderer,
1286
+ test: TestRenderer,
1287
+ silent: SilentRenderer
1288
+ };
1289
+ function isRendererSupported(renderer) {
1290
+ return process.stdout.isTTY === true || renderer.nonTTY === true;
1291
+ }
1292
+ function getRendererClass(renderer) {
1293
+ if (typeof renderer === "string")
1294
+ return RENDERERS[renderer] ?? RENDERERS.default;
1295
+ return typeof renderer === "function" ? renderer : RENDERERS.default;
1296
+ }
1297
+ function getRenderer(options) {
1298
+ if (assertFunctionOrSelf(options?.silentRendererCondition))
1299
+ return {
1300
+ renderer: getRendererClass("silent"),
1301
+ selection: "SILENT"
1302
+ };
1303
+ const r = {
1304
+ renderer: getRendererClass(options.renderer),
1305
+ options: options.rendererOptions,
1306
+ selection: "PRIMARY"
1307
+ };
1308
+ if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options?.fallbackRendererCondition))
1309
+ return {
1310
+ renderer: getRendererClass(options.fallbackRenderer),
1311
+ options: options.fallbackRendererOptions,
1312
+ selection: "SECONDARY"
1313
+ };
1314
+ return r;
1315
+ }
1316
+ function assertFunctionOrSelf(functionOrSelf, ...args) {
1317
+ if (typeof functionOrSelf === "function")
1318
+ return functionOrSelf(...args);
1319
+ else
1320
+ return functionOrSelf;
1321
+ }
1322
+ var Concurrency = class {
1323
+ concurrency;
1324
+ count;
1325
+ queue;
1326
+ constructor(options) {
1327
+ this.concurrency = options.concurrency;
1328
+ this.count = 0;
1329
+ this.queue = /* @__PURE__ */ new Set;
1330
+ }
1331
+ add(fn) {
1332
+ if (this.count < this.concurrency)
1333
+ return this.run(fn);
1334
+ return new Promise((resolve) => {
1335
+ const callback = () => resolve(this.run(fn));
1336
+ this.queue.add(callback);
1337
+ });
1338
+ }
1339
+ flush() {
1340
+ for (const callback of this.queue) {
1341
+ if (this.count >= this.concurrency)
1342
+ break;
1343
+ this.queue.delete(callback);
1344
+ callback();
1345
+ }
1346
+ }
1347
+ run(fn) {
1348
+ this.count++;
1349
+ const promise = fn();
1350
+ const cleanup = () => {
1351
+ this.count--;
1352
+ this.flush();
1353
+ };
1354
+ promise.then(cleanup, () => {
1355
+ this.queue.clear();
1356
+ });
1357
+ return promise;
1358
+ }
1359
+ };
1360
+ function delay(time) {
1361
+ return new Promise((resolve) => {
1362
+ setTimeout(resolve, time);
1363
+ });
1364
+ }
1365
+ var TaskWrapper = class {
1366
+ task;
1367
+ constructor(task) {
1368
+ this.task = task;
1369
+ }
1370
+ get title() {
1371
+ return this.task.title;
1372
+ }
1373
+ set title(title) {
1374
+ if (title === undefined || title === null) {
1375
+ this.task.titleReset$ = undefined;
1376
+ return;
1377
+ }
1378
+ title = Array.isArray(title) ? title : [title];
1379
+ this.task.title$ = splat(title.shift(), ...title);
1380
+ }
1381
+ get output() {
1382
+ return this.task.output;
1383
+ }
1384
+ set output(output) {
1385
+ if (output === null) {
1386
+ this.task.outputReset$ = null;
1387
+ return;
1388
+ }
1389
+ output = Array.isArray(output) ? output : [output];
1390
+ this.task.output$ = splat(output.shift(), ...output);
1391
+ }
1392
+ set promptOutput(output) {
1393
+ this.task.promptOutput$ = output;
1394
+ }
1395
+ get signal() {
1396
+ return this.task.listr.signal;
1397
+ }
1398
+ cancel() {
1399
+ this.task.listr.cancel();
1400
+ }
1401
+ newListr(task, options) {
1402
+ let tasks;
1403
+ if (typeof task === "function")
1404
+ tasks = task(this);
1405
+ else
1406
+ tasks = task;
1407
+ return new Listr(tasks, options, this.task);
1408
+ }
1409
+ report(error, type) {
1410
+ if (this.task.options.collectErrors)
1411
+ this.task.listr.errors?.push(new ListrError(error, type, this.task));
1412
+ this.task.message$ = { error: error.message ?? this.task?.title };
1413
+ }
1414
+ skip(message, ...metadata) {
1415
+ this.task.state$ = "SKIPPED";
1416
+ if (message)
1417
+ this.task.message$ = { skip: message ? splat(message, ...metadata) : this.task?.title };
1418
+ }
1419
+ fail(error) {
1420
+ return new ListrTaskFailure(error);
1421
+ }
1422
+ isRetrying() {
1423
+ return this.task.isRetrying() ? this.task.retry : { count: 0 };
1424
+ }
1425
+ prompt(adapter) {
1426
+ if (this.task.prompt)
1427
+ return this.task.prompt;
1428
+ return new adapter(this.task, this);
1429
+ }
1430
+ stdout(type) {
1431
+ return createWritable((chunk) => {
1432
+ switch (type) {
1433
+ case "PROMPT":
1434
+ this.promptOutput = chunk;
1435
+ break;
1436
+ default:
1437
+ this.output = chunk;
1438
+ }
1439
+ });
1440
+ }
1441
+ run(ctx) {
1442
+ return this.task.run(ctx, this);
1443
+ }
1444
+ };
1445
+ var ListrTaskEventManager = class extends EventManager {
1446
+ };
1447
+ var Task = class extends ListrTaskEventManager {
1448
+ listr;
1449
+ task;
1450
+ options;
1451
+ rendererOptions;
1452
+ rendererTaskOptions;
1453
+ id = randomUUID();
1454
+ state = "WAITING";
1455
+ subtasks;
1456
+ title;
1457
+ initialTitle;
1458
+ output;
1459
+ retry;
1460
+ message = {};
1461
+ prompt;
1462
+ parent;
1463
+ enabled;
1464
+ taskFn;
1465
+ closed;
1466
+ constructor(listr, task, options, rendererOptions, rendererTaskOptions) {
1467
+ super();
1468
+ this.listr = listr;
1469
+ this.task = task;
1470
+ this.options = options;
1471
+ this.rendererOptions = rendererOptions;
1472
+ this.rendererTaskOptions = rendererTaskOptions;
1473
+ if (task.title) {
1474
+ const title = Array.isArray(task?.title) ? task.title : [task.title];
1475
+ this.title = splat(title.shift(), ...title);
1476
+ this.initialTitle = this.title;
1477
+ }
1478
+ this.taskFn = task.task;
1479
+ this.parent = listr.parentTask;
1480
+ }
1481
+ set state$(state) {
1482
+ this.state = state;
1483
+ this.emit("STATE", state);
1484
+ if (this.hasSubtasks() && this.hasFailed()) {
1485
+ for (const subtask of this.subtasks)
1486
+ if (subtask.state === "STARTED")
1487
+ subtask.state$ = "FAILED";
1488
+ }
1489
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1490
+ }
1491
+ set output$(data) {
1492
+ this.output = data;
1493
+ this.emit("OUTPUT", data);
1494
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1495
+ }
1496
+ set outputReset$(data) {
1497
+ this.output = data;
1498
+ this.emit("OUTPUT_RESET");
1499
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1500
+ }
1501
+ set promptOutput$(data) {
1502
+ this.emit("PROMPT", data);
1503
+ if (cleanseAnsi(data))
1504
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1505
+ }
1506
+ set message$(data) {
1507
+ this.message = {
1508
+ ...this.message,
1509
+ ...data
1510
+ };
1511
+ this.emit("MESSAGE", data);
1512
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1513
+ }
1514
+ set title$(title) {
1515
+ this.title = title;
1516
+ this.emit("TITLE", title);
1517
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1518
+ }
1519
+ set titleReset$(data) {
1520
+ this.title = data;
1521
+ this.emit("TITLE_RESET");
1522
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1523
+ }
1524
+ get path() {
1525
+ return [...this.listr.path, this.initialTitle];
1526
+ }
1527
+ async check(ctx) {
1528
+ if (this.state === "WAITING") {
1529
+ this.enabled = await assertFunctionOrSelf(this.task?.enabled ?? true, ctx);
1530
+ this.emit("ENABLED", this.enabled);
1531
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1532
+ }
1533
+ return this.enabled;
1534
+ }
1535
+ hasSubtasks() {
1536
+ return this.subtasks?.length > 0;
1537
+ }
1538
+ hasFinalized() {
1539
+ return this.isCompleted() || this.hasFailed() || this.isSkipped() || this.hasRolledBack() || this.isCancelled();
1540
+ }
1541
+ isPending() {
1542
+ return this.isStarted() || this.isPrompt() || this.hasReset();
1543
+ }
1544
+ isStarted() {
1545
+ return this.state === "STARTED";
1546
+ }
1547
+ isSkipped() {
1548
+ return this.state === "SKIPPED";
1549
+ }
1550
+ isCompleted() {
1551
+ return this.state === "COMPLETED";
1552
+ }
1553
+ hasFailed() {
1554
+ return this.state === "FAILED";
1555
+ }
1556
+ isCancelled() {
1557
+ return this.state === "CANCELLED";
1558
+ }
1559
+ isRollingBack() {
1560
+ return this.state === "ROLLING_BACK";
1561
+ }
1562
+ hasRolledBack() {
1563
+ return this.state === "ROLLED_BACK";
1564
+ }
1565
+ isRetrying() {
1566
+ return this.state === "RETRY";
1567
+ }
1568
+ hasReset() {
1569
+ return this.state === "RETRY" || this.state === "ROLLING_BACK";
1570
+ }
1571
+ isEnabled() {
1572
+ return this.enabled;
1573
+ }
1574
+ hasTitle() {
1575
+ return typeof this?.title === "string";
1576
+ }
1577
+ isPrompt() {
1578
+ return this.state === "PROMPT";
1579
+ }
1580
+ isPaused() {
1581
+ return this.state === "PAUSED";
1582
+ }
1583
+ isClosed() {
1584
+ return this.closed;
1585
+ }
1586
+ async pause(time) {
1587
+ const state = this.state;
1588
+ this.state$ = "PAUSED";
1589
+ this.message$ = { paused: Date.now() + time };
1590
+ await delay(time);
1591
+ this.state$ = state;
1592
+ this.message$ = { paused: null };
1593
+ }
1594
+ async run(context, wrapper) {
1595
+ const handleResult = (result) => {
1596
+ if (result instanceof ListrTaskFailure)
1597
+ throw result;
1598
+ else if (result instanceof Listr) {
1599
+ result.options = {
1600
+ ...this.options,
1601
+ ...result.options
1602
+ };
1603
+ result.rendererClass = getRendererClass("silent");
1604
+ this.subtasks = result.tasks;
1605
+ result.errors = this.listr.errors;
1606
+ this.emit("SUBTASK", this.subtasks);
1607
+ result = result.run(context);
1608
+ } else if (result instanceof Promise)
1609
+ result = result.then(handleResult);
1610
+ else if (isReadable(result))
1611
+ result = new Promise((resolve, reject) => {
1612
+ result.on("data", (data) => {
1613
+ this.output$ = data.toString();
1614
+ });
1615
+ result.on("error", (error) => reject(error));
1616
+ result.on("end", () => resolve(null));
1617
+ });
1618
+ else if (isObservable(result))
1619
+ result = new Promise((resolve, reject) => {
1620
+ result.subscribe({
1621
+ next: (data) => {
1622
+ this.output$ = data;
1623
+ },
1624
+ error: reject,
1625
+ complete: resolve
1626
+ });
1627
+ });
1628
+ return result;
1629
+ };
1630
+ const startTime = Date.now();
1631
+ this.state$ = "STARTED";
1632
+ const skipped = await assertFunctionOrSelf(this.task?.skip ?? false, context);
1633
+ if (skipped) {
1634
+ if (typeof skipped === "string")
1635
+ this.message$ = { skip: skipped };
1636
+ else if (this.hasTitle())
1637
+ this.message$ = { skip: this.title };
1638
+ else
1639
+ this.message$ = { skip: "Skipped task without a title." };
1640
+ this.state$ = "SKIPPED";
1641
+ return;
1642
+ }
1643
+ try {
1644
+ const retryCount = typeof this.task?.retry === "number" && this.task.retry > 0 ? this.task.retry + 1 : typeof this.task?.retry === "object" && this.task.retry.tries > 0 ? this.task.retry.tries + 1 : 1;
1645
+ const retryDelay = typeof this.task.retry === "object" && this.task.retry.delay;
1646
+ for (let retries = 1;retries <= retryCount; retries++)
1647
+ try {
1648
+ await Promise.race([handleResult(this.taskFn(context, wrapper)), this.whenInterrupted()]);
1649
+ break;
1650
+ } catch (err) {
1651
+ if (err instanceof ListrTaskFailure)
1652
+ throw err.error;
1653
+ if (this.listr.signal.aborted)
1654
+ throw err;
1655
+ if (retries !== retryCount) {
1656
+ const retry = {
1657
+ count: retries,
1658
+ error: err
1659
+ };
1660
+ let time;
1661
+ if (typeof retryDelay === "function") {
1662
+ let onAbort;
1663
+ try {
1664
+ time = await Promise.race([retryDelay(retry, context), new Promise((_, reject) => {
1665
+ onAbort = () => reject(err);
1666
+ this.listr.signal.addEventListener("abort", onAbort, { once: true });
1667
+ })]);
1668
+ } catch (delayError) {
1669
+ throw this.listr.signal.aborted ? err : delayError;
1670
+ } finally {
1671
+ this.listr.signal.removeEventListener("abort", onAbort);
1672
+ }
1673
+ if (this.listr.signal.aborted)
1674
+ throw err;
1675
+ } else
1676
+ time = retryDelay;
1677
+ this.retry = retry;
1678
+ this.message$ = { retry: this.retry };
1679
+ this.title$ = this.initialTitle;
1680
+ this.output = undefined;
1681
+ wrapper.report(err, "WILL_RETRY");
1682
+ this.state$ = "RETRY";
1683
+ if (time)
1684
+ await this.pause(time);
1685
+ } else
1686
+ throw err;
1687
+ }
1688
+ if (this.isStarted() || this.isRetrying()) {
1689
+ this.message$ = { duration: Date.now() - startTime };
1690
+ this.state$ = "COMPLETED";
1691
+ }
1692
+ } catch (error) {
1693
+ if (this.prompt instanceof PromptError)
1694
+ error = this.prompt;
1695
+ if (this.task?.rollback) {
1696
+ wrapper.report(error, "WILL_ROLLBACK");
1697
+ try {
1698
+ this.state$ = "ROLLING_BACK";
1699
+ await this.task.rollback(context, wrapper);
1700
+ this.message$ = { rollback: this.title };
1701
+ this.state$ = "ROLLED_BACK";
1702
+ } catch (err) {
1703
+ this.state$ = "FAILED";
1704
+ wrapper.report(err, "HAS_FAILED_TO_ROLLBACK");
1705
+ this.close();
1706
+ throw err;
1707
+ }
1708
+ if (this.listr.options?.exitAfterRollback !== false) {
1709
+ this.close();
1710
+ throw error;
1711
+ }
1712
+ } else {
1713
+ if (this.listr.signal.aborted) {
1714
+ this.state$ = "CANCELLED";
1715
+ throw error;
1716
+ }
1717
+ this.state$ = "FAILED";
1718
+ if (this.listr.options.exitOnError !== false && await assertFunctionOrSelf(this.task?.exitOnError, context) !== false) {
1719
+ wrapper.report(error, "HAS_FAILED");
1720
+ this.close();
1721
+ throw error;
1722
+ } else if (!this.hasSubtasks())
1723
+ wrapper.report(error, "HAS_FAILED_WITHOUT_ERROR");
1724
+ }
1725
+ } finally {
1726
+ this.close();
1727
+ }
1728
+ }
1729
+ close() {
1730
+ this.emit("CLOSED");
1731
+ this.listr.events.emit("SHOUD_REFRESH_RENDER");
1732
+ this.complete();
1733
+ }
1734
+ whenInterrupted() {
1735
+ return new Promise((_, reject) => {
1736
+ const onAbort = () => {
1737
+ if (!this.hasSubtasks())
1738
+ reject(/* @__PURE__ */ new Error("Interrupted."));
1739
+ };
1740
+ if (this.listr.signal.aborted) {
1741
+ onAbort();
1742
+ return;
1743
+ }
1744
+ this.listr.signal.addEventListener("abort", onAbort, { once: true });
1745
+ });
1746
+ }
1747
+ };
1748
+ var ListrEventManager = class extends EventManager {
1749
+ };
1750
+ var Listr = class {
1751
+ task;
1752
+ options;
1753
+ parentTask;
1754
+ tasks = [];
1755
+ errors;
1756
+ ctx;
1757
+ events;
1758
+ path = [];
1759
+ rendererClass;
1760
+ rendererClassOptions;
1761
+ rendererSelection;
1762
+ boundSignalHandler;
1763
+ signal;
1764
+ concurrency;
1765
+ renderer;
1766
+ abortController;
1767
+ startedTasks = [];
1768
+ constructor(task, options, parentTask) {
1769
+ this.task = task;
1770
+ this.options = options;
1771
+ this.parentTask = parentTask;
1772
+ this.options = {
1773
+ concurrent: false,
1774
+ renderer: "default",
1775
+ fallbackRenderer: "simple",
1776
+ exitOnError: true,
1777
+ exitAfterRollback: true,
1778
+ collectErrors: false,
1779
+ registerSignalListeners: true,
1780
+ ...this.parentTask?.options ?? {},
1781
+ ...options
1782
+ };
1783
+ if (this.options.concurrent === true)
1784
+ this.options.concurrent = Infinity;
1785
+ else if (typeof this.options.concurrent !== "number")
1786
+ this.options.concurrent = 1;
1787
+ this.concurrency = new Concurrency({ concurrency: this.options.concurrent });
1788
+ if (parentTask) {
1789
+ this.path = [...parentTask.listr.path, parentTask.title];
1790
+ this.errors = parentTask.listr.errors;
1791
+ } else
1792
+ this.errors = this.options.collectErrors ? [] : null;
1793
+ if (this.parentTask?.listr.events instanceof ListrEventManager)
1794
+ this.events = this.parentTask.listr.events;
1795
+ else
1796
+ this.events = new ListrEventManager;
1797
+ if (this.parentTask?.listr.abortController instanceof AbortController)
1798
+ this.abortController = this.parentTask.listr.abortController;
1799
+ else {
1800
+ this.abortController = new AbortController;
1801
+ setMaxListeners(0, this.abortController.signal);
1802
+ }
1803
+ this.signal = this.abortController.signal;
1804
+ if (this.options?.forceTTY || process.env["LISTR_FORCE_TTY"]) {
1805
+ process.stdout.isTTY = true;
1806
+ process.stderr.isTTY = true;
1807
+ }
1808
+ if (this.options?.forceUnicode)
1809
+ process.env["LISTR_FORCE_UNICODE"] = "1";
1810
+ const renderer = getRenderer({
1811
+ renderer: this.options.renderer,
1812
+ rendererOptions: this.options.rendererOptions,
1813
+ fallbackRenderer: this.options.fallbackRenderer,
1814
+ fallbackRendererOptions: this.options.fallbackRendererOptions,
1815
+ fallbackRendererCondition: this.options?.fallbackRendererCondition,
1816
+ silentRendererCondition: this.options?.silentRendererCondition
1817
+ });
1818
+ this.rendererClass = renderer.renderer;
1819
+ this.rendererClassOptions = renderer.options;
1820
+ this.rendererSelection = renderer.selection;
1821
+ this.add(task ?? []);
1822
+ if (this.options.registerSignalListeners && this.isRoot()) {
1823
+ this.boundSignalHandler = this.signalHandler.bind(this);
1824
+ process.on("SIGINT", this.boundSignalHandler).setMaxListeners(0);
1825
+ }
1826
+ }
1827
+ isRoot() {
1828
+ return !this.parentTask;
1829
+ }
1830
+ isSubtask() {
1831
+ return !!this.parentTask;
1832
+ }
1833
+ add(tasks) {
1834
+ this.tasks.push(...this.generate(tasks));
1835
+ }
1836
+ async run(context) {
1837
+ if (!this.renderer)
1838
+ this.renderer = new this.rendererClass(this.tasks, this.rendererClassOptions, this.events);
1839
+ await this.renderer.render();
1840
+ this.ctx = this.options?.ctx ?? context ?? {};
1841
+ let error;
1842
+ let failed = false;
1843
+ try {
1844
+ await Promise.all(this.tasks.map((task) => task.check(this.ctx)));
1845
+ await Promise.all(this.tasks.map((task) => this.concurrency.add(() => this.runTask(task))));
1846
+ } catch (err) {
1847
+ failed = true;
1848
+ error = err;
1849
+ }
1850
+ if (this.signal.aborted) {
1851
+ await Promise.allSettled(this.startedTasks);
1852
+ if (this.isRoot()) {
1853
+ this.cancelUnfinishedTasks();
1854
+ this.renderer.end();
1855
+ this.removeSignalHandler();
1856
+ process.exit(127);
1857
+ return this.ctx;
1858
+ }
1859
+ throw error ?? /* @__PURE__ */ new Error("Interrupted.");
1860
+ }
1861
+ if (failed && this.options.exitOnError !== false) {
1862
+ this.renderer.end(error);
1863
+ this.removeSignalHandler();
1864
+ throw error;
1865
+ }
1866
+ if (!failed) {
1867
+ this.renderer.end();
1868
+ this.removeSignalHandler();
1869
+ }
1870
+ return this.ctx;
1871
+ }
1872
+ cancel() {
1873
+ this.abortController.abort();
1874
+ }
1875
+ generate(tasks) {
1876
+ tasks = Array.isArray(tasks) ? tasks : [tasks];
1877
+ return tasks.map((task) => {
1878
+ let rendererTaskOptions;
1879
+ if (this.rendererSelection === "PRIMARY")
1880
+ rendererTaskOptions = task.rendererOptions;
1881
+ else if (this.rendererSelection === "SECONDARY")
1882
+ rendererTaskOptions = task.fallbackRendererOptions;
1883
+ return new Task(this, task, this.options, this.rendererClassOptions, rendererTaskOptions);
1884
+ });
1885
+ }
1886
+ async runTask(task) {
1887
+ if (!await task.check(this.ctx))
1888
+ return;
1889
+ const promise = new TaskWrapper(task).run(this.ctx);
1890
+ this.startedTasks.push(promise);
1891
+ return promise;
1892
+ }
1893
+ signalHandler() {
1894
+ this.abortController.abort();
1895
+ }
1896
+ removeSignalHandler() {
1897
+ if (this.boundSignalHandler)
1898
+ process.removeListener("SIGINT", this.boundSignalHandler);
1899
+ }
1900
+ cancelUnfinishedTasks(tasks = this.tasks) {
1901
+ for (const task of tasks) {
1902
+ if (task.hasSubtasks())
1903
+ this.cancelUnfinishedTasks(task.subtasks);
1904
+ if (task.isEnabled() !== false && !task.hasFinalized())
1905
+ task.state$ = "CANCELLED";
1906
+ }
1907
+ }
1908
+ };
1909
+
1910
+ // src/lib/steps.ts
1911
+ var import_picocolors = __toESM(require_picocolors(), 1);
1912
+ function commandStep(title, cmd, opts = {}) {
1913
+ return {
1914
+ title,
1915
+ task: async (update) => {
1916
+ const { code, output } = await runLines(cmd, { ...opts, onLine: update });
1917
+ if (code !== 0)
1918
+ throw new ProcError(cmd, code, output);
1919
+ }
1920
+ };
1921
+ }
1922
+ var isGroup = (s) => ("steps" in s);
1923
+ async function runSteps(items, flags, opts = {}) {
1924
+ const results = [];
1925
+ const stream = colorEnabled() ? process.stderr : plainStderr();
1926
+ const out = new ProcessOutput(stream, stream);
1927
+ const logger = new ListrLogger({ processOutput: out, useIcons: true });
1928
+ const tty = !!process.stderr.isTTY && !flags.ci && !flags.verbose;
1929
+ const streaming = !tty && !flags.quiet && !flags.json;
1930
+ let failed = false;
1931
+ const toTask = (s, group) => ({
1932
+ title: group ? `${import_picocolors.default.dim(`${group} \u203A`)} ${s.title}` : s.title,
1933
+ skip: () => opts.bail && failed || interrupted(),
1934
+ task: async (_ctx, task) => {
1935
+ const start = performance.now();
1936
+ const update = (raw) => {
1937
+ const line = redact(raw);
1938
+ if (streaming)
1939
+ stream.write(`${import_picocolors.default.dim("\u2502")} ${line}
1940
+ `);
1941
+ else
1942
+ task.output = line;
1943
+ };
1944
+ try {
1945
+ await s.task(update);
1946
+ results.push({ group, title: s.title, ok: true, ms: performance.now() - start });
1947
+ } catch (e) {
1948
+ failed = true;
1949
+ results.push({
1950
+ group,
1951
+ title: s.title,
1952
+ ok: false,
1953
+ ms: performance.now() - start,
1954
+ error: redact(e instanceof Error ? e.message : String(e)),
1955
+ output: e instanceof ProcError && e.output ? redact(e.output) : undefined
1956
+ });
1957
+ throw e;
1958
+ }
1959
+ }
1960
+ });
1961
+ const tasks = items.flatMap((item) => isGroup(item) ? item.steps.map((s) => toTask(s, item.title)) : [toTask(item)]);
1962
+ const list = new Listr(tasks, {
1963
+ concurrent: false,
1964
+ exitOnError: opts.bail ?? false,
1965
+ renderer: "default",
1966
+ rendererOptions: { logger, collapseSubtasks: false, collapseErrors: true, showErrorMessage: false },
1967
+ fallbackRenderer: "simple",
1968
+ fallbackRendererOptions: { logger },
1969
+ fallbackRendererCondition: !tty,
1970
+ forceTTY: tty,
1971
+ silentRendererCondition: flags.json || flags.quiet,
1972
+ registerSignalListeners: false
1973
+ });
1974
+ try {
1975
+ await list.run();
1976
+ } catch {}
1977
+ if (!flags.json && (!streaming || flags.quiet)) {
1978
+ for (const r of results.filter((x) => !x.ok && x.output?.trim())) {
1979
+ process.stderr.write(`
1980
+ ${import_picocolors.default.red(import_picocolors.default.bold(`\u2500\u2500 ${label(r)} \u2500\u2500`))}
1981
+ ${r.output}
1982
+ `);
1983
+ }
1984
+ }
1985
+ return results;
1986
+ }
1987
+ var label = (r) => r.group ? `${r.group} \u203A ${r.title}` : r.title;
1988
+ function summarize(verb, results, startedAt, hint) {
1989
+ const secs = ((performance.now() - startedAt) / 1000).toFixed(1);
1990
+ const failed = results.filter((r) => !r.ok);
1991
+ if (interrupted()) {
1992
+ process.stderr.write(`${import_picocolors.default.yellow("\u25B2")} ${verb} interrupted
1993
+ `);
1994
+ return 130;
1995
+ }
1996
+ if (failed.length) {
1997
+ process.stderr.write(`
1998
+ ${import_picocolors.default.red("\u2716")} ${verb} failed: ${failed.map(label).join(", ")} ${import_picocolors.default.dim(`(${secs}s)`)}
1999
+ `);
2000
+ if (hint)
2001
+ process.stderr.write(` ${import_picocolors.default.dim("\u203A")} ${hint}
2002
+ `);
2003
+ return 1;
2004
+ }
2005
+ process.stderr.write(`
2006
+ ${import_picocolors.default.green("\u2714")} ${verb} passed ${import_picocolors.default.dim(`(${results.length} steps, ${secs}s)`)}
2007
+ `);
2008
+ return 0;
2009
+ }
2010
+ var colorEnabled = () => !process.env.NO_COLOR || !!process.env.FORCE_COLOR;
2011
+ function plainStderr() {
2012
+ const w = new Writable2({
2013
+ write(chunk, _enc, cb) {
2014
+ process.stderr.write(Bun.stripANSI(String(chunk)), cb);
2015
+ }
2016
+ });
2017
+ return Object.assign(w, {
2018
+ isTTY: false,
2019
+ columns: process.stderr.columns ?? 80
2020
+ });
2021
+ }
2022
+
2023
+ export { commandStep, runSteps, summarize };