@reliverse/rempts 1.7.28 → 1.7.30

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 (131) hide show
  1. package/README.md +176 -37
  2. package/bin/{components/visual/animate/animate.d.ts → libs/animate/animate-mod.d.ts} +1 -1
  3. package/bin/{components/visual/animate/animate.js → libs/animate/animate-mod.js} +2 -5
  4. package/bin/{components → libs}/anykey/anykey-mod.d.ts +2 -2
  5. package/bin/{components → libs}/anykey/anykey-mod.js +3 -3
  6. package/bin/libs/cancel/cancel.d.ts +45 -0
  7. package/bin/libs/cancel/cancel.js +72 -0
  8. package/bin/libs/confirm/confirm-alias.d.ts +1 -0
  9. package/bin/libs/confirm/confirm-alias.js +2 -0
  10. package/bin/{components/input/confirm-prompt.js → libs/confirm/confirm-mod.js} +1 -1
  11. package/bin/{components → libs}/editor/editor-mod.d.ts +4 -4
  12. package/bin/{components → libs}/editor/editor-mod.js +8 -8
  13. package/bin/{components → libs}/figures/figures-mod.d.ts +2 -3
  14. package/bin/{components → libs}/figures/figures-mod.js +1 -2
  15. package/bin/libs/input/input-alias.d.ts +4 -0
  16. package/bin/libs/input/input-alias.js +4 -0
  17. package/bin/{components/input/input-prompt.js → libs/input/input-mod.js} +2 -2
  18. package/bin/libs/intro/intro-alias.d.ts +2 -0
  19. package/bin/libs/intro/intro-alias.js +3 -0
  20. package/bin/{components/st-end/start.d.ts → libs/intro/intro-mod.d.ts} +4 -1
  21. package/bin/{components/st-end/start.js → libs/intro/intro-mod.js} +35 -21
  22. package/bin/libs/launcher/launcher-alias.d.ts +2 -0
  23. package/bin/libs/launcher/launcher-alias.js +2 -0
  24. package/bin/{components → libs}/launcher/launcher-mod.d.ts +37 -5
  25. package/bin/{components → libs}/launcher/launcher-mod.js +326 -205
  26. package/bin/{components → libs}/launcher/launcher-types.d.ts +15 -18
  27. package/bin/libs/launcher/trpc-orpc-support/completions.d.ts +4 -0
  28. package/bin/libs/launcher/trpc-orpc-support/completions.js +45 -0
  29. package/bin/libs/launcher/trpc-orpc-support/errors.d.ts +11 -0
  30. package/bin/libs/launcher/trpc-orpc-support/errors.js +10 -0
  31. package/bin/libs/launcher/trpc-orpc-support/index.d.ts +34 -0
  32. package/bin/libs/launcher/trpc-orpc-support/index.js +641 -0
  33. package/bin/libs/launcher/trpc-orpc-support/json-schema.d.ts +17 -0
  34. package/bin/libs/launcher/trpc-orpc-support/json-schema.js +168 -0
  35. package/bin/libs/launcher/trpc-orpc-support/json.d.ts +44 -0
  36. package/bin/libs/launcher/trpc-orpc-support/json.js +41 -0
  37. package/bin/libs/launcher/trpc-orpc-support/logging.d.ts +11 -0
  38. package/bin/libs/launcher/trpc-orpc-support/logging.js +26 -0
  39. package/bin/libs/launcher/trpc-orpc-support/parse-procedure.d.ts +2 -0
  40. package/bin/libs/launcher/trpc-orpc-support/parse-procedure.js +486 -0
  41. package/bin/libs/launcher/trpc-orpc-support/prompts.d.ts +18 -0
  42. package/bin/libs/launcher/trpc-orpc-support/prompts.js +534 -0
  43. package/bin/libs/launcher/trpc-orpc-support/standard-schema/contract.d.ts +53 -0
  44. package/bin/libs/launcher/trpc-orpc-support/standard-schema/contract.js +0 -0
  45. package/bin/libs/launcher/trpc-orpc-support/standard-schema/errors.d.ts +9 -0
  46. package/bin/libs/launcher/trpc-orpc-support/standard-schema/errors.js +47 -0
  47. package/bin/libs/launcher/trpc-orpc-support/standard-schema/utils.d.ts +3 -0
  48. package/bin/libs/launcher/trpc-orpc-support/standard-schema/utils.js +6 -0
  49. package/bin/libs/launcher/trpc-orpc-support/trpc-compat.d.ts +71 -0
  50. package/bin/libs/launcher/trpc-orpc-support/trpc-compat.js +11 -0
  51. package/bin/libs/launcher/trpc-orpc-support/types.d.ts +276 -0
  52. package/bin/libs/launcher/trpc-orpc-support/types.js +0 -0
  53. package/bin/libs/launcher/trpc-orpc-support/util.d.ts +9 -0
  54. package/bin/libs/launcher/trpc-orpc-support/util.js +9 -0
  55. package/bin/libs/log/log-alias.d.ts +2 -0
  56. package/bin/libs/log/log-alias.js +2 -0
  57. package/bin/{components → libs}/msg-fmt/logger.js +1 -1
  58. package/bin/libs/multiselect/multiselect-alias.d.ts +1 -0
  59. package/bin/libs/multiselect/multiselect-alias.js +2 -0
  60. package/bin/{components/select → libs/multiselect}/multiselect-prompt.js +1 -1
  61. package/bin/{components → libs}/next-steps/next-steps.d.ts +2 -2
  62. package/bin/{components → libs}/number/number-mod.d.ts +2 -2
  63. package/bin/{components → libs}/number/number-mod.js +1 -4
  64. package/bin/libs/outro/outro-alias.d.ts +2 -0
  65. package/bin/libs/outro/outro-alias.js +3 -0
  66. package/bin/libs/outro/outro-mod.d.ts +8 -0
  67. package/bin/libs/outro/outro-mod.js +55 -0
  68. package/bin/{components → libs}/results/results.d.ts +2 -2
  69. package/bin/libs/select/aliases-alias.d.ts +1 -0
  70. package/bin/libs/select/aliases-alias.js +2 -0
  71. package/bin/{components → libs}/select/select-prompt.d.ts +6 -5
  72. package/bin/{components → libs}/select/select-prompt.js +6 -4
  73. package/bin/{components → libs}/select/toggle-prompt.js +1 -1
  74. package/bin/libs/spinner/spinner-alias.d.ts +1 -0
  75. package/bin/libs/spinner/spinner-alias.js +2 -0
  76. package/bin/libs/spinner/spinner-mod.d.ts +106 -0
  77. package/bin/libs/spinner/spinner-mod.js +265 -0
  78. package/bin/{components → libs}/task/progress.d.ts +1 -1
  79. package/bin/{components → libs}/task/progress.js +1 -1
  80. package/bin/{components/task/spinner.d.ts → libs/task/task-spin.d.ts} +3 -3
  81. package/bin/{components/task/spinner.js → libs/task/task-spin.js} +2 -2
  82. package/bin/{utils → libs/utils}/colorize.d.ts +1 -1
  83. package/bin/{utils → libs/utils}/prevent.d.ts +1 -1
  84. package/bin/{utils → libs/utils}/prevent.js +2 -2
  85. package/bin/{utils → libs/utils}/prompt-end.d.ts +1 -1
  86. package/bin/{utils → libs/utils}/prompt-end.js +2 -2
  87. package/bin/{utils → libs/utils}/stream-text.d.ts +1 -1
  88. package/bin/{utils → libs/utils}/stream-text.js +2 -2
  89. package/bin/{utils → libs/utils}/validate.d.ts +2 -2
  90. package/bin/mod.d.ts +66 -38
  91. package/bin/mod.js +102 -43
  92. package/bin/types.d.ts +36 -36
  93. package/package.json +17 -3
  94. package/bin/components/st-end/end.d.ts +0 -2
  95. package/bin/components/st-end/end.js +0 -42
  96. package/bin/hooks/spinner/spinner-mod.d.ts +0 -64
  97. package/bin/hooks/spinner/spinner-mod.js +0 -74
  98. /package/bin/{components/input/confirm-prompt.d.ts → libs/confirm/confirm-mod.d.ts} +0 -0
  99. /package/bin/{components → libs}/date/date.d.ts +0 -0
  100. /package/bin/{components → libs}/date/date.js +0 -0
  101. /package/bin/{components/input/input-prompt.d.ts → libs/input/input-mod.d.ts} +0 -0
  102. /package/bin/{components → libs}/launcher/launcher-types.js +0 -0
  103. /package/bin/{components → libs}/launcher/run-command.d.ts +0 -0
  104. /package/bin/{components → libs}/launcher/run-command.js +0 -0
  105. /package/bin/{components → libs}/msg-fmt/colors.d.ts +0 -0
  106. /package/bin/{components → libs}/msg-fmt/colors.js +0 -0
  107. /package/bin/{components → libs}/msg-fmt/logger.d.ts +0 -0
  108. /package/bin/{components → libs}/msg-fmt/mapping.d.ts +0 -0
  109. /package/bin/{components → libs}/msg-fmt/mapping.js +0 -0
  110. /package/bin/{components → libs}/msg-fmt/messages.d.ts +0 -0
  111. /package/bin/{components → libs}/msg-fmt/messages.js +0 -0
  112. /package/bin/{components → libs}/msg-fmt/terminal.d.ts +0 -0
  113. /package/bin/{components → libs}/msg-fmt/terminal.js +0 -0
  114. /package/bin/{components → libs}/msg-fmt/variants.d.ts +0 -0
  115. /package/bin/{components → libs}/msg-fmt/variants.js +0 -0
  116. /package/bin/{components/select → libs/multiselect}/multiselect-prompt.d.ts +0 -0
  117. /package/bin/{components → libs}/next-steps/next-steps.js +0 -0
  118. /package/bin/{components → libs}/results/results.js +0 -0
  119. /package/bin/{components → libs}/select/nummultiselect-prompt.d.ts +0 -0
  120. /package/bin/{components → libs}/select/nummultiselect-prompt.js +0 -0
  121. /package/bin/{components → libs}/select/numselect-prompt.d.ts +0 -0
  122. /package/bin/{components → libs}/select/numselect-prompt.js +0 -0
  123. /package/bin/{components → libs}/select/toggle-prompt.d.ts +0 -0
  124. /package/bin/{utils → libs/utils}/colorize.js +0 -0
  125. /package/bin/{utils → libs/utils}/errors.d.ts +0 -0
  126. /package/bin/{utils → libs/utils}/errors.js +0 -0
  127. /package/bin/{utils → libs/utils}/system.d.ts +0 -0
  128. /package/bin/{utils → libs/utils}/system.js +0 -0
  129. /package/bin/{utils → libs/utils}/validate.js +0 -0
  130. /package/bin/{components/visual/ascii-art/ascii-art.d.ts → libs/visual/visual-mod.d.ts} +0 -0
  131. /package/bin/{components/visual/ascii-art/ascii-art.js → libs/visual/visual-mod.js} +0 -0
