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