@reliverse/rempts-core 1.6.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +398 -102
  2. package/dist/cli.d.ts +32 -0
  3. package/dist/cli.js +731 -0
  4. package/dist/config-loader.d.ts +42 -0
  5. package/dist/config-loader.js +20 -0
  6. package/dist/config.d.ts +99 -0
  7. package/dist/config.js +188 -0
  8. package/dist/file-loader.d.ts +43 -0
  9. package/dist/file-loader.js +199 -0
  10. package/dist/global-flags.d.ts +36 -0
  11. package/dist/global-flags.js +36 -0
  12. package/dist/mod.d.ts +13 -0
  13. package/dist/mod.js +19 -0
  14. package/dist/parser.d.ts +6 -0
  15. package/dist/parser.js +137 -0
  16. package/dist/plugin/context.d.ts +13 -0
  17. package/dist/plugin/context.js +53 -0
  18. package/dist/plugin/create.d.ts +92 -0
  19. package/dist/plugin/create.js +61 -0
  20. package/dist/plugin/loader.d.ts +12 -0
  21. package/dist/plugin/loader.js +65 -0
  22. package/dist/plugin/manager.d.ts +53 -0
  23. package/dist/plugin/manager.js +135 -0
  24. package/dist/plugin/mod.d.ts +10 -0
  25. package/dist/plugin/mod.js +27 -0
  26. package/dist/plugin/store.d.ts +45 -0
  27. package/dist/plugin/store.js +60 -0
  28. package/dist/plugin/testing.d.ts +38 -0
  29. package/dist/plugin/testing.js +175 -0
  30. package/dist/plugin/types.d.ts +146 -0
  31. package/dist/tui/registry.d.ts +8 -0
  32. package/dist/tui/registry.js +10 -0
  33. package/dist/tui/types.d.ts +58 -0
  34. package/dist/tui/types.js +10 -0
  35. package/dist/types.d.ts +178 -0
  36. package/dist/types.js +25 -0
  37. package/dist/utils/logger.d.ts +10 -0
  38. package/dist/utils/logger.js +27 -0
  39. package/dist/utils/merge.d.ts +13 -0
  40. package/dist/utils/merge.js +25 -0
  41. package/dist/utils/mod.d.ts +6 -0
  42. package/dist/utils/mod.js +2 -0
  43. package/dist/utils/type-helpers.d.ts +41 -0
  44. package/dist/utils/type-helpers.js +0 -0
  45. package/dist/validation.d.ts +30 -0
  46. package/dist/validation.js +121 -0
  47. package/package.json +47 -44
  48. package/src/cli.ts +1049 -0
  49. package/src/config-loader.ts +71 -0
  50. package/src/config.ts +270 -0
  51. package/src/file-loader.ts +346 -0
  52. package/src/global-flags.ts +50 -0
  53. package/src/mod.ts +74 -0
  54. package/src/parser.ts +212 -0
  55. package/src/plugin/context.ts +88 -0
  56. package/src/plugin/create.ts +174 -0
  57. package/src/plugin/loader.ts +111 -0
  58. package/src/plugin/manager.ts +244 -0
  59. package/src/plugin/mod.ts +51 -0
  60. package/src/plugin/store.ts +124 -0
  61. package/src/plugin/testing.ts +236 -0
  62. package/src/plugin/types.ts +206 -0
  63. package/src/tui/registry.ts +22 -0
  64. package/src/tui/types.ts +79 -0
  65. package/src/types.ts +285 -0
  66. package/src/utils/logger.ts +43 -0
  67. package/src/utils/merge.ts +54 -0
  68. package/src/utils/mod.ts +7 -0
  69. package/src/utils/type-helpers.ts +151 -0
  70. package/src/validation.ts +177 -0
  71. package/LICENSE +0 -21
  72. package/bin/core-impl/anykey/anykey-mod.d.ts +0 -12
  73. package/bin/core-impl/anykey/anykey-mod.js +0 -125
  74. package/bin/core-impl/date/date.d.ts +0 -2
  75. package/bin/core-impl/date/date.js +0 -236
  76. package/bin/core-impl/editor/editor-mod.d.ts +0 -25
  77. package/bin/core-impl/editor/editor-mod.js +0 -896
  78. package/bin/core-impl/figures/figures-mod.d.ts +0 -233
  79. package/bin/core-impl/figures/figures-mod.js +0 -286
  80. package/bin/core-impl/figures/figures.test.d.ts +0 -1
  81. package/bin/core-impl/figures/figures.test.js +0 -474
  82. package/bin/core-impl/input/confirm-prompt.d.ts +0 -5
  83. package/bin/core-impl/input/confirm-prompt.js +0 -173
  84. package/bin/core-impl/input/input-prompt.d.ts +0 -16
  85. package/bin/core-impl/input/input-prompt.js +0 -370
  86. package/bin/core-impl/launcher/_parser.d.ts +0 -2
  87. package/bin/core-impl/launcher/_parser.js +0 -122
  88. package/bin/core-impl/launcher/_utils.d.ts +0 -8
  89. package/bin/core-impl/launcher/_utils.js +0 -29
  90. package/bin/core-impl/launcher/args.d.ts +0 -3
  91. package/bin/core-impl/launcher/args.js +0 -89
  92. package/bin/core-impl/launcher/command.d.ts +0 -8
  93. package/bin/core-impl/launcher/command.js +0 -68
  94. package/bin/core-impl/launcher/launcher-mod.d.ts +0 -8
  95. package/bin/core-impl/launcher/launcher-mod.js +0 -34
  96. package/bin/core-impl/launcher/usage.d.ts +0 -3
  97. package/bin/core-impl/launcher/usage.js +0 -104
  98. package/bin/core-impl/msg-fmt/colors.d.ts +0 -30
  99. package/bin/core-impl/msg-fmt/colors.js +0 -42
  100. package/bin/core-impl/msg-fmt/logger.d.ts +0 -17
  101. package/bin/core-impl/msg-fmt/logger.js +0 -106
  102. package/bin/core-impl/msg-fmt/mapping.d.ts +0 -3
  103. package/bin/core-impl/msg-fmt/mapping.js +0 -49
  104. package/bin/core-impl/msg-fmt/messages.d.ts +0 -35
  105. package/bin/core-impl/msg-fmt/messages.js +0 -314
  106. package/bin/core-impl/msg-fmt/terminal.d.ts +0 -15
  107. package/bin/core-impl/msg-fmt/terminal.js +0 -59
  108. package/bin/core-impl/msg-fmt/variants.d.ts +0 -11
  109. package/bin/core-impl/msg-fmt/variants.js +0 -52
  110. package/bin/core-impl/next-steps/next-steps.d.ts +0 -14
  111. package/bin/core-impl/next-steps/next-steps.js +0 -24
  112. package/bin/core-impl/number/number-mod.d.ts +0 -28
  113. package/bin/core-impl/number/number-mod.js +0 -197
  114. package/bin/core-impl/results/results.d.ts +0 -7
  115. package/bin/core-impl/results/results.js +0 -27
  116. package/bin/core-impl/select/multiselect-prompt.d.ts +0 -2
  117. package/bin/core-impl/select/multiselect-prompt.js +0 -341
  118. package/bin/core-impl/select/nummultiselect-prompt.d.ts +0 -6
  119. package/bin/core-impl/select/nummultiselect-prompt.js +0 -105
  120. package/bin/core-impl/select/numselect-prompt.d.ts +0 -7
  121. package/bin/core-impl/select/numselect-prompt.js +0 -115
  122. package/bin/core-impl/select/select-prompt.d.ts +0 -33
  123. package/bin/core-impl/select/select-prompt.js +0 -302
  124. package/bin/core-impl/select/toggle-prompt.d.ts +0 -5
  125. package/bin/core-impl/select/toggle-prompt.js +0 -208
  126. package/bin/core-impl/st-end/end.d.ts +0 -2
  127. package/bin/core-impl/st-end/end.js +0 -42
  128. package/bin/core-impl/st-end/start.d.ts +0 -17
  129. package/bin/core-impl/st-end/start.js +0 -66
  130. package/bin/core-impl/task/progress.d.ts +0 -2
  131. package/bin/core-impl/task/progress.js +0 -57
  132. package/bin/core-impl/task/spinner.d.ts +0 -15
  133. package/bin/core-impl/task/spinner.js +0 -110
  134. package/bin/core-impl/utils/colorize.d.ts +0 -2
  135. package/bin/core-impl/utils/colorize.js +0 -134
  136. package/bin/core-impl/utils/errors.d.ts +0 -1
  137. package/bin/core-impl/utils/errors.js +0 -15
  138. package/bin/core-impl/utils/prevent.d.ts +0 -10
  139. package/bin/core-impl/utils/prevent.js +0 -69
  140. package/bin/core-impl/utils/prompt-end.d.ts +0 -8
  141. package/bin/core-impl/utils/prompt-end.js +0 -33
  142. package/bin/core-impl/utils/stream-text.d.ts +0 -18
  143. package/bin/core-impl/utils/stream-text.js +0 -136
  144. package/bin/core-impl/utils/system.d.ts +0 -6
  145. package/bin/core-impl/utils/system.js +0 -7
  146. package/bin/core-impl/utils/validate.d.ts +0 -22
  147. package/bin/core-impl/utils/validate.js +0 -17
  148. package/bin/core-impl/visual/animate/animate.d.ts +0 -14
  149. package/bin/core-impl/visual/animate/animate.js +0 -64
  150. package/bin/core-impl/visual/ascii-art/ascii-art.d.ts +0 -6
  151. package/bin/core-impl/visual/ascii-art/ascii-art.js +0 -12
  152. package/bin/core-types.d.ts +0 -434
  153. package/bin/main.d.ts +0 -41
  154. package/bin/main.js +0 -96
  155. /package/{bin/core-types.js → dist/plugin/types.js} +0 -0