@@ -0,0 +1,106 @@
1
+ interface SpinnerOptions {
2
+ cancelMessage?: string;
3
+ color?: string;
4
+ delay?: number;
5
+ errorMessage?: string;
6
+ failText?: string;
7
+ frames?: string[];
8
+ hideCursor?: boolean;
9
+ indicator?: "dots" | "timer";
10
+ onCancel?: () => void;
11
+ prefixText?: string;
12
+ signal?: AbortSignal;
13
+ silent?: boolean;
14
+ spinner?: string;
15
+ successText?: string;
16
+ text: string;
17
+ }
18
+ interface ProgressOptions {
19
+ current: number;
20
+ total: number;
21
+ format?: "percentage" | "count" | "both";
22
+ }
23
+ interface SpinnerControls {
24
+ start: (text?: string) => SpinnerControls;
25
+ stop: (text?: string, code?: number) => void;
26
+ setText: (text: string) => void;
27
+ setProgress: (progress: ProgressOptions) => void;
28
+ succeed: (text?: string) => void;
29
+ fail: (text?: string) => void;
30
+ warn: (text?: string) => void;
31
+ info: (text?: string) => void;
32
+ isSpinning: () => boolean;
33
+ clear: () => void;
34
+ getElapsedTime: () => number;
35
+ pause: () => void;
36
+ resume: () => void;
37
+ dispose: () => void;
38
+ isCancelled: boolean;
39
+ }
40
+ /**
41
+ * Creates a terminal spinner with enhanced controls and styling options.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * // Basic usage
46
+ * const spinner = useSpinner({ text: "Loading..." }).start();
47
+ * spinner.stop();
48
+ *
49
+ * // With progress tracking
50
+ * const spinner = useSpinner({ text: "Processing files..." }).start();
51
+ * for (let i = 0; i < files.length; i++) {
52
+ * spinner.setProgress({ current: i + 1, total: files.length });
53
+ * await processFile(files[i]);
54
+ * }
55
+ * spinner.succeed();
56
+ *
57
+ * // With custom color and spinner
58
+ * const spinner = useSpinner({
59
+ * text: "Processing...",
60
+ * color: "cyan",
61
+ * spinner: "dots"
62
+ * }).start();
63
+ *
64
+ * // With success/failure states
65
+ * const spinner = useSpinner({
66
+ * text: "Uploading...",
67
+ * successText: "Upload complete!",
68
+ * failText: "Upload failed!"
69
+ * }).start();
70
+ * try {
71
+ * await uploadFile();
72
+ * spinner.succeed();
73
+ * } catch (error) {
74
+ * spinner.fail();
75
+ * }
76
+ *
77
+ * // Using the wrapper for async operations
78
+ * await useSpinner.promise(
79
+ * async (spinner) => {
80
+ * await longOperation();
81
+ * spinner.setProgress({ current: 50, total: 100 });
82
+ * },
83
+ * {
84
+ * text: "Working...",
85
+ * successText: "Done!",
86
+ * failText: "Failed!"
87
+ * }
88
+ * );
89
+ * ```
90
+ */
91
+ export declare function useSpinner(options: SpinnerOptions): SpinnerControls;
92
+ export declare namespace useSpinner {
93
+ var promise: <T>(operation: (spinner: SpinnerControls) => Promise<T>, options: SpinnerOptions) => Promise<T>;
94
+ var nested: (parentOptions: SpinnerOptions) => {
95
+ start: () => {
96
+ child: (childOptions: SpinnerOptions) => SpinnerControls;
97
+ finish: (success: boolean, text?: string) => void;
98
+ dispose: () => void;
99
+ };
100
+ };
101
+ var withTiming: <T>(operation: (spinner: SpinnerControls) => Promise<T>, options: SpinnerOptions) => Promise<{
102
+ result: T;
103
+ duration: number;
104
+ }>;
105
+ }
106
+ export {};
@@ -0,0 +1,265 @@
1
+ import { re } from "@reliverse/relico";
2
+ import { block } from "../cancel/cancel.js";
3
+ const unicode = process.platform !== "win32" || process.env.TERM_PROGRAM === "vscode";
4
+ const defaultFrames = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"];
5
+ const defaultDelay = unicode ? 80 : 120;
6
+ function isInteractive() {
7
+ return process.stdout.isTTY && !process.env.CI && !process.env.GITHUB_ACTIONS && !process.env.GITLAB_CI && !process.env.BUILDKITE && process.env.TERM !== "dumb";
8
+ }
9
+ function formatProgress(options) {
10
+ const { current, total, format = "both" } = options;
11
+ const percentage = Math.round(current / total * 100);
12
+ switch (format) {
13
+ case "percentage":
14
+ return `${percentage}%`;
15
+ case "count":
16
+ return `${current}/${total}`;
17
+ case "both":
18
+ return `${current}/${total} (${percentage}%)`;
19
+ default:
20
+ return `${current}/${total}`;
21
+ }
22
+ }
23
+ function formatTimer(origin) {
24
+ const duration = (performance.now() - origin) / 1e3;
25
+ const min = Math.floor(duration / 60);
26
+ const secs = Math.floor(duration % 60);
27
+ return min > 0 ? `[${min}m ${secs}s]` : `[${secs}s]`;
28
+ }
29
+ function removeTrailingDots(msg) {
30
+ return msg.replace(/\.+$/, "");
31
+ }
32
+ export function useSpinner(options) {
33
+ let loop;
34
+ const interactive = isInteractive();
35
+ let unblock = null;
36
+ const state = {
37
+ isActive: false,
38
+ isPaused: false,
39
+ startTime: null,
40
+ pausedTime: 0,
41
+ text: options.text,
42
+ isCancelled: false,
43
+ origin: performance.now(),
44
+ indicatorTimer: 0
45
+ };
46
+ const handleExit = (code) => {
47
+ const msg = code > 1 ? options.errorMessage ?? "Operation failed" : options.cancelMessage ?? "Operation cancelled";
48
+ state.isCancelled = code === 1;
49
+ if (state.isActive) {
50
+ controls.stop(msg, code);
51
+ if (state.isCancelled && typeof options.onCancel === "function") {
52
+ options.onCancel();
53
+ }
54
+ }
55
+ };
56
+ const errorEventHandler = () => handleExit(2);
57
+ const signalEventHandler = () => handleExit(1);
58
+ const registerHooks = () => {
59
+ process.on("uncaughtExceptionMonitor", errorEventHandler);
60
+ process.on("unhandledRejection", errorEventHandler);
61
+ process.on("SIGINT", signalEventHandler);
62
+ process.on("SIGTERM", signalEventHandler);
63
+ process.on("exit", handleExit);
64
+ if (options.signal) {
65
+ options.signal.addEventListener("abort", signalEventHandler);
66
+ }
67
+ };
68
+ const clearHooks = () => {
69
+ process.removeListener("uncaughtExceptionMonitor", errorEventHandler);
70
+ process.removeListener("unhandledRejection", errorEventHandler);
71
+ process.removeListener("SIGINT", signalEventHandler);
72
+ process.removeListener("SIGTERM", signalEventHandler);
73
+ process.removeListener("exit", handleExit);
74
+ if (options.signal) {
75
+ options.signal.removeEventListener("abort", signalEventHandler);
76
+ }
77
+ };
78
+ const clearPrevMessage = () => {
79
+ if (state.prevMessage === void 0) return;
80
+ if (process.env.CI) process.stdout.write("\n");
81
+ const prevLines = state.prevMessage.split("\n");
82
+ process.stdout.write(`\x1B[${prevLines.length}A`);
83
+ process.stdout.write("\x1B[0J");
84
+ };
85
+ const controls = {
86
+ start: (text) => {
87
+ if (text) {
88
+ options.text = text;
89
+ state.text = text;
90
+ }
91
+ if (options.silent || !interactive) {
92
+ console.log(
93
+ options.prefixText ? `${options.prefixText} ${options.text}` : options.text
94
+ );
95
+ state.isActive = true;
96
+ state.startTime = Date.now();
97
+ return controls;
98
+ }
99
+ state.isActive = true;
100
+ state.origin = performance.now();
101
+ unblock = block({ output: process.stdout });
102
+ process.stdout.write(`${re.dim("\u2502")}
103
+ `);
104
+ let frameIndex = 0;
105
+ registerHooks();
106
+ loop = setInterval(() => {
107
+ if (process.env.CI && state.text === state.prevMessage) {
108
+ return;
109
+ }
110
+ clearPrevMessage();
111
+ state.prevMessage = state.text;
112
+ const frame = re.magenta(
113
+ (options.frames ?? defaultFrames)[frameIndex] ?? ""
114
+ );
115
+ if (process.env.CI) {
116
+ process.stdout.write(`${frame} ${state.text}...`);
117
+ } else if (options.indicator === "timer") {
118
+ process.stdout.write(
119
+ `${frame} ${state.text} ${formatTimer(state.origin)}`
120
+ );
121
+ } else {
122
+ const loadingDots = ".".repeat(Math.floor(state.indicatorTimer)).slice(0, 3);
123
+ process.stdout.write(`${frame} ${state.text}${loadingDots}`);
124
+ }
125
+ frameIndex = (frameIndex + 1) % (options.frames ?? defaultFrames).length;
126
+ state.indicatorTimer = state.indicatorTimer < 4 ? state.indicatorTimer + 0.125 : 0;
127
+ }, options.delay ?? defaultDelay);
128
+ return controls;
129
+ },
130
+ stop: (text, code = 0) => {
131
+ if (!state.isActive) return;
132
+ state.isActive = false;
133
+ clearInterval(loop);
134
+ clearPrevMessage();
135
+ const step = code === 0 ? re.green("\u2713") : code === 1 ? re.red("\u2717") : re.red("\u2717");
136
+ const finalText = text ?? state.text;
137
+ if (options.indicator === "timer") {
138
+ process.stdout.write(
139
+ `${step} ${finalText} ${formatTimer(state.origin)}
140
+ `
141
+ );
142
+ } else {
143
+ process.stdout.write(`${step} ${finalText}
144
+ `);
145
+ }
146
+ clearHooks();
147
+ if (unblock) unblock();
148
+ },
149
+ setText: (text) => {
150
+ state.text = removeTrailingDots(text);
151
+ options.text = text;
152
+ },
153
+ setProgress: (progress) => {
154
+ const progressText = formatProgress(progress);
155
+ const newText = `${state.text} [${progressText}]`;
156
+ state.text = newText;
157
+ options.text = newText;
158
+ },
159
+ succeed: (text) => {
160
+ const successText = text ?? options.successText ?? state.text;
161
+ controls.stop(successText, 0);
162
+ },
163
+ fail: (text) => {
164
+ const failText = text ?? options.failText ?? state.text;
165
+ controls.stop(failText, 2);
166
+ },
167
+ warn: (text) => {
168
+ const warnText = text ?? state.text;
169
+ controls.stop(warnText, 0);
170
+ },
171
+ info: (text) => {
172
+ const infoText = text ?? state.text;
173
+ controls.stop(infoText, 0);
174
+ },
175
+ isSpinning: () => {
176
+ return state.isActive && !state.isPaused;
177
+ },
178
+ clear: () => {
179
+ clearPrevMessage();
180
+ },
181
+ getElapsedTime: () => {
182
+ if (!state.startTime) return 0;
183
+ const currentTime = Date.now();
184
+ return currentTime - state.startTime - state.pausedTime;
185
+ },
186
+ pause: () => {
187
+ if (state.isActive && !state.isPaused) {
188
+ clearInterval(loop);
189
+ state.isPaused = true;
190
+ }
191
+ },
192
+ resume: () => {
193
+ if (state.isActive && state.isPaused) {
194
+ loop = setInterval(() => {
195
+ }, options.delay ?? defaultDelay);
196
+ state.isPaused = false;
197
+ }
198
+ },
199
+ dispose: () => {
200
+ if (state.isActive) {
201
+ controls.stop();
202
+ }
203
+ state.isActive = false;
204
+ state.isPaused = false;
205
+ },
206
+ get isCancelled() {
207
+ return state.isCancelled;
208
+ }
209
+ };
210
+ return controls;
211
+ }
212
+ useSpinner.promise = async (operation, options) => {
213
+ const spinner = useSpinner(options).start();
214
+ try {
215
+ const result = await operation(spinner);
216
+ spinner.succeed();
217
+ return result;
218
+ } catch (error) {
219
+ spinner.fail();
220
+ throw error;
221
+ } finally {
222
+ spinner.dispose();
223
+ }
224
+ };
225
+ useSpinner.nested = (parentOptions) => {
226
+ const parentSpinner = useSpinner({
227
+ ...parentOptions,
228
+ silent: true
229
+ // Parent is silent, children will show progress
230
+ });
231
+ return {
232
+ start: () => {
233
+ parentSpinner.start();
234
+ return {
235
+ child: (childOptions) => useSpinner(childOptions),
236
+ finish: (success, text) => {
237
+ if (success) {
238
+ parentSpinner.succeed(text);
239
+ } else {
240
+ parentSpinner.fail(text);
241
+ }
242
+ },
243
+ dispose: () => parentSpinner.dispose()
244
+ };
245
+ }
246
+ };
247
+ };
248
+ useSpinner.withTiming = async (operation, options) => {
249
+ const spinner = useSpinner(options).start();
250
+ const startTime = Date.now();
251
+ try {
252
+ const result = await operation(spinner);
253
+ const duration = Date.now() - startTime;
254
+ spinner.succeed(`${options.successText || options.text} (${duration}ms)`);
255
+ return { result, duration };
256
+ } catch (error) {
257
+ const duration = Date.now() - startTime;
258
+ spinner.fail(
259
+ `${options.failText || options.text} (failed after ${duration}ms)`
260
+ );
261
+ throw error;
262
+ } finally {
263
+ spinner.dispose();
264
+ }
265
+ };
@@ -1,2 +1,2 @@
1
1
  import type { ProgressBar, ProgressBarOptions } from "../../types.js";
