@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.
- package/README.md +398 -102
- package/dist/cli.d.ts +32 -0
- package/dist/cli.js +731 -0
- package/dist/config-loader.d.ts +42 -0
- package/dist/config-loader.js +20 -0
- package/dist/config.d.ts +99 -0
- package/dist/config.js +188 -0
- package/dist/file-loader.d.ts +43 -0
- package/dist/file-loader.js +199 -0
- package/dist/global-flags.d.ts +36 -0
- package/dist/global-flags.js +36 -0
- package/dist/mod.d.ts +13 -0
- package/dist/mod.js +19 -0
- package/dist/parser.d.ts +6 -0
- package/dist/parser.js +137 -0
- package/dist/plugin/context.d.ts +13 -0
- package/dist/plugin/context.js +53 -0
- package/dist/plugin/create.d.ts +92 -0
- package/dist/plugin/create.js +61 -0
- package/dist/plugin/loader.d.ts +12 -0
- package/dist/plugin/loader.js +65 -0
- package/dist/plugin/manager.d.ts +53 -0
- package/dist/plugin/manager.js +135 -0
- package/dist/plugin/mod.d.ts +10 -0
- package/dist/plugin/mod.js +27 -0
- package/dist/plugin/store.d.ts +45 -0
- package/dist/plugin/store.js +60 -0
- package/dist/plugin/testing.d.ts +38 -0
- package/dist/plugin/testing.js +175 -0
- package/dist/plugin/types.d.ts +146 -0
- package/dist/tui/registry.d.ts +8 -0
- package/dist/tui/registry.js +10 -0
- package/dist/tui/types.d.ts +58 -0
- package/dist/tui/types.js +10 -0
- package/dist/types.d.ts +178 -0
- package/dist/types.js +25 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +27 -0
- package/dist/utils/merge.d.ts +13 -0
- package/dist/utils/merge.js +25 -0
- package/dist/utils/mod.d.ts +6 -0
- package/dist/utils/mod.js +2 -0
- package/dist/utils/type-helpers.d.ts +41 -0
- package/dist/utils/type-helpers.js +0 -0
- package/dist/validation.d.ts +30 -0
- package/dist/validation.js +121 -0
- package/package.json +47 -44
- package/src/cli.ts +1049 -0
- package/src/config-loader.ts +71 -0
- package/src/config.ts +270 -0
- package/src/file-loader.ts +346 -0
- package/src/global-flags.ts +50 -0
- package/src/mod.ts +74 -0
- package/src/parser.ts +212 -0
- package/src/plugin/context.ts +88 -0
- package/src/plugin/create.ts +174 -0
- package/src/plugin/loader.ts +111 -0
- package/src/plugin/manager.ts +244 -0
- package/src/plugin/mod.ts +51 -0
- package/src/plugin/store.ts +124 -0
- package/src/plugin/testing.ts +236 -0
- package/src/plugin/types.ts +206 -0
- package/src/tui/registry.ts +22 -0
- package/src/tui/types.ts +79 -0
- package/src/types.ts +285 -0
- package/src/utils/logger.ts +43 -0
- package/src/utils/merge.ts +54 -0
- package/src/utils/mod.ts +7 -0
- package/src/utils/type-helpers.ts +151 -0
- package/src/validation.ts +177 -0
- package/LICENSE +0 -21
- package/bin/core-impl/anykey/anykey-mod.d.ts +0 -12
- package/bin/core-impl/anykey/anykey-mod.js +0 -125
- package/bin/core-impl/date/date.d.ts +0 -2
- package/bin/core-impl/date/date.js +0 -236
- package/bin/core-impl/editor/editor-mod.d.ts +0 -25
- package/bin/core-impl/editor/editor-mod.js +0 -896
- package/bin/core-impl/figures/figures-mod.d.ts +0 -233
- package/bin/core-impl/figures/figures-mod.js +0 -286
- package/bin/core-impl/figures/figures.test.d.ts +0 -1
- package/bin/core-impl/figures/figures.test.js +0 -474
- package/bin/core-impl/input/confirm-prompt.d.ts +0 -5
- package/bin/core-impl/input/confirm-prompt.js +0 -173
- package/bin/core-impl/input/input-prompt.d.ts +0 -16
- package/bin/core-impl/input/input-prompt.js +0 -370
- package/bin/core-impl/launcher/_parser.d.ts +0 -2
- package/bin/core-impl/launcher/_parser.js +0 -122
- package/bin/core-impl/launcher/_utils.d.ts +0 -8
- package/bin/core-impl/launcher/_utils.js +0 -29
- package/bin/core-impl/launcher/args.d.ts +0 -3
- package/bin/core-impl/launcher/args.js +0 -89
- package/bin/core-impl/launcher/command.d.ts +0 -8
- package/bin/core-impl/launcher/command.js +0 -68
- package/bin/core-impl/launcher/launcher-mod.d.ts +0 -8
- package/bin/core-impl/launcher/launcher-mod.js +0 -34
- package/bin/core-impl/launcher/usage.d.ts +0 -3
- package/bin/core-impl/launcher/usage.js +0 -104
- package/bin/core-impl/msg-fmt/colors.d.ts +0 -30
- package/bin/core-impl/msg-fmt/colors.js +0 -42
- package/bin/core-impl/msg-fmt/logger.d.ts +0 -17
- package/bin/core-impl/msg-fmt/logger.js +0 -106
- package/bin/core-impl/msg-fmt/mapping.d.ts +0 -3
- package/bin/core-impl/msg-fmt/mapping.js +0 -49
- package/bin/core-impl/msg-fmt/messages.d.ts +0 -35
- package/bin/core-impl/msg-fmt/messages.js +0 -314
- package/bin/core-impl/msg-fmt/terminal.d.ts +0 -15
- package/bin/core-impl/msg-fmt/terminal.js +0 -59
- package/bin/core-impl/msg-fmt/variants.d.ts +0 -11
- package/bin/core-impl/msg-fmt/variants.js +0 -52
- package/bin/core-impl/next-steps/next-steps.d.ts +0 -14
- package/bin/core-impl/next-steps/next-steps.js +0 -24
- package/bin/core-impl/number/number-mod.d.ts +0 -28
- package/bin/core-impl/number/number-mod.js +0 -197
- package/bin/core-impl/results/results.d.ts +0 -7
- package/bin/core-impl/results/results.js +0 -27
- package/bin/core-impl/select/multiselect-prompt.d.ts +0 -2
- package/bin/core-impl/select/multiselect-prompt.js +0 -341
- package/bin/core-impl/select/nummultiselect-prompt.d.ts +0 -6
- package/bin/core-impl/select/nummultiselect-prompt.js +0 -105
- package/bin/core-impl/select/numselect-prompt.d.ts +0 -7
- package/bin/core-impl/select/numselect-prompt.js +0 -115
- package/bin/core-impl/select/select-prompt.d.ts +0 -33
- package/bin/core-impl/select/select-prompt.js +0 -302
- package/bin/core-impl/select/toggle-prompt.d.ts +0 -5
- package/bin/core-impl/select/toggle-prompt.js +0 -208
- package/bin/core-impl/st-end/end.d.ts +0 -2
- package/bin/core-impl/st-end/end.js +0 -42
- package/bin/core-impl/st-end/start.d.ts +0 -17
- package/bin/core-impl/st-end/start.js +0 -66
- package/bin/core-impl/task/progress.d.ts +0 -2
- package/bin/core-impl/task/progress.js +0 -57
- package/bin/core-impl/task/spinner.d.ts +0 -15
- package/bin/core-impl/task/spinner.js +0 -110
- package/bin/core-impl/utils/colorize.d.ts +0 -2
- package/bin/core-impl/utils/colorize.js +0 -134
- package/bin/core-impl/utils/errors.d.ts +0 -1
- package/bin/core-impl/utils/errors.js +0 -15
- package/bin/core-impl/utils/prevent.d.ts +0 -10
- package/bin/core-impl/utils/prevent.js +0 -69
- package/bin/core-impl/utils/prompt-end.d.ts +0 -8
- package/bin/core-impl/utils/prompt-end.js +0 -33
- package/bin/core-impl/utils/stream-text.d.ts +0 -18
- package/bin/core-impl/utils/stream-text.js +0 -136
- package/bin/core-impl/utils/system.d.ts +0 -6
- package/bin/core-impl/utils/system.js +0 -7
- package/bin/core-impl/utils/validate.d.ts +0 -22
- package/bin/core-impl/utils/validate.js +0 -17
- package/bin/core-impl/visual/animate/animate.d.ts +0 -14
- package/bin/core-impl/visual/animate/animate.js +0 -64
- package/bin/core-impl/visual/ascii-art/ascii-art.d.ts +0 -6
- package/bin/core-impl/visual/ascii-art/ascii-art.js +0 -12
- package/bin/core-types.d.ts +0 -434
- package/bin/main.d.ts +0 -41
- package/bin/main.js +0 -96
- /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,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,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
|
-
}
|