@@ -1,136 +0,0 @@
1
- import { re } from "@reliverse/relico";
2
- import { stdout } from "node:process";
3
- import ora from "ora";
4
- import { cursor } from "sisteransi";
5
- import terminalSize from "terminal-size";
6
- import wrapAnsi from "wrap-ansi";
7
- import { toBaseColor } from "../msg-fmt/colors.js";
8
- import { msg } from "../msg-fmt/messages.js";
9
- function getTerminalWidth() {
10
- return terminalSize().columns;
11
- }
12
- let isStartOfLine = true;
13
- let isFirstLine = true;
14
- function stripAnsi(text) {
15
- return text.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
16
- }
17
- function extractAnsi(text) {
18
- return text.match(/\x1b\[[0-9;]*[a-zA-Z]/g) || [];
19
- }
20
- function wrapWithBar(text, isFirst, color) {
21
- const prefix = isFirst ? re.green("\u25C6") : re.dim("\u2502");
22
- const ansiCodes = extractAnsi(text);
23
- const cleanText = stripAnsi(text);
24
- const coloredText = color ? re[color](cleanText) : re.dim(cleanText);
25
- const finalText = ansiCodes.length > 0 ? ansiCodes.join("") + coloredText : coloredText;
26
- return `${prefix} ${finalText}`;
27
- }
28
- function wrapText(text) {
29
- const width = getTerminalWidth();
30
- return wrapAnsi(text, width - 4, { hard: false, trim: true });
31
- }
32
- export async function streamText({
33
- text,
34
- delay = 50,
35
- showCursor = false,
36
- color,
37
- newline = true,
38
- clearLine = false,
39
- onProgress
40
- }) {
41
- if (!showCursor) {
42
- stdout.write(cursor.hide);
43
- }
44
- if (clearLine) {
45
- stdout.write("\r\x1B[K");
46
- }
47
- const wrappedText = wrapText(text);
48
- isFirstLine = true;
49
- let buffer = "";
50
- for (const char of wrappedText) {
51
- if (char === "\n") {
52
- if (buffer) {
53
- const output = isStartOfLine ? wrapWithBar(buffer, isFirstLine, color) : color ? re[color](buffer) : re.dim(buffer);
54
- stdout.write(output);
55
- buffer = "";
56
- }
57
- stdout.write(char);
58
- isStartOfLine = true;
59
- isFirstLine = false;
60
- continue;
61
- }
62
- buffer += char;
63
- if (!char.includes("\x1B[") && buffer) {
64
- const output = isStartOfLine ? wrapWithBar(buffer, isFirstLine, color) : color ? re[color](buffer) : re.dim(buffer);
65
- stdout.write(output);
66
- await new Promise((resolve) => setTimeout(resolve, delay));
67
- isStartOfLine = false;
68
- buffer = "";
69
- if (onProgress) {
70
- onProgress(output);
71
- }
72
- }
73
- }
74
- if (buffer) {
75
- const output = isStartOfLine ? wrapWithBar(buffer, isFirstLine, color) : color ? re[color](buffer) : re.dim(buffer);
76
- stdout.write(output);
77
- if (onProgress) {
78
- onProgress(output);
79
- }
80
- }
81
- if (newline) {
82
- stdout.write("\n");
83
- }
84
- if (!showCursor) {
85
- stdout.write(cursor.show);
86
- }
87
- }
88
- export async function streamTextBox({
89
- text,
90
- delay = 50,
91
- color,
92
- borderColor = "dim"
93
- }) {
94
- stdout.write(cursor.hide);
95
- msg({
96
- type: "M_START",
97
- title: "",
98
- borderColor
99
- });
100
- await streamText({
101
- text,
102
- delay,
103
- showCursor: false,
104
- color,
105
- newline: false,
106
- clearLine: false
107
- });
108
- msg({
109
- type: "M_END",
110
- borderColor
111
- });
112
- stdout.write(cursor.show);
113
- }
114
- export async function streamTextWithSpinner({
115
- text,
116
- delay = 50,
117
- color = "cyan",
118
- spinnerFrames,
119
- spinnerDelay
120
- }) {
121
- let currentText = "";
122
- const spinner = ora({
123
- text: currentText,
124
- color: toBaseColor(color),
125
- spinner: spinnerFrames ? {
126
- frames: spinnerFrames,
127
- interval: spinnerDelay
128
- } : "dots"
129
- }).start();
130
- for (const char of text) {
131
- currentText += char;
132
- spinner.text = color ? re[color](currentText) : currentText;
133
- await new Promise((resolve) => setTimeout(resolve, delay));
134
- }
135
- spinner.stop();
136
- }
@@ -1,6 +0,0 @@
1
- export declare const pm: import("@reliverse/runtime").PkgManagerInfo;
2
- export declare const reliversePrompts: {
3
- name: string;
4
- version: string;
5
- description: string;
6
- };
@@ -1,7 +0,0 @@
1
- import { getUserPkgManager } from "@reliverse/runtime";
2
- export const pm = await getUserPkgManager();
3
- export const reliversePrompts = {
4
- name: "@reliverse/prompts",
5
- version: "1.6.0",
6
- description: "@reliverse/prompts is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs."
7
- };
@@ -1,22 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * Checks if the terminal is interactive
4
- */
5
- export declare function isTerminalInteractive(input?: NodeJS.ReadStream & {
6
- fd: 0;
7
- }): boolean;
8
- /**
9
- * Validates a name against allowed characters
10
- */
11
- type ValidationResult = {
12
- isValid: boolean;
13
- message?: string;
14
- };
15
- export declare function isValidName(name: string): ValidationResult;
16
- /**
17
- * Cleans up project name from config by removing scope and invalid characters.
18
- * For paths with multiple segments (e.g. "@org/subpath/cli"), takes the last segment.
19
- * This also ensures complex cases (e.g. "@some@weird/path/the-name!" returns "the-name").
20
- */
21
- export declare function normalizeName(name: string): string;
22
- export {};
@@ -1,17 +0,0 @@
1
- export function isTerminalInteractive(input = process.stdin) {
2
- return Boolean(input.isTTY);
3
- }
4
- export function isValidName(name) {
5
- if (!/^[a-zA-Z0-9-]+$/.test(name)) {
6
- return {
7
- isValid: false,
8
- message: "Project name can only contain latin letters, numbers and hyphens"
9
- };
10
- }
11
- return { isValid: true };
12
- }
13
- export function normalizeName(name) {
14
- const segments = name.split("/");
15
- const lastSegment = segments[segments.length - 1] ?? name;
16
- return lastSegment.replace(/[^a-zA-Z0-9-]/g, "");
17
- }
@@ -1,14 +0,0 @@
1
- import { type Animation, type AnimationName } from "@figliolia/chalk-animation";
2
- import type { BorderColorName, ColorName, MsgType, TypographyName } from "../../../core-types.js";
3
- export declare const animationMap: Record<AnimationName, (text: string) => Animation>;
4
- export declare function animateText({ title, anim, delay, type, titleColor, titleTypography, border, borderColor, horizontalLineLength, }: {
5
- title: string;
6
- anim: AnimationName;
7
- delay?: number;
8
- type?: MsgType;
9
- titleColor?: ColorName;
10
- titleTypography?: TypographyName;
11
- borderColor?: BorderColorName;
12
- border?: boolean;
13
- horizontalLineLength?: number;
14
- }): Promise<void>;
@@ -1,64 +0,0 @@
1
- import {
2
- ChalkAnimation
3
- } from "@figliolia/chalk-animation";
4
- import { msg } from "../../msg-fmt/messages.js";
5
- import {
6
- deleteLastLine,
7
- getTerminalWidth
8
- } from "../../msg-fmt/terminal.js";
9
- export const animationMap = {
10
- rainbow: ChalkAnimation.rainbow,
11
- pulse: ChalkAnimation.pulse,
12
- glitch: ChalkAnimation.glitch,
13
- radar: ChalkAnimation.radar,
14
- neon: ChalkAnimation.neon,
15
- karaoke: ChalkAnimation.karaoke
16
- };
17
- function calculateDelay(text) {
18
- const baseDelay = 1e3;
19
- const delayPerCharacter = 50;
20
- return baseDelay + text.length * delayPerCharacter;
21
- }
22
- export async function animateText({
23
- title = "",
24
- anim,
25
- delay,
26
- type = "M_INFO",
27
- titleColor = "cyan",
28
- titleTypography = "none",
29
- border = true,
30
- borderColor = "dim",
31
- horizontalLineLength = 0
32
- }) {
33
- if (horizontalLineLength === 0) {
34
- horizontalLineLength = getTerminalWidth() - 5;
35
- }
36
- const finalDelay = delay ?? calculateDelay(title);
37
- const animation = animationMap[anim](title);
38
- try {
39
- await new Promise((resolve) => {
40
- setTimeout(() => {
41
- animation.stop();
42
- deleteLastLine();
43
- if (title.includes("\u2502 ")) {
44
- title = title.replace("\u2502 ", "");
45
- } else if (title.includes("\u2139 ")) {
46
- title = title.replace("\u2139 ", "");
47
- }
48
- msg({
49
- type,
50
- title,
51
- titleColor,
52
- titleTypography,
53
- content: "",
54
- borderColor,
55
- border,
56
- horizontalLineLength
57
- });
58
- resolve();
59
- }, finalDelay);
60
- });
61
- } catch (error) {
62
- console.error("Animation failed to complete.", error);
63
- }
64
- }
@@ -1,6 +0,0 @@
1
- import { type Fonts } from "figlet";
2
- export declare function createAsciiArt({ message, font, clearConsole, }: {
3
- message: string;
4
- font?: Fonts;
5
- clearConsole?: boolean;
6
- }): Promise<void>;
@@ -1,12 +0,0 @@
1
- import figlet from "figlet";
2
- export async function createAsciiArt({
3
- message,
4
- font = "Standard",
5
- clearConsole = false
6
- }) {
7
- if (clearConsole) {
8
- console.clear();
9
- }
10
- const asciiArt = figlet.textSync(message, { font });
11
- console.log(asciiArt);
12
- }