@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.
- package/README.md +176 -37
- package/bin/{components/visual/animate/animate.d.ts → libs/animate/animate-mod.d.ts} +1 -1
- package/bin/{components/visual/animate/animate.js → libs/animate/animate-mod.js} +2 -5
- package/bin/{components → libs}/anykey/anykey-mod.d.ts +2 -2
- package/bin/{components → libs}/anykey/anykey-mod.js +3 -3
- package/bin/libs/cancel/cancel.d.ts +45 -0
- package/bin/libs/cancel/cancel.js +72 -0
- package/bin/libs/confirm/confirm-alias.d.ts +1 -0
- package/bin/libs/confirm/confirm-alias.js +2 -0
- package/bin/{components/input/confirm-prompt.js → libs/confirm/confirm-mod.js} +1 -1
- package/bin/{components → libs}/editor/editor-mod.d.ts +4 -4
- package/bin/{components → libs}/editor/editor-mod.js +8 -8
- package/bin/{components → libs}/figures/figures-mod.d.ts +2 -3
- package/bin/{components → libs}/figures/figures-mod.js +1 -2
- package/bin/libs/input/input-alias.d.ts +4 -0
- package/bin/libs/input/input-alias.js +4 -0
- package/bin/{components/input/input-prompt.js → libs/input/input-mod.js} +2 -2
- package/bin/libs/intro/intro-alias.d.ts +2 -0
- package/bin/libs/intro/intro-alias.js +3 -0
- package/bin/{components/st-end/start.d.ts → libs/intro/intro-mod.d.ts} +4 -1
- package/bin/{components/st-end/start.js → libs/intro/intro-mod.js} +35 -21
- package/bin/libs/launcher/launcher-alias.d.ts +2 -0
- package/bin/libs/launcher/launcher-alias.js +2 -0
- package/bin/{components → libs}/launcher/launcher-mod.d.ts +37 -5
- package/bin/{components → libs}/launcher/launcher-mod.js +326 -205
- package/bin/{components → libs}/launcher/launcher-types.d.ts +15 -18
- package/bin/libs/launcher/trpc-orpc-support/completions.d.ts +4 -0
- package/bin/libs/launcher/trpc-orpc-support/completions.js +45 -0
- package/bin/libs/launcher/trpc-orpc-support/errors.d.ts +11 -0
- package/bin/libs/launcher/trpc-orpc-support/errors.js +10 -0
- package/bin/libs/launcher/trpc-orpc-support/index.d.ts +34 -0
- package/bin/libs/launcher/trpc-orpc-support/index.js +641 -0
- package/bin/libs/launcher/trpc-orpc-support/json-schema.d.ts +17 -0
- package/bin/libs/launcher/trpc-orpc-support/json-schema.js +168 -0
- package/bin/libs/launcher/trpc-orpc-support/json.d.ts +44 -0
- package/bin/libs/launcher/trpc-orpc-support/json.js +41 -0
- package/bin/libs/launcher/trpc-orpc-support/logging.d.ts +11 -0
- package/bin/libs/launcher/trpc-orpc-support/logging.js +26 -0
- package/bin/libs/launcher/trpc-orpc-support/parse-procedure.d.ts +2 -0
- package/bin/libs/launcher/trpc-orpc-support/parse-procedure.js +486 -0
- package/bin/libs/launcher/trpc-orpc-support/prompts.d.ts +18 -0
- package/bin/libs/launcher/trpc-orpc-support/prompts.js +534 -0
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/contract.d.ts +53 -0
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/contract.js +0 -0
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/errors.d.ts +9 -0
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/errors.js +47 -0
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/utils.d.ts +3 -0
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/utils.js +6 -0
- package/bin/libs/launcher/trpc-orpc-support/trpc-compat.d.ts +71 -0
- package/bin/libs/launcher/trpc-orpc-support/trpc-compat.js +11 -0
- package/bin/libs/launcher/trpc-orpc-support/types.d.ts +276 -0
- package/bin/libs/launcher/trpc-orpc-support/types.js +0 -0
- package/bin/libs/launcher/trpc-orpc-support/util.d.ts +9 -0
- package/bin/libs/launcher/trpc-orpc-support/util.js +9 -0
- package/bin/libs/log/log-alias.d.ts +2 -0
- package/bin/libs/log/log-alias.js +2 -0
- package/bin/{components → libs}/msg-fmt/logger.js +1 -1
- package/bin/libs/multiselect/multiselect-alias.d.ts +1 -0
- package/bin/libs/multiselect/multiselect-alias.js +2 -0
- package/bin/{components/select → libs/multiselect}/multiselect-prompt.js +1 -1
- package/bin/{components → libs}/next-steps/next-steps.d.ts +2 -2
- package/bin/{components → libs}/number/number-mod.d.ts +2 -2
- package/bin/{components → libs}/number/number-mod.js +1 -4
- package/bin/libs/outro/outro-alias.d.ts +2 -0
- package/bin/libs/outro/outro-alias.js +3 -0
- package/bin/libs/outro/outro-mod.d.ts +8 -0
- package/bin/libs/outro/outro-mod.js +55 -0
- package/bin/{components → libs}/results/results.d.ts +2 -2
- package/bin/libs/select/aliases-alias.d.ts +1 -0
- package/bin/libs/select/aliases-alias.js +2 -0
- package/bin/{components → libs}/select/select-prompt.d.ts +6 -5
- package/bin/{components → libs}/select/select-prompt.js +6 -4
- package/bin/{components → libs}/select/toggle-prompt.js +1 -1
- package/bin/libs/spinner/spinner-alias.d.ts +1 -0
- package/bin/libs/spinner/spinner-alias.js +2 -0
- package/bin/libs/spinner/spinner-mod.d.ts +106 -0
- package/bin/libs/spinner/spinner-mod.js +265 -0
- package/bin/{components → libs}/task/progress.d.ts +1 -1
- package/bin/{components → libs}/task/progress.js +1 -1
- package/bin/{components/task/spinner.d.ts → libs/task/task-spin.d.ts} +3 -3
- package/bin/{components/task/spinner.js → libs/task/task-spin.js} +2 -2
- package/bin/{utils → libs/utils}/colorize.d.ts +1 -1
- package/bin/{utils → libs/utils}/prevent.d.ts +1 -1
- package/bin/{utils → libs/utils}/prevent.js +2 -2
- package/bin/{utils → libs/utils}/prompt-end.d.ts +1 -1
- package/bin/{utils → libs/utils}/prompt-end.js +2 -2
- package/bin/{utils → libs/utils}/stream-text.d.ts +1 -1
- package/bin/{utils → libs/utils}/stream-text.js +2 -2
- package/bin/{utils → libs/utils}/validate.d.ts +2 -2
- package/bin/mod.d.ts +66 -38
- package/bin/mod.js +102 -43
- package/bin/types.d.ts +36 -36
- package/package.json +17 -3
- package/bin/components/st-end/end.d.ts +0 -2
- package/bin/components/st-end/end.js +0 -42
- package/bin/hooks/spinner/spinner-mod.d.ts +0 -64
- package/bin/hooks/spinner/spinner-mod.js +0 -74
- /package/bin/{components/input/confirm-prompt.d.ts → libs/confirm/confirm-mod.d.ts} +0 -0
- /package/bin/{components → libs}/date/date.d.ts +0 -0
- /package/bin/{components → libs}/date/date.js +0 -0
- /package/bin/{components/input/input-prompt.d.ts → libs/input/input-mod.d.ts} +0 -0
- /package/bin/{components → libs}/launcher/launcher-types.js +0 -0
- /package/bin/{components → libs}/launcher/run-command.d.ts +0 -0
- /package/bin/{components → libs}/launcher/run-command.js +0 -0
- /package/bin/{components → libs}/msg-fmt/colors.d.ts +0 -0
- /package/bin/{components → libs}/msg-fmt/colors.js +0 -0
- /package/bin/{components → libs}/msg-fmt/logger.d.ts +0 -0
- /package/bin/{components → libs}/msg-fmt/mapping.d.ts +0 -0
- /package/bin/{components → libs}/msg-fmt/mapping.js +0 -0
- /package/bin/{components → libs}/msg-fmt/messages.d.ts +0 -0
- /package/bin/{components → libs}/msg-fmt/messages.js +0 -0
- /package/bin/{components → libs}/msg-fmt/terminal.d.ts +0 -0
- /package/bin/{components → libs}/msg-fmt/terminal.js +0 -0
- /package/bin/{components → libs}/msg-fmt/variants.d.ts +0 -0
- /package/bin/{components → libs}/msg-fmt/variants.js +0 -0
- /package/bin/{components/select → libs/multiselect}/multiselect-prompt.d.ts +0 -0
- /package/bin/{components → libs}/next-steps/next-steps.js +0 -0
- /package/bin/{components → libs}/results/results.js +0 -0
- /package/bin/{components → libs}/select/nummultiselect-prompt.d.ts +0 -0
- /package/bin/{components → libs}/select/nummultiselect-prompt.js +0 -0
- /package/bin/{components → libs}/select/numselect-prompt.d.ts +0 -0
- /package/bin/{components → libs}/select/numselect-prompt.js +0 -0
- /package/bin/{components → libs}/select/toggle-prompt.d.ts +0 -0
- /package/bin/{utils → libs/utils}/colorize.js +0 -0
- /package/bin/{utils → libs/utils}/errors.d.ts +0 -0
- /package/bin/{utils → libs/utils}/errors.js +0 -0
- /package/bin/{utils → libs/utils}/system.d.ts +0 -0
- /package/bin/{utils → libs/utils}/system.js +0 -0
- /package/bin/{utils → libs/utils}/validate.js +0 -0
- /package/bin/{components/visual/ascii-art/ascii-art.d.ts → libs/visual/visual-mod.d.ts} +0 -0
- /package/bin/{components/visual/ascii-art/ascii-art.js → libs/visual/visual-mod.js} +0 -0
|
@@ -3,8 +3,8 @@ import { isUnicodeSupported } from "@reliverse/runtime";
|
|
|
3
3
|
import readline from "node:readline/promises";
|
|
4
4
|
import { bar, msg, msgUndoAll } from "../msg-fmt/messages.js";
|
|
5
5
|
import { deleteLastLine } from "../msg-fmt/terminal.js";
|
|
6
|
-
import { completePrompt } from "
|
|
7
|
-
import { streamText } from "
|
|
6
|
+
import { completePrompt } from "../utils/prompt-end.js";
|
|
7
|
+
import { streamText } from "../utils/stream-text.js";
|
|
8
8
|
const unicode = isUnicodeSupported();
|
|
9
9
|
const S_MASK = unicode ? "\u258B" : "*";
|
|
10
10
|
function getMaskChar(customMask) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Fonts } from "figlet";
|
|
1
2
|
import type { PreventWrongTerminalSizeOptions, PromptOptions } from "../../types.js";
|
|
2
3
|
type StartPromptOptions = PromptOptions & {
|
|
3
4
|
clearConsole?: boolean;
|
|
@@ -12,6 +13,8 @@ type StartPromptOptions = PromptOptions & {
|
|
|
12
13
|
wrongTerminalSize?: boolean;
|
|
13
14
|
windowsHomeDirRoot?: boolean;
|
|
14
15
|
};
|
|
16
|
+
variant?: "header" | "ascii-art";
|
|
17
|
+
asciiArtFont?: Fonts;
|
|
15
18
|
};
|
|
16
|
-
export declare function
|
|
19
|
+
export declare function introPrompt(optionsOrTitle: StartPromptOptions | string): Promise<void>;
|
|
17
20
|
export {};
|
|
@@ -10,27 +10,33 @@ import {
|
|
|
10
10
|
preventWrongTerminalSize,
|
|
11
11
|
preventWindowsHomeDirRoot,
|
|
12
12
|
preventUnsupportedTTY
|
|
13
|
-
} from "
|
|
14
|
-
import { pm, reliversePrompts } from "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
} from "../utils/prevent.js";
|
|
14
|
+
import { pm, reliversePrompts } from "../utils/system.js";
|
|
15
|
+
import { createAsciiArt } from "../visual/visual-mod.js";
|
|
16
|
+
export async function introPrompt(optionsOrTitle) {
|
|
17
|
+
const options = typeof optionsOrTitle === "string" ? { title: optionsOrTitle } : optionsOrTitle;
|
|
18
|
+
const {
|
|
19
|
+
title = "",
|
|
20
|
+
titleColor = "inverse",
|
|
21
|
+
titleTypography = "none",
|
|
22
|
+
titleVariant,
|
|
23
|
+
borderColor = "dim",
|
|
24
|
+
clearConsole = false,
|
|
25
|
+
horizontalLine = true,
|
|
26
|
+
horizontalLineLength: initialHorizontalLineLength = 0,
|
|
27
|
+
packageName = reliversePrompts.name,
|
|
28
|
+
packageVersion = reliversePrompts.version,
|
|
29
|
+
terminalSizeOptions = {},
|
|
30
|
+
isDev = false,
|
|
31
|
+
prevent = {
|
|
32
|
+
unsupportedTTY: true,
|
|
33
|
+
wrongTerminalSize: true,
|
|
34
|
+
windowsHomeDirRoot: true
|
|
35
|
+
},
|
|
36
|
+
variant = "header",
|
|
37
|
+
asciiArtFont
|
|
38
|
+
} = options;
|
|
39
|
+
let horizontalLineLength = initialHorizontalLineLength;
|
|
34
40
|
if (prevent.windowsHomeDirRoot) {
|
|
35
41
|
preventWindowsHomeDirRoot(process.cwd());
|
|
36
42
|
}
|
|
@@ -44,6 +50,14 @@ export async function startPrompt({
|
|
|
44
50
|
const exactTerminalWidth = getExactTerminalWidth();
|
|
45
51
|
const terminalHeight = getTerminalHeight();
|
|
46
52
|
const formattedTitle = title !== "" ? title : `${packageName} v${packageVersion} | ${pm.packageManager} v${pm.version} | ${getCurrentTerminalName()}${isDev && terminalWidth > 80 ? ` | isDev | w${terminalWidth} h${terminalHeight}` : ""}`;
|
|
53
|
+
if (variant === "ascii-art") {
|
|
54
|
+
await createAsciiArt({
|
|
55
|
+
message: formattedTitle,
|
|
56
|
+
font: asciiArtFont,
|
|
57
|
+
clearConsole
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
47
61
|
if (horizontalLineLength === 0) {
|
|
48
62
|
const titleFullLength = titleColor === "inverse" ? `\u2800${formattedTitle}\u2800`.length + 5 : formattedTitle.length + 5;
|
|
49
63
|
horizontalLineLength = Math.max(1, exactTerminalWidth - titleFullLength);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReliArgParserOptions } from "@reliverse/reliarg";
|
|
2
|
-
import type { ArgDefinitions, Command, DefineCommandOptions, EmptyArgs,
|
|
2
|
+
import type { ArgDefinitions, Command, DefineCommandOptions, EmptyArgs, FileBasedOptions } from "./launcher-types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Defines a command with metadata, argument definitions,
|
|
5
5
|
* an execution function, and (optional) subCommands.
|
|
@@ -9,7 +9,7 @@ export declare function defineCommand<A extends ArgDefinitions = EmptyArgs>(opti
|
|
|
9
9
|
* Show usage for a given command.
|
|
10
10
|
*/
|
|
11
11
|
export declare function showUsage<A extends ArgDefinitions>(command: Command<A>, parserOptions?: ReliArgParserOptions & {
|
|
12
|
-
|
|
12
|
+
fileBased?: FileBasedOptions;
|
|
13
13
|
autoExit?: boolean;
|
|
14
14
|
metaSettings?: {
|
|
15
15
|
showDescriptionOnMain?: boolean;
|
|
@@ -17,6 +17,10 @@ export declare function showUsage<A extends ArgDefinitions>(command: Command<A>,
|
|
|
17
17
|
_fileBasedCurrentDir?: string;
|
|
18
18
|
_fileBasedPathSegments?: string[];
|
|
19
19
|
_isSubcommand?: boolean;
|
|
20
|
+
}, globalCliMeta?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
version?: string;
|
|
23
|
+
description?: string;
|
|
20
24
|
}): Promise<void>;
|
|
21
25
|
/**
|
|
22
26
|
* Primary entry point to run a command. This function supports:
|
|
@@ -28,13 +32,41 @@ export declare function showUsage<A extends ArgDefinitions>(command: Command<A>,
|
|
|
28
32
|
* This function passes along remaining arguments to command runners to ensure
|
|
29
33
|
* consistent parsing.
|
|
30
34
|
*/
|
|
31
|
-
export declare function
|
|
32
|
-
|
|
35
|
+
export declare function createCli<A extends ArgDefinitions = EmptyArgs>(options: Command<A> | {
|
|
36
|
+
name?: string;
|
|
37
|
+
version?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
mainCommand?: Command<A>;
|
|
40
|
+
fileBased?: FileBasedOptions;
|
|
33
41
|
autoExit?: boolean;
|
|
34
42
|
metaSettings?: {
|
|
35
43
|
showDescriptionOnMain?: boolean;
|
|
36
44
|
};
|
|
37
|
-
|
|
45
|
+
meta?: Command<A>["meta"];
|
|
46
|
+
args?: Command<A>["args"];
|
|
47
|
+
run?: Command<A>["run"];
|
|
48
|
+
commands?: Command<A>["commands"];
|
|
49
|
+
onCmdInit?: Command<A>["onCmdInit"];
|
|
50
|
+
onCmdExit?: Command<A>["onCmdExit"];
|
|
51
|
+
onLauncherInit?: Command<A>["onLauncherInit"];
|
|
52
|
+
onLauncherExit?: Command<A>["onLauncherExit"];
|
|
53
|
+
}, legacyParserOptions?: ReliArgParserOptions & {
|
|
54
|
+
fileBased?: FileBasedOptions;
|
|
55
|
+
autoExit?: boolean;
|
|
56
|
+
metaSettings?: {
|
|
57
|
+
showDescriptionOnMain?: boolean;
|
|
58
|
+
};
|
|
59
|
+
}): {
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use createCli() directly instead. This method will be removed in a future version.
|
|
62
|
+
* @example
|
|
63
|
+
* // Instead of:
|
|
64
|
+
* createCli({...}).run()
|
|
65
|
+
* // Use:
|
|
66
|
+
* await createCli({...})
|
|
67
|
+
*/
|
|
68
|
+
run(_ctx?: any): Promise<void>;
|
|
69
|
+
};
|
|
38
70
|
/**
|
|
39
71
|
* Helper to define argument definitions with improved type inference
|
|
40
72
|
* for IntelliSense and validation for array defaults against options.
|