2
- export declare function progressTaskPrompt(options: ProgressBarOptions): Promise<ProgressBar>;
2
+ export declare function taskProgressPrompt(options: ProgressBarOptions): Promise<ProgressBar>;
@@ -1,6 +1,6 @@
1
1
  import { re } from "@reliverse/relico";
2
2
  import { cursor, erase } from "sisteransi";
3
- export async function progressTaskPrompt(options) {
3
+ export async function taskProgressPrompt(options) {
4
4
  if (options.total <= 0) {
5
5
  throw new Error("Total must be a positive number");
6
6
  }
@@ -2,7 +2,7 @@ import type { SpinnerName } from "cli-spinners";
2
2
  type SimpleSpinnerType = "default" | "dottedCircle" | "boxSpinner";
3
3
  type OraSpinnerType = Extract<SpinnerName, OraAllowedSpinners>;
4
4
  type OraAllowedSpinners = "dots" | "bouncingBar" | "arc";
5
- type TaskOptions<T extends "simple" | "ora"> = {
5
+ interface TaskOptions<T extends "simple" | "ora"> {
6
6
  initialMessage: string;
7
7
  successMessage?: string;
8
8
  errorMessage?: string;
@@ -10,6 +10,6 @@ type TaskOptions<T extends "simple" | "ora"> = {
10
10
  spinnerSolution: T;
11
11
  spinnerType?: T extends "simple" ? SimpleSpinnerType : OraSpinnerType;
12
12
  action: (updateMessage: (message: string) => void) => Promise<void>;
13
- };
14
- export declare function spinnerTaskPrompt<T extends "simple" | "ora">(options: TaskOptions<T>): Promise<void>;
13
+ }
14
+ export declare function taskSpinPrompt<T extends "simple" | "ora">(options: TaskOptions<T>): Promise<void>;
15
15
  export {};
@@ -3,7 +3,7 @@ import process from "node:process";
3
3
  import ora from "ora";
4
4
  import { cursor, erase } from "sisteransi";
5
5
  import { msg } from "../msg-fmt/messages.js";
6
- export async function spinnerTaskPrompt(options) {
6
+ export async function taskSpinPrompt(options) {
7
7
  const {
8
8
  initialMessage,
9
9
  successMessage = "Task completed successfully.",
@@ -65,7 +65,7 @@ export async function spinnerTaskPrompt(options) {
65
65
  process.stdin.on("data", handleInput);
66
66
  }
67
67
  interval = setInterval(() => {
68
- const frame = re.magenta(frames[frameIndex]);
68
+ const frame = re.magenta(frames[frameIndex] ?? "");
69
69
  process.stdout.write(
70
70
  `${cursor.move(-999, 0)}${erase.line}${frame} ${re.cyan(message)}`
71
71
  );
@@ -1,2 +1,2 @@
1
- import type { ColorName, TypographyName } from "../types.js";
1
+ import type { ColorName, TypographyName } from "../../types.js";
2
2
  export declare function colorize(text: string, colorName?: ColorName, typography?: TypographyName): string;
@@ -1,4 +1,4 @@
1
- import type { PreventWrongTerminalSizeOptions } from "../types.js";
1
+ import type { PreventWrongTerminalSizeOptions } from "../../types.js";
2
2
  export declare function preventUnsupportedTTY(): void;
3
3
  /**
4
4
  * Prevents EISDIR errors when trying to read Windows home directory as a file
@@ -2,11 +2,11 @@ import { re } from "@reliverse/relico";
2
2
  import { relinka } from "@reliverse/relinka";
3
3
  import { homedir } from "node:os";
4
4
  import terminalSize from "terminal-size";
5
- import { msg } from "../components/msg-fmt/messages.js";
5
+ import { msg } from "../msg-fmt/messages.js";
6
6
  import {
7
7
  getExactTerminalWidth,
8
8
  getTerminalWidth
9
- } from "../components/msg-fmt/terminal.js";
9
+ } from "../msg-fmt/terminal.js";
10
10
  export function preventUnsupportedTTY() {
11
11
  if (!process.stdout.isTTY) {
12
12
  relinka(
@@ -1,4 +1,4 @@
1
- import type { BorderColorName, ColorName, TypographyName, VariantName } from "../types.js";
1
+ import type { BorderColorName, ColorName, TypographyName, VariantName } from "../../types.js";
2
2
  /**
3
3
  * Ends the prompt by optionally displaying an end message and running the action if confirmed.
4
4
  * Preserves the last prompt state unless there's an endTitle.
@@ -1,7 +1,7 @@
1
1
  import { re } from "@reliverse/relico";
2
2
  import { relinka } from "@reliverse/relinka";
3
- import { msg, symbols } from "../components/msg-fmt/messages.js";
4
- import { getExactTerminalWidth } from "../components/msg-fmt/terminal.js";
3
+ import { msg, symbols } from "../msg-fmt/messages.js";
4
+ import { getExactTerminalWidth } from "../msg-fmt/terminal.js";
5
5
  export async function completePrompt(prompt, isCtrlC, _endTitle = "", _endTitleColor = "dim", _titleTypography = "none", _titleVariant = void 0, _border = true, borderColor = "dim", action, value) {
6
6
  if (action && value) {
7
7
  await action();
@@ -1,4 +1,4 @@
1
- import type { BorderColorName, StreamTextOptions } from "../types.js";
1
+ import type { BorderColorName, StreamTextOptions } from "../../types.js";
2
2
  /**
3
3
  * Simulates streaming text output in the console, character by character
4
4
  */
@@ -4,8 +4,8 @@ import ora from "ora";
4
4
  import { cursor } from "sisteransi";
5
5
  import terminalSize from "terminal-size";
6
6
  import wrapAnsi from "wrap-ansi";
7
- import { toBaseColor } from "../components/msg-fmt/colors.js";
8
- import { msg } from "../components/msg-fmt/messages.js";
7
+ import { toBaseColor } from "../msg-fmt/colors.js";
8
+ import { msg } from "../msg-fmt/messages.js";
9
9
  function getTerminalWidth() {
10
10
  return terminalSize().columns;
11
11
  }
@@ -7,10 +7,10 @@ export declare function isTerminalInteractive(input?: NodeJS.ReadStream & {
7
7
  /**
8
8
  * Validates a name against allowed characters
9
9
  */
10
- type ValidationResult = {
10
+ interface ValidationResult {
11
11
  isValid: boolean;
12
12
  message?: string;
13
- };
13
+ }
14
14
  export declare function isValidName(name: string): ValidationResult;
15
15
  /**
16
16
  * Cleans up project name from config by removing scope and invalid characters.
package/bin/mod.d.ts CHANGED
@@ -1,38 +1,66 @@
1
- export { anykeyPrompt } from "./components/anykey/anykey-mod.js";
2
- export { datePrompt } from "./components/date/date.js";
3
- export { startEditor } from "./components/editor/editor-mod.js";
4
- export { mainSymbols, fallbackSymbols, } from "./components/figures/figures-mod.js";
5
- export { confirmPrompt } from "./components/input/confirm-prompt.js";
6
- export { inputPrompt } from "./components/input/input-prompt.js";
7
- export * from "./components/launcher/launcher-types.js";
8
- export { defineCommand, defineArgs, showUsage, runMain, runCmd, } from "./components/launcher/launcher-mod.js";
9
- export { loadCommand } from "./components/launcher/run-command.js";
10
- export { toBaseColor, toSolidColor } from "./components/msg-fmt/colors.js";
11
- export { relinkaByRemptsDeprecated, relinkaAsyncByRemptsDeprecated, throwError, } from "./components/msg-fmt/logger.js";
12
- export { colorMap, typographyMap } from "./components/msg-fmt/mapping.js";
13
- export { symbols, bar, fmt, msg, msgUndo, msgUndoAll, printLineBar, } from "./components/msg-fmt/messages.js";
14
- export { getTerminalHeight, getExactTerminalWidth, getTerminalWidth, breakLines, removeCursor, restoreCursor, deleteLastLine, deleteLastLines, countLines, } from "./components/msg-fmt/terminal.js";
15
- export { variantMap, isValidVariant, applyVariant, } from "./components/msg-fmt/variants.js";
16
- export { nextStepsPrompt } from "./components/next-steps/next-steps.js";
17
- export { numberPrompt } from "./components/number/number-mod.js";
18
- export type { ResultsType } from "./components/results/results.js";
19
- export { resultPrompt } from "./components/results/results.js";
20
- export { multiselectPrompt } from "./components/select/multiselect-prompt.js";
21
- export { numMultiSelectPrompt } from "./components/select/nummultiselect-prompt.js";
22
- export { numSelectPrompt } from "./components/select/numselect-prompt.js";
23
- export { selectPrompt } from "./components/select/select-prompt.js";
24
- export { togglePrompt } from "./components/select/toggle-prompt.js";
25
- export { endPrompt } from "./components/st-end/end.js";
26
- export { startPrompt } from "./components/st-end/start.js";
27
- export { progressTaskPrompt } from "./components/task/progress.js";
28
- export { spinnerTaskPrompt } from "./components/task/spinner.js";
29
- export { colorize } from "./utils/colorize.js";
30
- export { errorHandler } from "./utils/errors.js";
31
- export { preventUnsupportedTTY, preventWindowsHomeDirRoot, preventWrongTerminalSize, } from "./utils/prevent.js";
32
- export { completePrompt, renderEndLine, renderEndLineInput, } from "./utils/prompt-end.js";
33
- export { streamText, streamTextBox, streamTextWithSpinner, } from "./utils/stream-text.js";
34
- export { pm, reliversePrompts } from "./utils/system.js";
35
- export { isTerminalInteractive, isValidName, normalizeName, } from "./utils/validate.js";
36
- export { animationMap, animateText, } from "./components/visual/animate/animate.js";
37
- export { createAsciiArt } from "./components/visual/ascii-art/ascii-art.js";
38
- export { useSpinner } from "./hooks/spinner/spinner-mod.js";
1
+ export { animationMap, animateText } from "./libs/animate/animate-mod.js";
2
+ export { anykeyPrompt } from "./libs/anykey/anykey-mod.js";
3
+ export { createAsciiArt } from "./libs/visual/visual-mod.js";
4
+ export type { CancelValue } from "./libs/cancel/cancel.js";
5
+ export { CANCEL, isWindows, setRawMode, getColumns, block, isCancel, cancel, createCancel, } from "./libs/cancel/cancel.js";
6
+ export { confirm } from "./libs/confirm/confirm-alias.js";
7
+ export { confirmPrompt } from "./libs/confirm/confirm-mod.js";
8
+ export { datePrompt } from "./libs/date/date.js";
9
+ export { startEditor } from "./libs/editor/editor-mod.js";
10
+ export { mainSymbols, fallbackSymbols, figures, } from "./libs/figures/figures-mod.js";
11
+ export { input, text, password } from "./libs/input/input-alias.js";
12
+ export { inputPrompt } from "./libs/input/input-mod.js";
13
+ export { startPrompt, intro } from "./libs/intro/intro-alias.js";
14
+ export { introPrompt } from "./libs/intro/intro-mod.js";
15
+ export { runMain } from "./libs/launcher/launcher-alias.js";
16
+ export { defineCommand, showUsage, createCli, defineArgs, runCmd, } from "./libs/launcher/launcher-mod.js";
17
+ export type { EmptyArgs, BaseArgProps, BaseArgDefinition, PositionalArgDefinition, BooleanArgDefinition, StringArgDefinition, NumberArgDefinition, ArrayArgDefinition, ArgDefinition, ArgDefinitions, CommandMeta, CommandSpec, CommandsMap, CommandContext, CommandRun, CommandHook, DefineCommandOptions, Command, InferArgTypes, FileBasedOptions, } from "./libs/launcher/launcher-types.js";
18
+ export { loadCommand } from "./libs/launcher/run-command.js";
19
+ export { addCompletions } from "./libs/launcher/trpc-orpc-support/completions.js";
20
+ export { CliValidationError, FailedToExitError, } from "./libs/launcher/trpc-orpc-support/errors.js";
21
+ export { TrpcCommand, parseRouter, createRpcCli, z, } from "./libs/launcher/trpc-orpc-support/index.js";
22
+ export { flattenedProperties, incompatiblePropertyPairs, getDescription, getSchemaTypes, getEnumChoices, } from "./libs/launcher/trpc-orpc-support/json-schema.js";
23
+ export type { CommandJSON } from "./libs/launcher/trpc-orpc-support/json.js";
24
+ export { commandToJSON } from "./libs/launcher/trpc-orpc-support/json.js";
25
+ export { lineByLineLogger, lineByLineConsoleLogger, } from "./libs/launcher/trpc-orpc-support/logging.js";
26
+ export { parseProcedureInputs } from "./libs/launcher/trpc-orpc-support/parse-procedure.js";
27
+ export { createShadowCommand, promptify, } from "./libs/launcher/trpc-orpc-support/prompts.js";
28
+ export type { StandardSchemaV1, StandardSchemaV1Props, StandardSchemaV1Result, StandardSchemaV1SuccessResult, StandardSchemaV1FailureResult, StandardSchemaV1Issue, StandardSchemaV1PathSegment, StandardSchemaV1Types, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, } from "./libs/launcher/trpc-orpc-support/standard-schema/contract.js";
29
+ export { prettifyStandardSchemaError, toDotPath, StandardSchemaV1Error, } from "./libs/launcher/trpc-orpc-support/standard-schema/errors.js";
30
+ export { looksLikeStandardSchemaFailure, looksLikeStandardSchema, } from "./libs/launcher/trpc-orpc-support/standard-schema/utils.js";
31
+ export type { Trpc11RouterLike, Trpc11ProcedureRecordLike, Trpc11ProcedureLike, Trpc10RouterLike, Trpc10ProcedureLike, OrpcProcedureLike, OrpcRouterLike, CreateCallerFactoryLike, AnyRouter, AnyProcedure, inferRouterContext, } from "./libs/launcher/trpc-orpc-support/trpc-compat.js";
32
+ export { isTrpc11Procedure, isTrpc11Router, isOrpcRouter, } from "./libs/launcher/trpc-orpc-support/trpc-compat.js";
33
+ export type { TrpcCliParams, TrpcServerModuleLike, TrpcCliMeta, ParsedProcedure, Result, Log, Logger, OmeletteInstanceLike, InquirerPromptOptions, InquirerPromptsLike, PromptsLike, EnquirerLike, ClackPromptsLike, Promptable, TrpcCliRunParams, CommanderProgramLike, TrpcCli, Dependencies, PromptContext, Prompter, } from "./libs/launcher/trpc-orpc-support/types.js";
34
+ export { looksLikeInstanceof } from "./libs/launcher/trpc-orpc-support/util.js";
35
+ export { log } from "./libs/log/log-alias.js";
36
+ export { toBaseColor, toSolidColor } from "./libs/msg-fmt/colors.js";
37
+ export { relinkaByRemptsDeprecated, relinkaAsyncByRemptsDeprecated, throwError, } from "./libs/msg-fmt/logger.js";
38
+ export { colorMap, typographyMap } from "./libs/msg-fmt/mapping.js";
39
+ export { symbols, bar, fmt, msg, msgUndo, msgUndoAll, printLineBar, } from "./libs/msg-fmt/messages.js";
40
+ export { getTerminalHeight, getExactTerminalWidth, getTerminalWidth, breakLines, removeCursor, restoreCursor, deleteLastLine, deleteLastLines, countLines, } from "./libs/msg-fmt/terminal.js";
41
+ export { variantMap, isValidVariant, applyVariant, } from "./libs/msg-fmt/variants.js";
42
+ export { multiselect } from "./libs/multiselect/multiselect-alias.js";
43
+ export { multiselectPrompt } from "./libs/multiselect/multiselect-prompt.js";
44
+ export { nextStepsPrompt } from "./libs/next-steps/next-steps.js";
45
+ export { numberPrompt } from "./libs/number/number-mod.js";
46
+ export { endPrompt, outro } from "./libs/outro/outro-alias.js";
47
+ export { outroPrompt } from "./libs/outro/outro-mod.js";
48
+ export type { ResultsType } from "./libs/results/results.js";
49
+ export { resultPrompt } from "./libs/results/results.js";
50
+ export { select } from "./libs/select/aliases-alias.js";
51
+ export { numMultiSelectPrompt } from "./libs/select/nummultiselect-prompt.js";
52
+ export { numSelectPrompt } from "./libs/select/numselect-prompt.js";
53
+ export { selectPrompt } from "./libs/select/select-prompt.js";
54
+ export { togglePrompt } from "./libs/select/toggle-prompt.js";
55
+ export { spinner } from "./libs/spinner/spinner-alias.js";
56
+ export { useSpinner } from "./libs/spinner/spinner-mod.js";
57
+ export { taskProgressPrompt } from "./libs/task/progress.js";
58
+ export { taskSpinPrompt } from "./libs/task/task-spin.js";
59
+ export { colorize } from "./libs/utils/colorize.js";
60
+ export { errorHandler } from "./libs/utils/errors.js";
61
+ export { preventUnsupportedTTY, preventWindowsHomeDirRoot, preventWrongTerminalSize, } from "./libs/utils/prevent.js";
62
+ export { completePrompt, renderEndLine, renderEndLineInput, } from "./libs/utils/prompt-end.js";
63
+ export { streamText, streamTextBox, streamTextWithSpinner, } from "./libs/utils/stream-text.js";
64
+ export { pm, reliversePrompts } from "./libs/utils/system.js";
65
+ export { isTerminalInteractive, isValidName, normalizeName, } from "./libs/utils/validate.js";
66
+ export type { MsgType, TypographyName, BorderColorName, ColorName, VariantName, MsgConfig, PromptOptions, ChoiceOptions, SelectOption, StandardColor, OutputColor, EditorExitResult, MessageKind, AllKinds, MessageConfig, StreamOptions, ProgressBarOptions, ProgressBar, PromptType, ConfirmPromptOptions, StreamTextOptions, PreventWrongTerminalSizeOptions, InputPromptOptions, RenderParams, SymbolName, Symbols, FmtMsgOptions, TogglePromptParams, SeparatorOption, MultiselectPromptParams, DatePromptOptions, } from "./types.js";