@reliverse/rempts 1.7.43 → 1.7.45
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 +1 -1
- package/dist-npm/bin/mod.d.mts +2333 -0
- package/dist-npm/bin/mod.mjs +8236 -0
- package/package.json +84 -42
- package/bin/libs/animate/animate-mod.d.ts +0 -14
- package/bin/libs/animate/animate-mod.js +0 -62
- package/bin/libs/anykey/anykey-mod.d.ts +0 -12
- package/bin/libs/anykey/anykey-mod.js +0 -125
- package/bin/libs/cancel/cancel.d.ts +0 -45
- package/bin/libs/cancel/cancel.js +0 -72
- package/bin/libs/confirm/confirm-alias.d.ts +0 -2
- package/bin/libs/confirm/confirm-alias.js +0 -2
- package/bin/libs/confirm/confirm-mod.d.ts +0 -5
- package/bin/libs/confirm/confirm-mod.js +0 -179
- package/bin/libs/date/date.d.ts +0 -2
- package/bin/libs/date/date.js +0 -236
- package/bin/libs/editor/editor-mod.d.ts +0 -25
- package/bin/libs/editor/editor-mod.js +0 -897
- package/bin/libs/figures/figures-mod.d.ts +0 -461
- package/bin/libs/figures/figures-mod.js +0 -285
- package/bin/libs/group/group-mod.d.ts +0 -33
- package/bin/libs/group/group-mod.js +0 -93
- package/bin/libs/input/input-alias.d.ts +0 -5
- package/bin/libs/input/input-alias.js +0 -4
- package/bin/libs/input/input-mod.d.ts +0 -16
- package/bin/libs/input/input-mod.js +0 -372
- package/bin/libs/intro/intro-alias.d.ts +0 -2
- package/bin/libs/intro/intro-alias.js +0 -3
- package/bin/libs/intro/intro-mod.d.ts +0 -20
- package/bin/libs/intro/intro-mod.js +0 -81
- package/bin/libs/launcher/command-runner.d.ts +0 -18
- package/bin/libs/launcher/command-runner.js +0 -76
- package/bin/libs/launcher/command-typed.d.ts +0 -16
- package/bin/libs/launcher/command-typed.js +0 -60
- package/bin/libs/launcher/launcher-alias.d.ts +0 -2
- package/bin/libs/launcher/launcher-alias.js +0 -2
- package/bin/libs/launcher/launcher-mod.d.ts +0 -162
- package/bin/libs/launcher/launcher-mod.js +0 -1222
- package/bin/libs/launcher/launcher-types.d.ts +0 -159
- package/bin/libs/launcher/launcher-types.js +0 -0
- package/bin/libs/launcher/trpc-orpc-support/completions.d.ts +0 -4
- package/bin/libs/launcher/trpc-orpc-support/completions.js +0 -45
- package/bin/libs/launcher/trpc-orpc-support/errors.d.ts +0 -11
- package/bin/libs/launcher/trpc-orpc-support/errors.js +0 -10
- package/bin/libs/launcher/trpc-orpc-support/index.d.ts +0 -34
- package/bin/libs/launcher/trpc-orpc-support/index.js +0 -641
- package/bin/libs/launcher/trpc-orpc-support/json-schema.d.ts +0 -17
- package/bin/libs/launcher/trpc-orpc-support/json-schema.js +0 -168
- package/bin/libs/launcher/trpc-orpc-support/json.d.ts +0 -44
- package/bin/libs/launcher/trpc-orpc-support/json.js +0 -41
- package/bin/libs/launcher/trpc-orpc-support/logging.d.ts +0 -11
- package/bin/libs/launcher/trpc-orpc-support/logging.js +0 -26
- package/bin/libs/launcher/trpc-orpc-support/parse-procedure.d.ts +0 -2
- package/bin/libs/launcher/trpc-orpc-support/parse-procedure.js +0 -486
- package/bin/libs/launcher/trpc-orpc-support/prompts.d.ts +0 -18
- package/bin/libs/launcher/trpc-orpc-support/prompts.js +0 -534
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/contract.d.ts +0 -53
- 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 +0 -9
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/errors.js +0 -47
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/utils.d.ts +0 -3
- package/bin/libs/launcher/trpc-orpc-support/standard-schema/utils.js +0 -6
- package/bin/libs/launcher/trpc-orpc-support/trpc-compat.d.ts +0 -71
- package/bin/libs/launcher/trpc-orpc-support/trpc-compat.js +0 -11
- package/bin/libs/launcher/trpc-orpc-support/types.d.ts +0 -276
- package/bin/libs/launcher/trpc-orpc-support/types.js +0 -0
- package/bin/libs/launcher/trpc-orpc-support/util.d.ts +0 -9
- package/bin/libs/launcher/trpc-orpc-support/util.js +0 -9
- package/bin/libs/log/log-alias.d.ts +0 -1
- package/bin/libs/log/log-alias.js +0 -2
- package/bin/libs/msg-fmt/colors.d.ts +0 -30
- package/bin/libs/msg-fmt/colors.js +0 -42
- package/bin/libs/msg-fmt/logger.d.ts +0 -17
- package/bin/libs/msg-fmt/logger.js +0 -103
- package/bin/libs/msg-fmt/mapping.d.ts +0 -3
- package/bin/libs/msg-fmt/mapping.js +0 -49
- package/bin/libs/msg-fmt/messages.d.ts +0 -35
- package/bin/libs/msg-fmt/messages.js +0 -319
- package/bin/libs/msg-fmt/terminal.d.ts +0 -15
- package/bin/libs/msg-fmt/terminal.js +0 -60
- package/bin/libs/msg-fmt/variants.d.ts +0 -11
- package/bin/libs/msg-fmt/variants.js +0 -52
- package/bin/libs/multiselect/multiselect-alias.d.ts +0 -2
- package/bin/libs/multiselect/multiselect-alias.js +0 -2
- package/bin/libs/multiselect/multiselect-prompt.d.ts +0 -2
- package/bin/libs/multiselect/multiselect-prompt.js +0 -348
- package/bin/libs/next-steps/next-steps.d.ts +0 -14
- package/bin/libs/next-steps/next-steps.js +0 -24
- package/bin/libs/number/number-mod.d.ts +0 -28
- package/bin/libs/number/number-mod.js +0 -194
- package/bin/libs/outro/outro-alias.d.ts +0 -2
- package/bin/libs/outro/outro-alias.js +0 -3
- package/bin/libs/outro/outro-mod.d.ts +0 -8
- package/bin/libs/outro/outro-mod.js +0 -55
- package/bin/libs/results/results.d.ts +0 -7
- package/bin/libs/results/results.js +0 -27
- package/bin/libs/select/nummultiselect-prompt.d.ts +0 -6
- package/bin/libs/select/nummultiselect-prompt.js +0 -105
- package/bin/libs/select/numselect-prompt.d.ts +0 -7
- package/bin/libs/select/numselect-prompt.js +0 -115
- package/bin/libs/select/select-alias.d.ts +0 -9
- package/bin/libs/select/select-alias.js +0 -9
- package/bin/libs/select/select-prompt.d.ts +0 -5
- package/bin/libs/select/select-prompt.js +0 -314
- package/bin/libs/select/toggle-prompt.d.ts +0 -5
- package/bin/libs/select/toggle-prompt.js +0 -209
- package/bin/libs/spinner/spinner-alias.d.ts +0 -1
- package/bin/libs/spinner/spinner-alias.js +0 -2
- package/bin/libs/spinner/spinner-mod.d.ts +0 -106
- package/bin/libs/spinner/spinner-mod.js +0 -265
- package/bin/libs/task/progress.d.ts +0 -2
- package/bin/libs/task/progress.js +0 -57
- package/bin/libs/task/task-spin.d.ts +0 -15
- package/bin/libs/task/task-spin.js +0 -110
- package/bin/libs/utils/colorize.d.ts +0 -2
- package/bin/libs/utils/colorize.js +0 -135
- package/bin/libs/utils/errors.d.ts +0 -1
- package/bin/libs/utils/errors.js +0 -17
- package/bin/libs/utils/prevent.d.ts +0 -8
- package/bin/libs/utils/prevent.js +0 -65
- package/bin/libs/utils/prompt-end.d.ts +0 -8
- package/bin/libs/utils/prompt-end.js +0 -34
- package/bin/libs/utils/stream-text.d.ts +0 -18
- package/bin/libs/utils/stream-text.js +0 -136
- package/bin/libs/utils/system.d.ts +0 -6
- package/bin/libs/utils/system.js +0 -7
- package/bin/libs/utils/validate.d.ts +0 -21
- package/bin/libs/utils/validate.js +0 -17
- package/bin/libs/visual/visual-mod.d.ts +0 -6
- package/bin/libs/visual/visual-mod.js +0 -13
- package/bin/mod.d.ts +0 -69
- package/bin/mod.js +0 -159
- package/bin/types.d.ts +0 -371
- package/bin/types.js +0 -0
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from "./standard-schema/contract";
|
|
2
|
-
/**
|
|
3
|
-
* Type which looks *enough* like a trpc v11(+?) router to infer its types correctly
|
|
4
|
-
* This is written from scratch to avoid any kind of dependency on @trpc/server v11+
|
|
5
|
-
*/
|
|
6
|
-
export interface Trpc11RouterLike {
|
|
7
|
-
_def: {
|
|
8
|
-
_config: {
|
|
9
|
-
$types: {
|
|
10
|
-
meta: any;
|
|
11
|
-
ctx: any;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
procedures: Record<string, Trpc11ProcedureLike | Trpc11ProcedureRecordLike | Record<string, Trpc11ProcedureLike>>;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/** Even though you use `t.router({})` to create a sub-router, the actual type is a record of procedures and sub-routers rather than a root-level router */
|
|
18
|
-
export interface Trpc11ProcedureRecordLike {
|
|
19
|
-
[key: string]: Trpc11ProcedureLike | Trpc11ProcedureRecordLike;
|
|
20
|
-
}
|
|
21
|
-
export interface Trpc11ProcedureLike {
|
|
22
|
-
_def: {
|
|
23
|
-
type: "mutation" | "query" | "subscription";
|
|
24
|
-
_type?: undefined;
|
|
25
|
-
meta?: any;
|
|
26
|
-
inputs?: unknown[];
|
|
27
|
-
$types: {
|
|
28
|
-
input: any;
|
|
29
|
-
output: any;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface Trpc10RouterLike {
|
|
34
|
-
_def: {
|
|
35
|
-
_config: {
|
|
36
|
-
$types: {
|
|
37
|
-
meta: any;
|
|
38
|
-
ctx: any;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
procedures: Record<string, Trpc10ProcedureLike | Trpc10RouterLike>;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export interface Trpc10ProcedureLike {
|
|
45
|
-
_def: {
|
|
46
|
-
type?: undefined;
|
|
47
|
-
mutation?: boolean;
|
|
48
|
-
query?: boolean;
|
|
49
|
-
subscription?: boolean;
|
|
50
|
-
meta?: any;
|
|
51
|
-
inputs: unknown[];
|
|
52
|
-
_input_in: any;
|
|
53
|
-
_output_out: any;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export interface OrpcProcedureLike<Ctx> {
|
|
57
|
-
"~orpc": {
|
|
58
|
-
__initialContext?: (context: Ctx) => unknown;
|
|
59
|
-
inputSchema?: StandardSchemaV1;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export interface OrpcRouterLike<Ctx> {
|
|
63
|
-
[key: string]: OrpcProcedureLike<Ctx> | OrpcRouterLike<Ctx>;
|
|
64
|
-
}
|
|
65
|
-
export type CreateCallerFactoryLike<Procedures = Record<string, (input: unknown) => unknown>> = (router: any) => (context: any) => Procedures;
|
|
66
|
-
export type AnyRouter = Trpc10RouterLike | Trpc11RouterLike | OrpcRouterLike<any>;
|
|
67
|
-
export type AnyProcedure = Trpc10ProcedureLike | Trpc11ProcedureLike;
|
|
68
|
-
export type inferRouterContext<R extends AnyRouter> = R extends Trpc10RouterLike | Trpc11RouterLike ? R["_def"]["_config"]["$types"]["ctx"] : R extends OrpcRouterLike<infer Ctx> ? Ctx : never;
|
|
69
|
-
export declare const isTrpc11Procedure: (procedure: AnyProcedure) => procedure is Trpc11ProcedureLike;
|
|
70
|
-
export declare const isTrpc11Router: (router: AnyRouter) => router is Trpc11RouterLike;
|
|
71
|
-
export declare const isOrpcRouter: (router: AnyRouter) => router is OrpcRouterLike<any>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const isTrpc11Procedure = (procedure) => {
|
|
2
|
-
return "type" in procedure._def && typeof procedure._def.type === "string";
|
|
3
|
-
};
|
|
4
|
-
export const isTrpc11Router = (router) => {
|
|
5
|
-
if (isOrpcRouter(router)) return false;
|
|
6
|
-
const procedure = Object.values(router._def.procedures)[0];
|
|
7
|
-
return Boolean(procedure && isTrpc11Procedure(procedure));
|
|
8
|
-
};
|
|
9
|
-
export const isOrpcRouter = (router) => {
|
|
10
|
-
return !("_def" in router) || router._def && "~orpc" in router._def;
|
|
11
|
-
};
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema7 } from "json-schema";
|
|
2
|
-
import type { JsonSchema7Type } from "zod-to-json-schema";
|
|
3
|
-
import type { CommandJSON } from "./json";
|
|
4
|
-
import type { AnyRouter, CreateCallerFactoryLike, inferRouterContext } from "./trpc-compat";
|
|
5
|
-
export interface TrpcCliParams<R extends AnyRouter> extends Dependencies {
|
|
6
|
-
/** A tRPC router. Procedures will become CLI commands. */
|
|
7
|
-
router: R;
|
|
8
|
-
name?: string;
|
|
9
|
-
version?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
usage?: string | string[];
|
|
12
|
-
/** Context to be supplied when invoking the router. */
|
|
13
|
-
context?: inferRouterContext<R>;
|
|
14
|
-
/** @deprecated this is actually **removed** not deprecated; use `aliases` on each procedure `meta` instead */
|
|
15
|
-
alias?: never;
|
|
16
|
-
/** @deprecated this is actually **removed** not deprecated; set `default: true` on the procedure `meta` instead */
|
|
17
|
-
_default?: never;
|
|
18
|
-
/** The `@trpc/server` module to use for calling procedures. Required when using trpc v10. */
|
|
19
|
-
trpcServer?: TrpcServerModuleLike | Promise<TrpcServerModuleLike>;
|
|
20
|
-
}
|
|
21
|
-
/** Rough shape of the `@trpc/server` (v10) module. Needed to pass in to `createRpcCli` when using trpc v10. */
|
|
22
|
-
export interface TrpcServerModuleLike {
|
|
23
|
-
initTRPC: {
|
|
24
|
-
create: () => {
|
|
25
|
-
createCallerFactory: CreateCallerFactoryLike<{}>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Optional interface for describing procedures via meta - if your router conforms to this meta shape, it will contribute to the CLI help text.
|
|
31
|
-
*/
|
|
32
|
-
export interface TrpcCliMeta {
|
|
33
|
-
/** Version of the script displayed in `--help` output. Use to avoid enabling `--version` option. */
|
|
34
|
-
version?: string;
|
|
35
|
-
/** Description of the script or command to display in `--help` output. */
|
|
36
|
-
description?: string;
|
|
37
|
-
/** Usage code examples to display in `--help` output. */
|
|
38
|
-
usage?: false | string | string[];
|
|
39
|
-
/** Example code snippets to display in `--help` output. */
|
|
40
|
-
examples?: string | string[];
|
|
41
|
-
/** If true, this command will be run if no command is specified. */
|
|
42
|
-
default?: boolean;
|
|
43
|
-
aliases?: {
|
|
44
|
-
/** Aliases for the command. Note: take care to avoid conflicts with other commands. */
|
|
45
|
-
command?: string[];
|
|
46
|
-
/** Aliases for the options. Note: take care to avoid conflicts with other options. An error will be thrown if an alias is defined for a non-existent option. */
|
|
47
|
-
options?: Record<string, string>;
|
|
48
|
-
};
|
|
49
|
-
/** If true, will use a single CLI option expect the entire input to be parsed in as JSON, e.g. `--input '{"foo": "bar"}`. Can be useful to opt out of the default mapping of input schemas to CLI options. */
|
|
50
|
-
jsonInput?: boolean;
|
|
51
|
-
/** Sub-property for the CLI meta. If present, will take precedence over the top-level meta, to avoid conflicts with other tools. */
|
|
52
|
-
cliMeta?: TrpcCliMeta;
|
|
53
|
-
}
|
|
54
|
-
export interface ParsedProcedure {
|
|
55
|
-
positionalParameters: {
|
|
56
|
-
name: string;
|
|
57
|
-
description: string;
|
|
58
|
-
type: "string" | "number" | "boolean" | (string & {});
|
|
59
|
-
required: boolean;
|
|
60
|
-
array: boolean;
|
|
61
|
-
}[];
|
|
62
|
-
/** JSON Schema type describing the flags for the procedure */
|
|
63
|
-
optionsJsonSchema: JsonSchema7Type;
|
|
64
|
-
/**
|
|
65
|
-
* Function for taking parsed argv output and transforming it so it can be passed into the procedure.
|
|
66
|
-
* Needed because this function is where inspect the input schema(s) and determine how to map the argv to the input
|
|
67
|
-
*/
|
|
68
|
-
getPojoInput: (argv: {
|
|
69
|
-
positionalValues: (string | string[])[];
|
|
70
|
-
options: Record<string, unknown>;
|
|
71
|
-
}) => unknown;
|
|
72
|
-
}
|
|
73
|
-
export type Result<T> = {
|
|
74
|
-
success: true;
|
|
75
|
-
value: T;
|
|
76
|
-
} | {
|
|
77
|
-
success: false;
|
|
78
|
-
error: string;
|
|
79
|
-
};
|
|
80
|
-
/** A function that logs any inputs. e.g. `console.info` */
|
|
81
|
-
export type Log = (...args: unknown[]) => void;
|
|
82
|
-
/**
|
|
83
|
-
* A struct which has `info` and `error` functions for logging. Easiest example: `console`
|
|
84
|
-
* But most loggers like pino, winston etc. have a similar interface.
|
|
85
|
-
*/
|
|
86
|
-
export interface Logger {
|
|
87
|
-
info?: Log;
|
|
88
|
-
error?: Log;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Slim reconstruction of an `omelette` instance. Hand-written here to avoid a hard dependency on `omelette` or its types.
|
|
92
|
-
* Usually you will just pass in an `omelette` instance by doing something like
|
|
93
|
-
*
|
|
94
|
-
* ```ts
|
|
95
|
-
* import omelette from 'omelette'
|
|
96
|
-
* import {createRpcCli} from '@reliverse/rempts'
|
|
97
|
-
*
|
|
98
|
-
* const cli = createRpcCli({
|
|
99
|
-
* router: myRouter,
|
|
100
|
-
* completion: omelette('myprogram'),
|
|
101
|
-
* })
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* Or it also accepts an async function that resolves to an `omelette` instance, so you can use dynamic import:
|
|
105
|
-
*
|
|
106
|
-
* ```ts
|
|
107
|
-
* import {createRpcCli} from '@reliverse/rempts'
|
|
108
|
-
*
|
|
109
|
-
* const cli = await createRpcCli({
|
|
110
|
-
* router: myRouter,
|
|
111
|
-
* completion: () => import('omelette').then(omelette => omelette.default('myprogram')),
|
|
112
|
-
* })
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
export interface OmeletteInstanceLike {
|
|
116
|
-
on: (event: "complete", callback: (fragment: string, params: {
|
|
117
|
-
line: string;
|
|
118
|
-
fragment: number;
|
|
119
|
-
reply: (suggestions: string[]) => void;
|
|
120
|
-
}) => void) => void;
|
|
121
|
-
init: () => void;
|
|
122
|
-
setupShellInitFile: () => void;
|
|
123
|
-
cleanupShellInitFile: () => void;
|
|
124
|
-
tree: (value: any) => this;
|
|
125
|
-
}
|
|
126
|
-
export interface InquirerPromptOptions {
|
|
127
|
-
message: string;
|
|
128
|
-
required?: boolean;
|
|
129
|
-
validate?: (input: string) => boolean | string;
|
|
130
|
-
default?: any;
|
|
131
|
-
}
|
|
132
|
-
/** looks like the `@inquirer/prompts` package */
|
|
133
|
-
export interface InquirerPromptsLike {
|
|
134
|
-
input: (params: InquirerPromptOptions) => Promise<string>;
|
|
135
|
-
confirm: (params: InquirerPromptOptions) => Promise<boolean>;
|
|
136
|
-
}
|
|
137
|
-
/** looks like the `prompts` package */
|
|
138
|
-
export interface PromptsLike {
|
|
139
|
-
prompt: Function;
|
|
140
|
-
inject: Function;
|
|
141
|
-
}
|
|
142
|
-
/** looks like the `enquirer` package */
|
|
143
|
-
export interface EnquirerLike {
|
|
144
|
-
prompt: <T>(params: {
|
|
145
|
-
type: "input";
|
|
146
|
-
name: string;
|
|
147
|
-
message: string;
|
|
148
|
-
validate?: (input: string) => boolean | string;
|
|
149
|
-
initial?: unknown;
|
|
150
|
-
}) => Promise<T>;
|
|
151
|
-
}
|
|
152
|
-
export interface ClackPromptsLike {
|
|
153
|
-
intro: (title: string) => void;
|
|
154
|
-
outro: (title: string) => void;
|
|
155
|
-
}
|
|
156
|
-
export type Promptable = InquirerPromptsLike | EnquirerLike | PromptsLike | Prompter | ClackPromptsLike | ((command: CommanderProgramLike) => Prompter);
|
|
157
|
-
export interface TrpcCliRunParams {
|
|
158
|
-
argv?: string[];
|
|
159
|
-
logger?: Logger;
|
|
160
|
-
completion?: OmeletteInstanceLike | (() => Promise<OmeletteInstanceLike>);
|
|
161
|
-
prompts?: Promptable;
|
|
162
|
-
/** Format an error thrown by the root procedure before logging to `logger.error` */
|
|
163
|
-
formatError?: (error: unknown) => string;
|
|
164
|
-
process?: {
|
|
165
|
-
exit: (code: number) => never;
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Type that looks like a `commander` Command instance, but doesn't require a dependency on `commander` to avoid awkward typescript errors.
|
|
170
|
-
* If you need to use it as a `Command` instance, just cast it with `as` to `import('commander').Command`.
|
|
171
|
-
*/
|
|
172
|
-
export interface CommanderProgramLike {
|
|
173
|
-
name: () => string;
|
|
174
|
-
parseAsync: (args: string[], options?: {
|
|
175
|
-
from: "user" | "node" | "electron";
|
|
176
|
-
}) => Promise<unknown>;
|
|
177
|
-
helpInformation: () => string;
|
|
178
|
-
}
|
|
179
|
-
export interface TrpcCli {
|
|
180
|
-
/** run the CLI - gets args from `process.argv` by default */
|
|
181
|
-
run: (params?: TrpcCliRunParams, program?: CommanderProgramLike) => Promise<void>;
|
|
182
|
-
/**
|
|
183
|
-
* Build a `Commander` program from the CLI - you can use this to manually customise the program before passing it to `.run(...)`.
|
|
184
|
-
* Note that you will need to cast the return value to `import('commander').Command` to use it as a `Command` instance.
|
|
185
|
-
*/
|
|
186
|
-
buildProgram: (params?: TrpcCliRunParams) => CommanderProgramLike;
|
|
187
|
-
/**
|
|
188
|
-
* @experimental
|
|
189
|
-
* Get a JSON representation of the CLI - useful for generating documentation etc. This function returns basic information about the CLI
|
|
190
|
-
* and each command - to get any extra details you will need to use the `buildProgram` function and walk the tree of commands yourself.
|
|
191
|
-
*/
|
|
192
|
-
toJSON: (program?: CommanderProgramLike) => CommandJSON;
|
|
193
|
-
}
|
|
194
|
-
export interface Dependencies {
|
|
195
|
-
"@valibot/to-json-schema"?: {
|
|
196
|
-
toJsonSchema: (input: unknown, options?: {
|
|
197
|
-
errorMode?: "throw" | "ignore" | "warn";
|
|
198
|
-
}) => JSONSchema7;
|
|
199
|
-
};
|
|
200
|
-
effect?: {
|
|
201
|
-
Schema: {
|
|
202
|
-
isSchema: (input: unknown) => input is "JSONSchemaMakeable";
|
|
203
|
-
};
|
|
204
|
-
JSONSchema: {
|
|
205
|
-
make: (input: "JSONSchemaMakeable") => JSONSchema7;
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
export interface PromptContext {
|
|
210
|
-
input?: NodeJS.ReadableStream;
|
|
211
|
-
output?: NodeJS.WritableStream;
|
|
212
|
-
clearPromptOnDone?: boolean;
|
|
213
|
-
signal?: AbortSignal;
|
|
214
|
-
/** The command that is being prompted for. Cast this to a `commander.Command` to access the command's name, description, options etc. */
|
|
215
|
-
command: {
|
|
216
|
-
name: () => string;
|
|
217
|
-
};
|
|
218
|
-
/** The original inputs the user provided - if they passed some but not all arguments/options, this will contain the values they did pass. */
|
|
219
|
-
inputs: {
|
|
220
|
-
argv: string[];
|
|
221
|
-
arguments: {
|
|
222
|
-
name: string;
|
|
223
|
-
specified: boolean;
|
|
224
|
-
value: unknown;
|
|
225
|
-
}[];
|
|
226
|
-
options: {
|
|
227
|
-
name: string;
|
|
228
|
-
specified: boolean;
|
|
229
|
-
value: unknown;
|
|
230
|
-
}[];
|
|
231
|
-
};
|
|
232
|
-
/** If set, this is the argument that is being prompted for. Cast to a `commander.Argument`. */
|
|
233
|
-
argument?: {
|
|
234
|
-
name: () => string;
|
|
235
|
-
};
|
|
236
|
-
/** If set, this is the option that is being prompted for. Cast to a `commander.Option`. */
|
|
237
|
-
option?: {
|
|
238
|
-
name: () => string;
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
export interface Prompter {
|
|
242
|
-
setup?: (context: PromptContext) => Promise<void>;
|
|
243
|
-
teardown?: (context: PromptContext) => Promise<void>;
|
|
244
|
-
input: (params: {
|
|
245
|
-
message: string;
|
|
246
|
-
validate?: (input: string) => boolean | string;
|
|
247
|
-
required?: boolean;
|
|
248
|
-
default?: string;
|
|
249
|
-
}, context: PromptContext) => Promise<string>;
|
|
250
|
-
select: (params: {
|
|
251
|
-
message: string;
|
|
252
|
-
choices: string[] | {
|
|
253
|
-
name: string;
|
|
254
|
-
value: string;
|
|
255
|
-
description?: string;
|
|
256
|
-
}[];
|
|
257
|
-
required?: boolean;
|
|
258
|
-
default?: string;
|
|
259
|
-
validate?: (input: string) => boolean | string;
|
|
260
|
-
}, context: PromptContext) => Promise<string>;
|
|
261
|
-
confirm: (params: {
|
|
262
|
-
message: string;
|
|
263
|
-
default?: boolean;
|
|
264
|
-
validate?: (input: string) => boolean | string;
|
|
265
|
-
}, context: PromptContext) => Promise<boolean>;
|
|
266
|
-
checkbox: (params: {
|
|
267
|
-
message: string;
|
|
268
|
-
choices: {
|
|
269
|
-
name: string;
|
|
270
|
-
value: string;
|
|
271
|
-
checked?: boolean;
|
|
272
|
-
}[];
|
|
273
|
-
required?: boolean;
|
|
274
|
-
default?: string[];
|
|
275
|
-
}, context: PromptContext) => Promise<string[]>;
|
|
276
|
-
}
|
|
File without changes
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pretty much like the `instanceof` operator, but should work across different realms. Necessary for zod because some installations
|
|
3
|
-
* might result in this library using the commonjs zod export, while the user's code uses the esm export.
|
|
4
|
-
* https://github.com/mmkal/trpc-cli/issues/7
|
|
5
|
-
*
|
|
6
|
-
* Tradeoff: It's possible that this function will return false positives if the target class has the same name as an unrelated class in the current realm.
|
|
7
|
-
* So, only use it for classes that are unlikely to have name conflicts like `ZodAbc` or `TRPCDef`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const looksLikeInstanceof: <T>(value: unknown, target: string | (new (...args: any[]) => T)) => value is T;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const looksLikeInstanceof = (value, target) => {
|
|
2
|
-
let current = value?.constructor;
|
|
3
|
-
while (current?.name) {
|
|
4
|
-
if (current?.name === (typeof target === "string" ? target : target.name))
|
|
5
|
-
return true;
|
|
6
|
-
current = Object.getPrototypeOf(current);
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const log: import("@reliverse/relinka").RelinkaFunction;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ColorName, OutputColor, StandardColor } from "../../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Maps complex colors (gradients, bright, background) to standard terminal colors.
|
|
4
|
-
* Used by ora spinners and other terminal utilities that only support basic colors.
|
|
5
|
-
*
|
|
6
|
-
* Handles:
|
|
7
|
-
* - Gradient colors -> solid colors (e.g., retroGradient -> cyan)
|
|
8
|
-
* - Bright colors -> base colors (e.g., redBright -> red)
|
|
9
|
-
* - Background colors -> foreground colors (e.g., bgRed -> red)
|
|
10
|
-
* - Special colors -> undefined (reset, inverse, dim, none)
|
|
11
|
-
*
|
|
12
|
-
* @param color The complex color to convert
|
|
13
|
-
* @returns A standard terminal color or undefined for special colors
|
|
14
|
-
*/
|
|
15
|
-
export declare function toBaseColor(color?: ColorName): StandardColor | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Maps any color type to a standard solid color for consistent display.
|
|
18
|
-
* Similar to toBaseColor but always returns a color (never undefined).
|
|
19
|
-
*
|
|
20
|
-
* Handles:
|
|
21
|
-
* - Gradient colors -> solid colors (e.g., retroGradient -> cyan)
|
|
22
|
-
* - Bright colors -> base colors (e.g., redBright -> red)
|
|
23
|
-
* - Background colors -> foreground colors (e.g., bgRed -> red)
|
|
24
|
-
* - Special colors (reset, inverse, none) -> dim
|
|
25
|
-
* - Undefined -> dim
|
|
26
|
-
*
|
|
27
|
-
* @param color The color to convert
|
|
28
|
-
* @returns A standard terminal color, defaulting to "dim" for special cases
|
|
29
|
-
*/
|
|
30
|
-
export declare function toSolidColor(color?: ColorName): OutputColor;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const GRADIENT_COLOR_MAP = {
|
|
2
|
-
retroGradient: "cyan",
|
|
3
|
-
viceGradient: "green",
|
|
4
|
-
gradientGradient: "blue",
|
|
5
|
-
rainbowGradient: "blue",
|
|
6
|
-
cristalGradient: "blue",
|
|
7
|
-
mindGradient: "blue",
|
|
8
|
-
passionGradient: "blue"
|
|
9
|
-
};
|
|
10
|
-
const SPECIAL_COLORS = ["reset", "inverse", "none"];
|
|
11
|
-
function stripBrightModifier(color) {
|
|
12
|
-
return color.replace("Bright", "");
|
|
13
|
-
}
|
|
14
|
-
function stripBgModifier(color) {
|
|
15
|
-
return color.replace("bg", "").toLowerCase();
|
|
16
|
-
}
|
|
17
|
-
function stripColorModifiers(color) {
|
|
18
|
-
if (color.includes("Bright")) {
|
|
19
|
-
return stripBrightModifier(color);
|
|
20
|
-
}
|
|
21
|
-
if (color.startsWith("bg")) {
|
|
22
|
-
return stripBgModifier(color);
|
|
23
|
-
}
|
|
24
|
-
return color;
|
|
25
|
-
}
|
|
26
|
-
export function toBaseColor(color) {
|
|
27
|
-
if (!color || color === "dim" || SPECIAL_COLORS.includes(color)) {
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
if (color in GRADIENT_COLOR_MAP) {
|
|
31
|
-
return GRADIENT_COLOR_MAP[color];
|
|
32
|
-
}
|
|
33
|
-
if (color.includes("Bright") || color.startsWith("bg")) {
|
|
34
|
-
const baseColor = stripColorModifiers(color);
|
|
35
|
-
return baseColor;
|
|
36
|
-
}
|
|
37
|
-
return color;
|
|
38
|
-
}
|
|
39
|
-
export function toSolidColor(color) {
|
|
40
|
-
const baseColor = toBaseColor(color);
|
|
41
|
-
return baseColor ?? "dim";
|
|
42
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AllKinds, StreamOptions } from "../../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Logs messages with configurable styling and formatting.
|
|
4
|
-
* Doesn't support streaming functionality.
|
|
5
|
-
*/
|
|
6
|
-
export declare function relinkaByRemptsDeprecated(kind: AllKinds, title: string, content?: string, hint?: string): void;
|
|
7
|
-
/**
|
|
8
|
-
* Asynchronous version of relinka that supports streaming functionality.
|
|
9
|
-
* Use this when you want animated text output with optional spinner.
|
|
10
|
-
*
|
|
11
|
-
* Streaming is controlled by the streamOpts parameter:
|
|
12
|
-
* - Use { useSpinner: true } for spinner animation
|
|
13
|
-
* - Use { delay: number } for character-by-character streaming
|
|
14
|
-
* - Content and hint are optional regardless of streaming
|
|
15
|
-
*/
|
|
16
|
-
export declare const relinkaAsyncByRemptsDeprecated: (kind: AllKinds, title: string, content?: string, hint?: string, streamOpts?: StreamOptions) => Promise<void>;
|
|
17
|
-
export declare const throwError: (error: unknown) => never;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { streamText, streamTextWithSpinner } from "../utils/stream-text.js";
|
|
2
|
-
import { toSolidColor } from "./colors.js";
|
|
3
|
-
import { msg } from "./messages.js";
|
|
4
|
-
const verboseLogging = false;
|
|
5
|
-
const MESSAGE_CONFIGS = {
|
|
6
|
-
log: {
|
|
7
|
-
type: "M_INFO",
|
|
8
|
-
titleColor: "retroGradient",
|
|
9
|
-
titleTypography: "bold"
|
|
10
|
-
},
|
|
11
|
-
info: {
|
|
12
|
-
type: "M_INFO",
|
|
13
|
-
titleColor: "retroGradient",
|
|
14
|
-
titleTypography: "bold"
|
|
15
|
-
},
|
|
16
|
-
success: {
|
|
17
|
-
type: "M_INFO",
|
|
18
|
-
titleColor: "viceGradient",
|
|
19
|
-
titleTypography: "bold"
|
|
20
|
-
},
|
|
21
|
-
warn: {
|
|
22
|
-
type: "M_ERROR",
|
|
23
|
-
titleColor: "yellowBright",
|
|
24
|
-
titleTypography: "bold"
|
|
25
|
-
},
|
|
26
|
-
error: {
|
|
27
|
-
type: "M_ERROR",
|
|
28
|
-
titleColor: "yellowBright",
|
|
29
|
-
titleTypography: "bold"
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
export function relinkaByRemptsDeprecated(kind, title, content, hint) {
|
|
33
|
-
const isVerbose = kind.endsWith("-verbose");
|
|
34
|
-
const baseKind = isVerbose ? kind.replace("-verbose", "") : kind;
|
|
35
|
-
if (isVerbose && !verboseLogging) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const config = MESSAGE_CONFIGS[baseKind];
|
|
39
|
-
msg({
|
|
40
|
-
...config,
|
|
41
|
-
title: isVerbose ? `[debug] ${title}` : title,
|
|
42
|
-
content: content ?? "",
|
|
43
|
-
contentColor: "dim",
|
|
44
|
-
contentTypography: "italic",
|
|
45
|
-
hint: hint ?? ""
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
export const relinkaAsyncByRemptsDeprecated = async (kind, title, content, hint, streamOpts) => {
|
|
49
|
-
const isVerbose = kind.endsWith("-verbose");
|
|
50
|
-
const baseKind = isVerbose ? kind.replace("-verbose", "") : kind;
|
|
51
|
-
if (isVerbose && !verboseLogging) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const config = MESSAGE_CONFIGS[baseKind];
|
|
55
|
-
if (!streamOpts) {
|
|
56
|
-
msg({
|
|
57
|
-
...config,
|
|
58
|
-
title: isVerbose ? `[debug] ${title}` : title,
|
|
59
|
-
content: content ?? "",
|
|
60
|
-
contentColor: "dim",
|
|
61
|
-
contentTypography: "italic",
|
|
62
|
-
hint: hint ?? ""
|
|
63
|
-
});
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const titleText = isVerbose ? `[debug] ${title}` : title;
|
|
67
|
-
if (streamOpts.useSpinner) {
|
|
68
|
-
await streamTextWithSpinner({
|
|
69
|
-
text: titleText,
|
|
70
|
-
color: toSolidColor(config.titleColor),
|
|
71
|
-
delay: streamOpts.delay,
|
|
72
|
-
spinnerFrames: streamOpts.spinnerFrames,
|
|
73
|
-
spinnerDelay: streamOpts.spinnerDelay
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
await streamText({
|
|
77
|
-
text: titleText,
|
|
78
|
-
color: toSolidColor(config.titleColor),
|
|
79
|
-
delay: streamOpts.delay
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (content) {
|
|
83
|
-
await streamText({
|
|
84
|
-
text: content,
|
|
85
|
-
color: toSolidColor(config.contentColor) ?? "dim",
|
|
86
|
-
delay: streamOpts.delay
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (hint) {
|
|
90
|
-
await streamText({
|
|
91
|
-
text: hint,
|
|
92
|
-
color: "dim",
|
|
93
|
-
delay: streamOpts.delay
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
export const throwError = (error) => {
|
|
98
|
-
msg({
|
|
99
|
-
type: "M_ERROR",
|
|
100
|
-
title: error instanceof Error ? `\u{1F914} Failed to set up the project: ${error.message}` : "\u{1F914} An unknown error occurred."
|
|
101
|
-
});
|
|
102
|
-
process.exit(1);
|
|
103
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { re } from "@reliverse/relico";
|
|
2
|
-
import gradient, { cristal, mind, passion, retro, vice } from "gradient-string";
|
|
3
|
-
import { rainbow } from "gradient-string";
|
|
4
|
-
export const colorMap = {
|
|
5
|
-
// @reliverse/relico
|
|
6
|
-
none: (text) => text,
|
|
7
|
-
reset: re.reset,
|
|
8
|
-
bgCyan: re.bgCyan,
|
|
9
|
-
bgCyanBright: re.bgCyanBright,
|
|
10
|
-
black: re.black,
|
|
11
|
-
blue: re.blue,
|
|
12
|
-
blueBright: re.blueBright,
|
|
13
|
-
cyan: re.cyan,
|
|
14
|
-
cyanBright: re.cyanBright,
|
|
15
|
-
dim: re.dim,
|
|
16
|
-
gray: re.gray,
|
|
17
|
-
green: re.green,
|
|
18
|
-
greenBright: re.greenBright,
|
|
19
|
-
inverse: (text) => re.bold(re.inverse(text)),
|
|
20
|
-
magenta: re.magenta,
|
|
21
|
-
magentaBright: re.magentaBright,
|
|
22
|
-
red: re.red,
|
|
23
|
-
redBright: re.redBright,
|
|
24
|
-
white: re.white,
|
|
25
|
-
yellow: re.yellow,
|
|
26
|
-
yellowBright: re.yellowBright,
|
|
27
|
-
// gradient-string
|
|
28
|
-
cristalGradient: cristal,
|
|
29
|
-
gradientGradient: gradient([
|
|
30
|
-
"red",
|
|
31
|
-
"yellow",
|
|
32
|
-
"green",
|
|
33
|
-
"cyan",
|
|
34
|
-
"blue",
|
|
35
|
-
"magenta"
|
|
36
|
-
]),
|
|
37
|
-
mindGradient: mind,
|
|
38
|
-
passionGradient: passion,
|
|
39
|
-
rainbowGradient: rainbow,
|
|
40
|
-
retroGradient: retro,
|
|
41
|
-
viceGradient: vice
|
|
42
|
-
};
|
|
43
|
-
export const typographyMap = {
|
|
44
|
-
none: (text) => text,
|
|
45
|
-
bold: re.bold,
|
|
46
|
-
italic: re.italic,
|
|
47
|
-
strikethrough: re.strikethrough,
|
|
48
|
-
underline: re.underline
|
|
49
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ColorName, FmtMsgOptions, Symbols } from "../../types.js";
|
|
2
|
-
export declare const symbols: Symbols;
|
|
3
|
-
/**
|
|
4
|
-
* Returns a colored vertical bar symbol. Prevents gradient colors for bars.
|
|
5
|
-
*/
|
|
6
|
-
export declare const bar: ({ borderColor, }?: {
|
|
7
|
-
borderColor?: ColorName;
|
|
8
|
-
}) => string;
|
|
9
|
-
/**
|
|
10
|
-
* Main formatter function: builds the final text output based on FmtMsgOptions.
|
|
11
|
-
*/
|
|
12
|
-
export declare function fmt(opts: FmtMsgOptions): {
|
|
13
|
-
text: string;
|
|
14
|
-
lineCount: number;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Logs a formatted message to the console and records how many lines it occupies.
|
|
18
|
-
*/
|
|
19
|
-
export declare function msg(opts: FmtMsgOptions): void;
|
|
20
|
-
/**
|
|
21
|
-
* Undo the last printed message by deleting its lines from the terminal.
|
|
22
|
-
* @param count How many messages to undo. Defaults to 1.
|
|
23
|
-
*/
|
|
24
|
-
export declare function msgUndo(count?: number): void;
|
|
25
|
-
/**
|
|
26
|
-
* Undo all printed messages so far.
|
|
27
|
-
*/
|
|
28
|
-
export declare function msgUndoAll(): void;
|
|
29
|
-
/**
|
|
30
|
-
* Prints: "│ <text>" (two spaces after the bar).
|
|
31
|
-
* If text is empty, it just prints "│".
|
|
32
|
-
* If indent is 1, it prints "│ <text>" (one space).
|
|
33
|
-
* If indent is 2, it prints "│ <text>" (two spaces), etc.
|
|
34
|
-
*/
|
|
35
|
-
export declare function printLineBar(text: string, indent?: number): void;
|