mepcli 1.0.1 → 1.2.0
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/dist/core.d.ts +964 -6
- package/dist/core.js +964 -6
- package/dist/highlight.d.ts +6 -0
- package/dist/highlight.js +133 -28
- package/dist/prompts/code.js +46 -31
- package/dist/types.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -12,104 +12,1062 @@ import { TaskGroupOptions } from './types';
|
|
|
12
12
|
export declare class MepCLI {
|
|
13
13
|
static theme: ThemeConfig;
|
|
14
14
|
/**
|
|
15
|
-
* Creates a new Spinner instance.
|
|
15
|
+
* Creates a new Spinner instance to indicate background activity.
|
|
16
|
+
* @example
|
|
17
|
+
* const spinner = MepCLI.spinner('Loading data...');
|
|
18
|
+
* spinner.start();
|
|
19
|
+
* await someAsyncOperation();
|
|
20
|
+
* spinner.stop('Done!');
|
|
21
|
+
* @param message - The initial text to display next to the spinner.
|
|
22
|
+
* @returns A Spinner instance to control the animation.
|
|
23
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/spinner.ts}
|
|
16
24
|
*/
|
|
17
25
|
static spinner(message: string): Spinner;
|
|
18
26
|
/**
|
|
19
27
|
* Creates a new TaskRunner for managing multiple concurrent tasks (spinners/progress bars).
|
|
28
|
+
* @example
|
|
29
|
+
* const tasks = MepCLI.tasks({ concurrency: 2 });
|
|
30
|
+
* tasks.add('Task 1', async () => { ... });
|
|
31
|
+
* tasks.add('Task 2', async () => { ... });
|
|
32
|
+
* await tasks.run();
|
|
33
|
+
* @param options - Configuration for concurrency and renderer style.
|
|
34
|
+
* @returns A TaskRunner instance.
|
|
35
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/task-runner.ts}
|
|
20
36
|
*/
|
|
21
37
|
static tasks(options?: TaskGroupOptions): TaskRunner;
|
|
22
38
|
/**
|
|
23
|
-
* Creates a new Pipeline instance.
|
|
39
|
+
* Creates a new Pipeline instance for sequential workflow execution.
|
|
40
|
+
* @experimental
|
|
41
|
+
* @example
|
|
42
|
+
* const context = await MepCLI.pipeline()
|
|
43
|
+
* .step('ask-name', async (ctx) => {
|
|
44
|
+
* ctx.name = await MepCLI.text({ message: 'Name?' });
|
|
45
|
+
* })
|
|
46
|
+
* .run();
|
|
47
|
+
* @returns A fluent Pipeline builder.
|
|
48
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/pipeline-demo.ts}
|
|
24
49
|
*/
|
|
25
50
|
static pipeline<Ctx extends Record<string, any> = Record<string, any>>(): Pipeline<Ctx>;
|
|
51
|
+
/**
|
|
52
|
+
* Standard text input prompt.
|
|
53
|
+
* @example
|
|
54
|
+
* const name = await MepCLI.text({
|
|
55
|
+
* message: 'What is your GitHub username?',
|
|
56
|
+
* placeholder: 'e.g., octocat',
|
|
57
|
+
* validate: (val) => val.length > 0 ? true : 'Username is required!'
|
|
58
|
+
* });
|
|
59
|
+
* @param options - Configuration options including validation and placeholder.
|
|
60
|
+
* @returns A promise resolving to the user's input string.
|
|
61
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
62
|
+
*/
|
|
26
63
|
static text(options: TextOptions): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Single selection prompt from a list of choices.
|
|
66
|
+
* @example
|
|
67
|
+
* const framework = await MepCLI.select({
|
|
68
|
+
* message: 'Pick a framework',
|
|
69
|
+
* choices: [
|
|
70
|
+
* { title: 'React', value: 'react', description: 'Meta' },
|
|
71
|
+
* { title: 'Vue', value: 'vue', description: 'Community' },
|
|
72
|
+
* ]
|
|
73
|
+
* });
|
|
74
|
+
* @param options - Choices and configuration.
|
|
75
|
+
* @returns A promise resolving to the selected value (V).
|
|
76
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
77
|
+
*/
|
|
27
78
|
static select<const V>(options: SelectOptions<V>): Promise<V>;
|
|
79
|
+
/**
|
|
80
|
+
* Multiple selection prompt with checkboxes.
|
|
81
|
+
* @example
|
|
82
|
+
* const toppings = await MepCLI.checkbox({
|
|
83
|
+
* message: 'Select toppings',
|
|
84
|
+
* choices: [
|
|
85
|
+
* { title: 'Cheese', value: 'cheese', selected: true },
|
|
86
|
+
* { title: 'Pepperoni', value: 'pepperoni' },
|
|
87
|
+
* ],
|
|
88
|
+
* min: 1
|
|
89
|
+
* });
|
|
90
|
+
* @param options - Choices, limits (min/max), and initial state.
|
|
91
|
+
* @returns A promise resolving to an array of selected values (V[]).
|
|
92
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
93
|
+
*/
|
|
28
94
|
static checkbox<const V>(options: CheckboxOptions<V>): Promise<V[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Boolean confirmation prompt (Y/n).
|
|
97
|
+
* @example
|
|
98
|
+
* const proceed = await MepCLI.confirm({
|
|
99
|
+
* message: 'Delete production database?',
|
|
100
|
+
* initial: false
|
|
101
|
+
* });
|
|
102
|
+
* @param options - Message and initial boolean state.
|
|
103
|
+
* @returns A promise resolving to true or false.
|
|
104
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
105
|
+
*/
|
|
29
106
|
static confirm(options: ConfirmOptions): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Secure password input (masked with *).
|
|
109
|
+
* @example
|
|
110
|
+
* const password = await MepCLI.password({
|
|
111
|
+
* message: 'Enter password',
|
|
112
|
+
* validate: (val) => val.length >= 8 || 'Must be 8+ chars'
|
|
113
|
+
* });
|
|
114
|
+
* @param options - Same as TextOptions but defaults to hidden input.
|
|
115
|
+
* @returns A promise resolving to the password string.
|
|
116
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
117
|
+
*/
|
|
30
118
|
static password(options: TextOptions): Promise<string>;
|
|
119
|
+
/**
|
|
120
|
+
* Secret input prompt (no visual feedback).
|
|
121
|
+
* @example
|
|
122
|
+
* const apiKey = await MepCLI.secret({
|
|
123
|
+
* message: 'Paste API Key (hidden)'
|
|
124
|
+
* });
|
|
125
|
+
* @param options - Same as TextOptions, visual output is suppressed.
|
|
126
|
+
* @returns A promise resolving to the secret string.
|
|
127
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
128
|
+
*/
|
|
31
129
|
static secret(options: TextOptions): Promise<string>;
|
|
130
|
+
/**
|
|
131
|
+
* Numeric input prompt with increments.
|
|
132
|
+
* @example
|
|
133
|
+
* const age = await MepCLI.number({
|
|
134
|
+
* message: 'How old are you?',
|
|
135
|
+
* min: 18,
|
|
136
|
+
* max: 99,
|
|
137
|
+
* initial: 25
|
|
138
|
+
* });
|
|
139
|
+
* @param options - Min, max, step, and initial value.
|
|
140
|
+
* @returns A promise resolving to the entered number.
|
|
141
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
142
|
+
*/
|
|
32
143
|
static number(options: NumberOptions): Promise<number>;
|
|
144
|
+
/**
|
|
145
|
+
* Binary toggle switch.
|
|
146
|
+
* @example
|
|
147
|
+
* const isDarkMode = await MepCLI.toggle({
|
|
148
|
+
* message: 'Enable Dark Mode?',
|
|
149
|
+
* activeText: 'On',
|
|
150
|
+
* inactiveText: 'Off',
|
|
151
|
+
* initial: true
|
|
152
|
+
* });
|
|
153
|
+
* @param options - Text labels for states and initial value.
|
|
154
|
+
* @returns A promise resolving to the boolean state.
|
|
155
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
156
|
+
*/
|
|
33
157
|
static toggle(options: ToggleOptions): Promise<boolean>;
|
|
158
|
+
/**
|
|
159
|
+
* Tag list input (comma separated or enter to add).
|
|
160
|
+
* @example
|
|
161
|
+
* const tags = await MepCLI.list({
|
|
162
|
+
* message: 'Enter keywords (comma separated)',
|
|
163
|
+
* initial: ['js', 'ts'],
|
|
164
|
+
* placeholder: 'react, vue, svelte'
|
|
165
|
+
* });
|
|
166
|
+
* @param options - Placeholder and initial list.
|
|
167
|
+
* @returns A promise resolving to an array of strings.
|
|
168
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/form-prompts.ts}
|
|
169
|
+
*/
|
|
34
170
|
static list(options: ListOptions): Promise<string[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Slider input for selecting a number within a range.
|
|
173
|
+
* @example
|
|
174
|
+
* const volume = await MepCLI.slider({
|
|
175
|
+
* message: 'Set volume',
|
|
176
|
+
* min: 0,
|
|
177
|
+
* max: 100,
|
|
178
|
+
* step: 5,
|
|
179
|
+
* initial: 50
|
|
180
|
+
* });
|
|
181
|
+
* @param options - Min/max range, step, and unit label.
|
|
182
|
+
* @returns A promise resolving to the selected number.
|
|
183
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
184
|
+
*/
|
|
35
185
|
static slider(options: SliderOptions): Promise<number>;
|
|
186
|
+
/**
|
|
187
|
+
* Dual-handle slider for selecting a numeric range.
|
|
188
|
+
* @example
|
|
189
|
+
* const priceRange = await MepCLI.range({
|
|
190
|
+
* message: 'Filter by price',
|
|
191
|
+
* min: 0,
|
|
192
|
+
* max: 1000,
|
|
193
|
+
* initial: [100, 500]
|
|
194
|
+
* });
|
|
195
|
+
* @param options - Range bounds and initial start/end values.
|
|
196
|
+
* @returns A promise resolving to a tuple `[start, end]`.
|
|
197
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
198
|
+
*/
|
|
36
199
|
static range(options: RangeOptions): Promise<[number, number]>;
|
|
200
|
+
/**
|
|
201
|
+
* Transfer list for moving items between two lists.
|
|
202
|
+
* @example
|
|
203
|
+
* const [left, right] = await MepCLI.transfer({
|
|
204
|
+
* message: 'Assign users to team',
|
|
205
|
+
* source: ['Alice', 'Bob', 'Charlie'],
|
|
206
|
+
* target: ['Dave']
|
|
207
|
+
* });
|
|
208
|
+
* @param options - Source and target lists.
|
|
209
|
+
* @returns A promise resolving to `[sourceItems, targetItems]`.
|
|
210
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
211
|
+
*/
|
|
37
212
|
static transfer<const V>(options: TransferOptions<V>): Promise<[V[], V[]]>;
|
|
213
|
+
/**
|
|
214
|
+
* Cron expression generator/validator.
|
|
215
|
+
* @example
|
|
216
|
+
* const schedule = await MepCLI.cron({
|
|
217
|
+
* message: 'Schedule backup',
|
|
218
|
+
* initial: '0 0 * * *'
|
|
219
|
+
* });
|
|
220
|
+
* @param options - Initial cron string and placeholder.
|
|
221
|
+
* @returns A promise resolving to the valid cron string.
|
|
222
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/cron-prompt.ts}
|
|
223
|
+
*/
|
|
38
224
|
static cron(options: CronOptions): Promise<string>;
|
|
225
|
+
/**
|
|
226
|
+
* Interactive date picker.
|
|
227
|
+
* @example
|
|
228
|
+
* const birthday = await MepCLI.date({
|
|
229
|
+
* message: 'When is your birthday?',
|
|
230
|
+
* min: new Date(1900, 0, 1),
|
|
231
|
+
* max: new Date()
|
|
232
|
+
* });
|
|
233
|
+
* @param options - Min/max dates and localization.
|
|
234
|
+
* @returns A promise resolving to the selected Date object.
|
|
235
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/calendar-prompt.ts}
|
|
236
|
+
*/
|
|
39
237
|
static date(options: DateOptions): Promise<Date>;
|
|
238
|
+
/**
|
|
239
|
+
* File system explorer.
|
|
240
|
+
* @example
|
|
241
|
+
* const configPath = await MepCLI.file({
|
|
242
|
+
* message: 'Select config file',
|
|
243
|
+
* basePath: './src',
|
|
244
|
+
* extensions: ['json', 'yaml'],
|
|
245
|
+
* });
|
|
246
|
+
* @param options - Root path, allowed extensions, and directory filtering.
|
|
247
|
+
* @returns A promise resolving to the absolute path of the selected file.
|
|
248
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/filesystem-prompts.ts}
|
|
249
|
+
*/
|
|
40
250
|
static file(options: FileOptions): Promise<string>;
|
|
251
|
+
/**
|
|
252
|
+
* Multi-select checkbox with search support (alias for checkbox logic).
|
|
253
|
+
* @example
|
|
254
|
+
* const features = await MepCLI.multiSelect({
|
|
255
|
+
* message: 'Select features',
|
|
256
|
+
* choices: [
|
|
257
|
+
* { title: 'TypeScript', value: 'ts' },
|
|
258
|
+
* { title: 'ESLint', value: 'lint' }
|
|
259
|
+
* ]
|
|
260
|
+
* });
|
|
261
|
+
* @param options - Same as CheckboxOptions.
|
|
262
|
+
* @returns A promise resolving to an array of selected values.
|
|
263
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
264
|
+
*/
|
|
41
265
|
static multiSelect<const V>(options: MultiSelectOptions<V>): Promise<V[]>;
|
|
266
|
+
/**
|
|
267
|
+
* Star rating input.
|
|
268
|
+
* @example
|
|
269
|
+
* const stars = await MepCLI.rating({
|
|
270
|
+
* message: 'Rate this library',
|
|
271
|
+
* min: 1,
|
|
272
|
+
* max: 5,
|
|
273
|
+
* initial: 5
|
|
274
|
+
* });
|
|
275
|
+
* @param options - Min/max stars.
|
|
276
|
+
* @returns A promise resolving to the numeric rating.
|
|
277
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
278
|
+
*/
|
|
42
279
|
static rating(options: RatingOptions): Promise<number>;
|
|
280
|
+
/**
|
|
281
|
+
* Autocomplete search with async data fetching.
|
|
282
|
+
* @example
|
|
283
|
+
* const city = await MepCLI.autocomplete({
|
|
284
|
+
* message: 'Search city',
|
|
285
|
+
* suggest: async (input) => {
|
|
286
|
+
* const results = await fetchCities(input);
|
|
287
|
+
* return results.map(c => ({ title: c.name, value: c.id }));
|
|
288
|
+
* }
|
|
289
|
+
* });
|
|
290
|
+
* @param options - `suggest` callback to filter/fetch choices.
|
|
291
|
+
* @returns A promise resolving to the selected value.
|
|
292
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
293
|
+
*/
|
|
43
294
|
static autocomplete<const V>(options: AutocompleteOptions<V>): Promise<V>;
|
|
295
|
+
/**
|
|
296
|
+
* List sorting prompt.
|
|
297
|
+
* @example
|
|
298
|
+
* const priority = await MepCLI.sort({
|
|
299
|
+
* message: 'Prioritize tasks',
|
|
300
|
+
* items: ['Fix bugs', 'Add features', 'Write docs']
|
|
301
|
+
* });
|
|
302
|
+
* @param options - Array of strings to be reordered.
|
|
303
|
+
* @returns A promise resolving to the reordered array of strings.
|
|
304
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
305
|
+
*/
|
|
44
306
|
static sort(options: SortOptions): Promise<string[]>;
|
|
307
|
+
/**
|
|
308
|
+
* Interactive data table with row selection.
|
|
309
|
+
* @example
|
|
310
|
+
* const selectedRow = await MepCLI.table({
|
|
311
|
+
* message: 'Pick a user',
|
|
312
|
+
* columns: ['Name', 'Role'],
|
|
313
|
+
* data: [
|
|
314
|
+
* { value: 1, row: ['Alice', 'Admin'] },
|
|
315
|
+
* { value: 2, row: ['Bob', 'User'] }
|
|
316
|
+
* ]
|
|
317
|
+
* });
|
|
318
|
+
* @param options - Columns definition and row data.
|
|
319
|
+
* @returns A promise resolving to the `value` of the selected row.
|
|
320
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/data-visualization.ts}
|
|
321
|
+
*/
|
|
45
322
|
static table<const V>(options: TableOptions<V>): Promise<V>;
|
|
323
|
+
/**
|
|
324
|
+
* Open external editor (vim/nano/code) for long input.
|
|
325
|
+
* @example
|
|
326
|
+
* const bio = await MepCLI.editor({
|
|
327
|
+
* message: 'Write your biography',
|
|
328
|
+
* extension: 'md'
|
|
329
|
+
* });
|
|
330
|
+
* @param options - File extension for syntax highlighting.
|
|
331
|
+
* @returns A promise resolving to the saved content.
|
|
332
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/form-prompts.ts}
|
|
333
|
+
*/
|
|
46
334
|
static editor(options: EditorOptions): Promise<string>;
|
|
335
|
+
/**
|
|
336
|
+
* Hierarchical tree selection.
|
|
337
|
+
* @example
|
|
338
|
+
* const node = await MepCLI.tree({
|
|
339
|
+
* message: 'Select component',
|
|
340
|
+
* data: [
|
|
341
|
+
* { title: 'src', value: 'src', children: [
|
|
342
|
+
* { title: 'index.ts', value: 'src/index.ts' }
|
|
343
|
+
* ]}
|
|
344
|
+
* ]
|
|
345
|
+
* });
|
|
346
|
+
* @param options - Tree structure data.
|
|
347
|
+
* @returns A promise resolving to the selected node's value.
|
|
348
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/tree-prompt.ts}
|
|
349
|
+
*/
|
|
47
350
|
static tree<const V>(options: TreeOptions<V>): Promise<V>;
|
|
351
|
+
/**
|
|
352
|
+
* Detect single keypress event.
|
|
353
|
+
* @example
|
|
354
|
+
* const key = await MepCLI.keypress({
|
|
355
|
+
* message: 'Press any key to continue...'
|
|
356
|
+
* });
|
|
357
|
+
* @param options - Optional allowed keys filter.
|
|
358
|
+
* @returns A promise resolving to the pressed key name.
|
|
359
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
360
|
+
*/
|
|
48
361
|
static keypress(options: KeypressOptions): Promise<string>;
|
|
362
|
+
/**
|
|
363
|
+
* Multi-field form input.
|
|
364
|
+
* @example
|
|
365
|
+
* const user = await MepCLI.form({
|
|
366
|
+
* message: 'User Registration',
|
|
367
|
+
* fields: [
|
|
368
|
+
* { name: 'first', message: 'First Name' },
|
|
369
|
+
* { name: 'last', message: 'Last Name' },
|
|
370
|
+
* { name: 'email', message: 'Email', validate: (v) => v.includes('@') }
|
|
371
|
+
* ]
|
|
372
|
+
* });
|
|
373
|
+
* @param options - Array of field definitions.
|
|
374
|
+
* @returns A promise resolving to an object with field names as keys.
|
|
375
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/form-prompts.ts}
|
|
376
|
+
*/
|
|
49
377
|
static form(options: FormOptions): Promise<Record<string, string>>;
|
|
378
|
+
/**
|
|
379
|
+
* Templated snippet generator.
|
|
380
|
+
* @example
|
|
381
|
+
* const component = await MepCLI.snippet({
|
|
382
|
+
* message: 'Create Component',
|
|
383
|
+
* template: `export function {{name}}() {
|
|
384
|
+
* return <div>{{content}}</div>;
|
|
385
|
+
* }`,
|
|
386
|
+
* fields: {
|
|
387
|
+
* name: { message: 'Component Name' },
|
|
388
|
+
* content: { message: 'Content' }
|
|
389
|
+
* }
|
|
390
|
+
* });
|
|
391
|
+
* @param options - Template string with {{variables}} and field config.
|
|
392
|
+
* @returns A promise resolving to the compiled string.
|
|
393
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/snippet-prompt.ts}
|
|
394
|
+
*/
|
|
50
395
|
static snippet(options: SnippetOptions): Promise<string>;
|
|
396
|
+
/**
|
|
397
|
+
* Anti-spam / Bot detection prompt.
|
|
398
|
+
* @example
|
|
399
|
+
* const isHuman = await MepCLI.spam({
|
|
400
|
+
* message: 'Press Space 5 times quickly!',
|
|
401
|
+
* threshold: 5,
|
|
402
|
+
* spamKey: ' '
|
|
403
|
+
* });
|
|
404
|
+
* @param options - Threshold frequency and key to mash.
|
|
405
|
+
* @returns A promise resolving to true (pass) or false (fail).
|
|
406
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/spam-prompt.ts}
|
|
407
|
+
*/
|
|
51
408
|
static spam(options: SpamOptions): Promise<boolean>;
|
|
409
|
+
/**
|
|
410
|
+
* Pause execution for a set time (with progress).
|
|
411
|
+
* @example
|
|
412
|
+
* await MepCLI.wait({
|
|
413
|
+
* message: 'Processing...',
|
|
414
|
+
* seconds: 3
|
|
415
|
+
* });
|
|
416
|
+
* @param options - Duration in seconds.
|
|
417
|
+
* @returns A promise resolving after the delay.
|
|
418
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/wait-prompt.ts}
|
|
419
|
+
*/
|
|
52
420
|
static wait(options: WaitOptions): Promise<void>;
|
|
421
|
+
/**
|
|
422
|
+
* Source code editor with syntax highlighting.
|
|
423
|
+
* @example
|
|
424
|
+
* const json = await MepCLI.code({
|
|
425
|
+
* message: 'Edit Configuration',
|
|
426
|
+
* language: 'json',
|
|
427
|
+
* template: '{\n "name": "project"\n}'
|
|
428
|
+
* });
|
|
429
|
+
* @param options - Language, initial template, and syntax highlighting.
|
|
430
|
+
* @returns A promise resolving to the edited code string.
|
|
431
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/code-prompt.ts}
|
|
432
|
+
*/
|
|
53
433
|
static code(options: CodeOptions): Promise<string>;
|
|
54
434
|
/**
|
|
55
|
-
* Tree Select Prompt (Multi-selection)
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
435
|
+
* Tree Select Prompt (Multi-selection).
|
|
436
|
+
* @example
|
|
437
|
+
* const selectedPaths = await MepCLI.treeSelect({
|
|
438
|
+
* message: 'Select files to include',
|
|
439
|
+
* data: [
|
|
440
|
+
* { title: 'src', value: 'src', children: [
|
|
441
|
+
* { title: 'core.ts', value: 'src/core.ts' }
|
|
442
|
+
* ]}
|
|
443
|
+
* ]
|
|
444
|
+
* });
|
|
445
|
+
* @param options - Tree structure and initial selections.
|
|
446
|
+
* @returns A promise that resolves to an array of selected values.
|
|
447
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
448
|
+
*
|
|
449
|
+
* @notice Windows Compatibility:
|
|
59
450
|
* When used in a long sequence of prompts, this component may experience
|
|
60
451
|
* an input delay. If it feels "blocked", simply press 'Enter' once
|
|
61
452
|
* to refresh the TTY stream.
|
|
62
453
|
*/
|
|
63
454
|
static treeSelect<const V>(options: TreeSelectOptions<V>): Promise<V[]>;
|
|
455
|
+
/**
|
|
456
|
+
* Color picker (Hex, RGB, HSL).
|
|
457
|
+
* @example
|
|
458
|
+
* const color = await MepCLI.color({
|
|
459
|
+
* message: 'Pick a theme color',
|
|
460
|
+
* format: 'hex',
|
|
461
|
+
* initial: '#3B82F6'
|
|
462
|
+
* });
|
|
463
|
+
* @param options - Format preference and initial value.
|
|
464
|
+
* @returns A promise resolving to the color string.
|
|
465
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/color-prompt.ts}
|
|
466
|
+
*/
|
|
64
467
|
static color(options: ColorOptions): Promise<string>;
|
|
468
|
+
/**
|
|
469
|
+
* 2D Grid Checkbox (Boolean Matrix).
|
|
470
|
+
* @example
|
|
471
|
+
* const availability = await MepCLI.grid({
|
|
472
|
+
* message: 'Select availability',
|
|
473
|
+
* rows: ['Mon', 'Tue'],
|
|
474
|
+
* columns: ['AM', 'PM']
|
|
475
|
+
* });
|
|
476
|
+
* @param options - Row/Column labels.
|
|
477
|
+
* @returns A promise resolving to a 2D boolean array.
|
|
478
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/grid-prompt.ts}
|
|
479
|
+
*/
|
|
65
480
|
static grid(options: GridOptions): Promise<boolean[][]>;
|
|
481
|
+
/**
|
|
482
|
+
* Calendar picker for dates or ranges.
|
|
483
|
+
* @example
|
|
484
|
+
* const range = await MepCLI.calendar({
|
|
485
|
+
* message: 'Select vacation dates',
|
|
486
|
+
* mode: 'range'
|
|
487
|
+
* });
|
|
488
|
+
* @param options - Selection mode (single/range) and bounds.
|
|
489
|
+
* @returns A promise resolving to a Date or [Date, Date].
|
|
490
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/calendar-prompt.ts}
|
|
491
|
+
*/
|
|
66
492
|
static calendar(options: CalendarOptions): Promise<Date | [Date, Date]>;
|
|
493
|
+
/**
|
|
494
|
+
* Key-Value Map editor.
|
|
495
|
+
* @example
|
|
496
|
+
* const envVars = await MepCLI.map({
|
|
497
|
+
* message: 'Environment Variables',
|
|
498
|
+
* initial: { NODE_ENV: 'development', PORT: '3000' }
|
|
499
|
+
* });
|
|
500
|
+
* @param options - Initial key-value pairs.
|
|
501
|
+
* @returns A promise resolving to a record of strings.
|
|
502
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/map-prompt.ts}
|
|
503
|
+
*/
|
|
67
504
|
static map(options: MapOptions): Promise<Record<string, string>>;
|
|
505
|
+
/**
|
|
506
|
+
* Semantic Versioning incrementer.
|
|
507
|
+
* @example
|
|
508
|
+
* const nextVersion = await MepCLI.semver({
|
|
509
|
+
* message: 'Bump version',
|
|
510
|
+
* currentVersion: '1.0.0'
|
|
511
|
+
* });
|
|
512
|
+
* @param options - The current version string.
|
|
513
|
+
* @returns A promise resolving to the new version string.
|
|
514
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/semver-prompt.ts}
|
|
515
|
+
*/
|
|
68
516
|
static semver(options: SemVerOptions): Promise<string>;
|
|
517
|
+
/**
|
|
518
|
+
* IP Address input validator.
|
|
519
|
+
* @example
|
|
520
|
+
* const ip = await MepCLI.ip({
|
|
521
|
+
* message: 'Enter Server IP',
|
|
522
|
+
* initial: '127.0.0.1'
|
|
523
|
+
* });
|
|
524
|
+
* @param options - Initial value.
|
|
525
|
+
* @returns A promise resolving to the valid IP string.
|
|
526
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/ip-prompt.ts}
|
|
527
|
+
*/
|
|
69
528
|
static ip(options: IPOptions): Promise<string>;
|
|
529
|
+
/**
|
|
530
|
+
* One-Time Password / Pin Code input.
|
|
531
|
+
* @example
|
|
532
|
+
* const otp = await MepCLI.otp({
|
|
533
|
+
* message: 'Enter 2FA Code',
|
|
534
|
+
* length: 6
|
|
535
|
+
* });
|
|
536
|
+
* @param options - Length and masking options.
|
|
537
|
+
* @returns A promise resolving to the entered code.
|
|
538
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/otp-prompt.ts}
|
|
539
|
+
*/
|
|
70
540
|
static otp(options: OTPOptions): Promise<string>;
|
|
541
|
+
/**
|
|
542
|
+
* Multiple choice quiz.
|
|
543
|
+
* @example
|
|
544
|
+
* const answer = await MepCLI.quizSelect({
|
|
545
|
+
* message: 'What is 2 + 2?',
|
|
546
|
+
* choices: [
|
|
547
|
+
* { title: '3', value: 3 },
|
|
548
|
+
* { title: '4', value: 4 }
|
|
549
|
+
* ],
|
|
550
|
+
* correctValue: 4
|
|
551
|
+
* });
|
|
552
|
+
* @param options - Choices and correct answer logic.
|
|
553
|
+
* @returns A promise resolving to the selected value.
|
|
554
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/quiz-select-prompt.ts}
|
|
555
|
+
*/
|
|
71
556
|
static quizSelect<const V>(options: QuizSelectOptions<V>): Promise<V>;
|
|
557
|
+
/**
|
|
558
|
+
* Text-based quiz with verification.
|
|
559
|
+
* @example
|
|
560
|
+
* const answer = await MepCLI.quizText({
|
|
561
|
+
* message: 'Who is the author of Harry Potter?',
|
|
562
|
+
* correctAnswer: 'J.K. Rowling',
|
|
563
|
+
* verify: (val) => val.includes('Rowling')
|
|
564
|
+
* });
|
|
565
|
+
* @param options - Correct answer string or validation function.
|
|
566
|
+
* @returns A promise resolving to the input string.
|
|
567
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/quiz-text-prompt.ts}
|
|
568
|
+
*/
|
|
72
569
|
static quizText(options: QuizTextOptions): Promise<string>;
|
|
570
|
+
/**
|
|
571
|
+
* Kanban board for organizing items.
|
|
572
|
+
* @example
|
|
573
|
+
* const board = await MepCLI.kanban({
|
|
574
|
+
* message: 'Project Status',
|
|
575
|
+
* columns: [
|
|
576
|
+
* { id: 'todo', title: 'To Do', items: [{ id: '1', title: 'Task A' }] },
|
|
577
|
+
* { id: 'done', title: 'Done', items: [] }
|
|
578
|
+
* ]
|
|
579
|
+
* });
|
|
580
|
+
* @param options - Columns and their items.
|
|
581
|
+
* @returns A promise resolving to the final column state.
|
|
582
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/kanban-prompt.ts}
|
|
583
|
+
*/
|
|
73
584
|
static kanban<V extends KanbanItem>(options: KanbanOptions<V>): Promise<Record<string, V[]>>;
|
|
585
|
+
/**
|
|
586
|
+
* Time picker (HH:MM AM/PM).
|
|
587
|
+
* @example
|
|
588
|
+
* const time = await MepCLI.time({
|
|
589
|
+
* message: 'Wake up time',
|
|
590
|
+
* initial: '08:00 AM'
|
|
591
|
+
* });
|
|
592
|
+
* @param options - 12h/24h format and step intervals.
|
|
593
|
+
* @returns A promise resolving to the time string.
|
|
594
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/time-prompt.ts}
|
|
595
|
+
*/
|
|
74
596
|
static time(options: TimeOptions): Promise<string>;
|
|
597
|
+
/**
|
|
598
|
+
* Heatmap/Weekly schedule selector.
|
|
599
|
+
* @example
|
|
600
|
+
* const schedule = await MepCLI.heatmap({
|
|
601
|
+
* message: 'When are you free?',
|
|
602
|
+
* rows: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
|
|
603
|
+
* columns: ['Morning', 'Afternoon', 'Evening'],
|
|
604
|
+
* legend: [
|
|
605
|
+
* { value: 0, char: ' ', color: (t) => t },
|
|
606
|
+
* { value: 1, char: '■', color: (t) => t }
|
|
607
|
+
* ]
|
|
608
|
+
* });
|
|
609
|
+
* @param options - Grid labels and color scale legend.
|
|
610
|
+
* @returns A promise resolving to a 2D array of values.
|
|
611
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/heatmap-prompt.ts}
|
|
612
|
+
*/
|
|
75
613
|
static heatmap(options: HeatmapOptions): Promise<number[][]>;
|
|
614
|
+
/**
|
|
615
|
+
* Byte size input (KB, MB, GB).
|
|
616
|
+
* @example
|
|
617
|
+
* const memory = await MepCLI.byte({
|
|
618
|
+
* message: 'Allocate memory',
|
|
619
|
+
* initial: 1024 * 1024 // 1MB
|
|
620
|
+
* });
|
|
621
|
+
* @param options - Min/Max bytes.
|
|
622
|
+
* @returns A promise resolving to the number of bytes.
|
|
623
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/byte-prompt.ts}
|
|
624
|
+
*/
|
|
76
625
|
static byte(options: ByteOptions): Promise<number>;
|
|
626
|
+
/**
|
|
627
|
+
* Slot machine style spinner.
|
|
628
|
+
* @example
|
|
629
|
+
* const fruit = await MepCLI.slot({
|
|
630
|
+
* message: 'Spin to win!',
|
|
631
|
+
* choices: ['🍒', '🍋', '🍇', '🍉'],
|
|
632
|
+
* rows: 3
|
|
633
|
+
* });
|
|
634
|
+
* @param options - Items to cycle through.
|
|
635
|
+
* @returns A promise resolving to the selected item string.
|
|
636
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/slot-prompt.ts}
|
|
637
|
+
*/
|
|
77
638
|
static slot(options: SlotOptions): Promise<string>;
|
|
639
|
+
/**
|
|
640
|
+
* Rhythm game style gauge input.
|
|
641
|
+
* @example
|
|
642
|
+
* const result = await MepCLI.gauge({
|
|
643
|
+
* message: 'Hit the target!',
|
|
644
|
+
* safeZone: 0.2 // 20%
|
|
645
|
+
* });
|
|
646
|
+
* @param options - Width and difficulty (safeZone).
|
|
647
|
+
* @returns A promise resolving to 'success' or 'fail'.
|
|
648
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/gauge-prompt.ts}
|
|
649
|
+
*/
|
|
78
650
|
static gauge(options: GaugeOptions): Promise<string>;
|
|
651
|
+
/**
|
|
652
|
+
* Interactive calculator.
|
|
653
|
+
* @example
|
|
654
|
+
* const result = await MepCLI.calculator({
|
|
655
|
+
* message: 'Calculate total',
|
|
656
|
+
* initial: '10 + 5'
|
|
657
|
+
* });
|
|
658
|
+
* @param options - Initial expression.
|
|
659
|
+
* @returns A promise resolving to the numeric result.
|
|
660
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
661
|
+
*/
|
|
79
662
|
static calculator(options: CalculatorOptions): Promise<number>;
|
|
663
|
+
/**
|
|
664
|
+
* Emoji picker.
|
|
665
|
+
* @example
|
|
666
|
+
* const mood = await MepCLI.emoji({
|
|
667
|
+
* message: 'How are you feeling?',
|
|
668
|
+
* emojis: [
|
|
669
|
+
* { name: 'Happy', char: '😀' },
|
|
670
|
+
* { name: 'Sad', char: '😢' }
|
|
671
|
+
* ]
|
|
672
|
+
* });
|
|
673
|
+
* @param options - List of emojis and recent history.
|
|
674
|
+
* @returns A promise resolving to the selected emoji name/char.
|
|
675
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
676
|
+
*/
|
|
80
677
|
static emoji(options: EmojiOptions): Promise<string>;
|
|
678
|
+
/**
|
|
679
|
+
* Match/Connect items from two lists.
|
|
680
|
+
* @example
|
|
681
|
+
* const pairs = await MepCLI.match({
|
|
682
|
+
* message: 'Match Capital to Country',
|
|
683
|
+
* source: ['Paris', 'London'],
|
|
684
|
+
* target: ['France', 'UK']
|
|
685
|
+
* });
|
|
686
|
+
* @param options - Source and Target lists.
|
|
687
|
+
* @returns A promise resolving to linked pairs.
|
|
688
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
689
|
+
*/
|
|
81
690
|
static match(options: MatchOptions): Promise<Record<string, any[]>>;
|
|
691
|
+
/**
|
|
692
|
+
* Git-style diff viewer.
|
|
693
|
+
* @example
|
|
694
|
+
* await MepCLI.diff({
|
|
695
|
+
* message: 'Review changes',
|
|
696
|
+
* original: 'foo\nbar',
|
|
697
|
+
* modified: 'foo\nbaz'
|
|
698
|
+
* });
|
|
699
|
+
* @param options - Original and Modified strings.
|
|
700
|
+
* @returns A promise resolving to a confirmation string.
|
|
701
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
702
|
+
*/
|
|
82
703
|
static diff(options: DiffOptions): Promise<string>;
|
|
704
|
+
/**
|
|
705
|
+
* Rotary dial input.
|
|
706
|
+
* @example
|
|
707
|
+
* const volume = await MepCLI.dial({
|
|
708
|
+
* message: 'Adjust Volume',
|
|
709
|
+
* min: 0,
|
|
710
|
+
* max: 100
|
|
711
|
+
* });
|
|
712
|
+
* @param options - Range and radius.
|
|
713
|
+
* @returns A promise resolving to the number.
|
|
714
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
715
|
+
*/
|
|
83
716
|
static dial(options: DialOptions): Promise<number>;
|
|
717
|
+
/**
|
|
718
|
+
* Canvas drawing input.
|
|
719
|
+
* @example
|
|
720
|
+
* const art = await MepCLI.draw({
|
|
721
|
+
* message: 'Draw your signature',
|
|
722
|
+
* width: 20,
|
|
723
|
+
* height: 10
|
|
724
|
+
* });
|
|
725
|
+
* @param options - Canvas dimensions and export type.
|
|
726
|
+
* @returns A promise resolving to the raw matrix or text.
|
|
727
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
728
|
+
*/
|
|
84
729
|
static draw(options: DrawOptions): Promise<string | boolean[][]>;
|
|
730
|
+
/**
|
|
731
|
+
* Multi-column selection (Grid layout).
|
|
732
|
+
* @example
|
|
733
|
+
* const choice = await MepCLI.multiColumnSelect({
|
|
734
|
+
* message: 'Pick an option',
|
|
735
|
+
* choices: [
|
|
736
|
+
* { title: 'Option 1', value: 1 },
|
|
737
|
+
* { title: 'Option 2', value: 2 },
|
|
738
|
+
* { title: 'Option 3', value: 3 }
|
|
739
|
+
* ],
|
|
740
|
+
* cols: 3
|
|
741
|
+
* });
|
|
742
|
+
* @param options - Choices and column count.
|
|
743
|
+
* @returns A promise resolving to the selected value.
|
|
744
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
745
|
+
*/
|
|
85
746
|
static multiColumnSelect<V>(options: MultiColumnSelectOptions<V>): Promise<V>;
|
|
747
|
+
/**
|
|
748
|
+
* Fuzzy search selection.
|
|
749
|
+
* @example
|
|
750
|
+
* const pkg = await MepCLI.fuzzySelect({
|
|
751
|
+
* message: 'Search package',
|
|
752
|
+
* choices: [
|
|
753
|
+
* { title: 'react', value: 'react' },
|
|
754
|
+
* { title: 'react-dom', value: 'react-dom' }
|
|
755
|
+
* ]
|
|
756
|
+
* });
|
|
757
|
+
* @param options - Choices to fuzzy search against.
|
|
758
|
+
* @returns A promise resolving to the selected value.
|
|
759
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
760
|
+
*/
|
|
86
761
|
static fuzzySelect<V>(options: FuzzySelectOptions<V>): Promise<V>;
|
|
762
|
+
/**
|
|
763
|
+
* Miller Columns (Cascading lists).
|
|
764
|
+
* @example
|
|
765
|
+
* const path = await MepCLI.miller({
|
|
766
|
+
* message: 'Navigate file structure',
|
|
767
|
+
* data: [
|
|
768
|
+
* { title: 'src', value: 'src', children: [...] }
|
|
769
|
+
* ]
|
|
770
|
+
* });
|
|
771
|
+
* @param options - Hierarchical data and separator.
|
|
772
|
+
* @returns A promise resolving to the selected path array.
|
|
773
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
774
|
+
*/
|
|
87
775
|
static miller<V>(options: MillerOptions<V>): Promise<V[]>;
|
|
776
|
+
/**
|
|
777
|
+
* Pattern Lock (Android style).
|
|
778
|
+
* @example
|
|
779
|
+
* const pattern = await MepCLI.pattern({
|
|
780
|
+
* message: 'Draw unlock pattern',
|
|
781
|
+
* rows: 3,
|
|
782
|
+
* cols: 3
|
|
783
|
+
* });
|
|
784
|
+
* @param options - Grid dimensions.
|
|
785
|
+
* @returns A promise resolving to an array of point indices.
|
|
786
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
787
|
+
*/
|
|
88
788
|
static pattern(options: PatternOptions): Promise<number[]>;
|
|
789
|
+
/**
|
|
790
|
+
* Region/Map Selector (ASCII Art).
|
|
791
|
+
* @example
|
|
792
|
+
* const zone = await MepCLI.region({
|
|
793
|
+
* message: 'Select Server Region',
|
|
794
|
+
* mapArt: `...ascii map...`,
|
|
795
|
+
* regions: [
|
|
796
|
+
* { id: 'us-east', label: 'US East', x: 10, y: 5 }
|
|
797
|
+
* ]
|
|
798
|
+
* });
|
|
799
|
+
* @param options - ASCII map string and interactive points.
|
|
800
|
+
* @returns A promise resolving to the selected region ID.
|
|
801
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/map-prompt.ts}
|
|
802
|
+
*/
|
|
89
803
|
static region(options: RegionOptions): Promise<string>;
|
|
804
|
+
/**
|
|
805
|
+
* Spreadsheet/Grid Editor.
|
|
806
|
+
* @example
|
|
807
|
+
* const data = await MepCLI.spreadsheet({
|
|
808
|
+
* message: 'Edit CSV Data',
|
|
809
|
+
* columns: [{ name: 'Name', key: 'name' }, { name: 'Age', key: 'age' }],
|
|
810
|
+
* data: [{ name: 'Alice', age: 25 }]
|
|
811
|
+
* });
|
|
812
|
+
* @param options - Column definitions and initial data rows.
|
|
813
|
+
* @returns A promise resolving to the modified data array.
|
|
814
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
815
|
+
*/
|
|
90
816
|
static spreadsheet(options: SpreadsheetOptions): Promise<Record<string, any>[]>;
|
|
817
|
+
/**
|
|
818
|
+
* Text Scroller (EULA/Terms).
|
|
819
|
+
* @example
|
|
820
|
+
* const accepted = await MepCLI.scroll({
|
|
821
|
+
* message: 'Read Terms & Conditions',
|
|
822
|
+
* content: 'Long text here...',
|
|
823
|
+
* requireScrollToBottom: true
|
|
824
|
+
* });
|
|
825
|
+
* @param options - Text content and scroll enforcement.
|
|
826
|
+
* @returns A promise resolving to a boolean (accepted).
|
|
827
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
828
|
+
*/
|
|
91
829
|
static scroll(options: ScrollOptions): Promise<boolean>;
|
|
830
|
+
/**
|
|
831
|
+
* Breadcrumb navigation.
|
|
832
|
+
* @example
|
|
833
|
+
* const path = await MepCLI.breadcrumb({
|
|
834
|
+
* message: 'Navigate',
|
|
835
|
+
* root: 'Home'
|
|
836
|
+
* });
|
|
837
|
+
* @param options - Initial path and separator.
|
|
838
|
+
* @returns A promise resolving to the final path string.
|
|
839
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/breadcrumb-search-prompt.ts}
|
|
840
|
+
*/
|
|
92
841
|
static breadcrumb(options: BreadcrumbOptions): Promise<string>;
|
|
842
|
+
/**
|
|
843
|
+
* Schedule Planner (Gantt-like).
|
|
844
|
+
* @example
|
|
845
|
+
* const tasks = await MepCLI.schedule({
|
|
846
|
+
* message: 'Plan your day',
|
|
847
|
+
* data: [
|
|
848
|
+
* { name: 'Meeting', start: new Date(), end: new Date() }
|
|
849
|
+
* ]
|
|
850
|
+
* });
|
|
851
|
+
* @param options - List of scheduled tasks.
|
|
852
|
+
* @returns A promise resolving to the modified task list.
|
|
853
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/schedule-prompt.ts}
|
|
854
|
+
*/
|
|
93
855
|
static schedule(options: ScheduleOptions): Promise<ScheduleTask[]>;
|
|
856
|
+
/**
|
|
857
|
+
* JSON Data Inspector.
|
|
858
|
+
* @example
|
|
859
|
+
* await MepCLI.inspector({
|
|
860
|
+
* message: 'Inspect Response',
|
|
861
|
+
* data: { user: { id: 1, name: 'Alice' } }
|
|
862
|
+
* });
|
|
863
|
+
* @param options - Data object to explore.
|
|
864
|
+
* @returns A promise resolving to the viewed data.
|
|
865
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
866
|
+
*/
|
|
94
867
|
static inspector(options: DataInspectorOptions): Promise<any>;
|
|
868
|
+
/**
|
|
869
|
+
* Execute shell command with output streaming.
|
|
870
|
+
* @experimental
|
|
871
|
+
* @example
|
|
872
|
+
* await MepCLI.exec({
|
|
873
|
+
* message: 'Running build...',
|
|
874
|
+
* command: 'npm run build'
|
|
875
|
+
* });
|
|
876
|
+
* @param options - Command string and streaming preferences.
|
|
877
|
+
* @returns A promise resolving when execution completes.
|
|
878
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
879
|
+
*/
|
|
95
880
|
static exec(options: ExecOptions): Promise<void>;
|
|
881
|
+
/**
|
|
882
|
+
* Keyboard Shortcut recorder.
|
|
883
|
+
* @example
|
|
884
|
+
* const shortcut = await MepCLI.shortcut({
|
|
885
|
+
* message: 'Press a key combination'
|
|
886
|
+
* });
|
|
887
|
+
* // Returns: { name: 'c', ctrl: true, shift: false, ... }
|
|
888
|
+
* @param options - Initial value.
|
|
889
|
+
* @returns A promise resolving to the captured key event.
|
|
890
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
891
|
+
*/
|
|
96
892
|
static shortcut(options: ShortcutOptions): Promise<ShortcutResult>;
|
|
893
|
+
/**
|
|
894
|
+
* Seat Booking/Reservation selector.
|
|
895
|
+
* @example
|
|
896
|
+
* const seats = await MepCLI.seat({
|
|
897
|
+
* message: 'Choose seats',
|
|
898
|
+
* layout: [
|
|
899
|
+
* 'aa_aa',
|
|
900
|
+
* 'bb_bb'
|
|
901
|
+
* ],
|
|
902
|
+
* rows: ['A', 'B'],
|
|
903
|
+
* cols: ['1', '2', '', '3', '4']
|
|
904
|
+
* });
|
|
905
|
+
* @param options - Layout string array and labelling.
|
|
906
|
+
* @returns A promise resolving to selected seat IDs.
|
|
907
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
908
|
+
*/
|
|
97
909
|
static seat(options: SeatOptions): Promise<string[]>;
|
|
910
|
+
/**
|
|
911
|
+
* Range selection within a list (Shift+Click style).
|
|
912
|
+
* @example
|
|
913
|
+
* const chunk = await MepCLI.selectRange({
|
|
914
|
+
* message: 'Select commits to squash',
|
|
915
|
+
* choices: [
|
|
916
|
+
* { title: 'feat: A', value: 'a' },
|
|
917
|
+
* { title: 'fix: B', value: 'b' },
|
|
918
|
+
* { title: 'chore: C', value: 'c' }
|
|
919
|
+
* ]
|
|
920
|
+
* });
|
|
921
|
+
* @param options - Choices list.
|
|
922
|
+
* @returns A promise resolving to the sub-array of values.
|
|
923
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
924
|
+
*/
|
|
98
925
|
static selectRange<const V>(options: SelectRangeOptions<V>): Promise<V[]>;
|
|
926
|
+
/**
|
|
927
|
+
* 2D Grid Sorting.
|
|
928
|
+
* @example
|
|
929
|
+
* const layout = await MepCLI.sortGrid({
|
|
930
|
+
* message: 'Arrange Dashboard Widgets',
|
|
931
|
+
* data: [
|
|
932
|
+
* ['Clock', 'Weather'],
|
|
933
|
+
* ['News', 'Calendar']
|
|
934
|
+
* ]
|
|
935
|
+
* });
|
|
936
|
+
* @param options - 2D array of strings.
|
|
937
|
+
* @returns A promise resolving to the reordered 2D array.
|
|
938
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
939
|
+
*/
|
|
99
940
|
static sortGrid(options: SortGridOptions): Promise<string[][]>;
|
|
941
|
+
/**
|
|
942
|
+
* Dependency Management (Resolves conflicts/requirements).
|
|
943
|
+
* @example
|
|
944
|
+
* const plugins = await MepCLI.dependency({
|
|
945
|
+
* message: 'Install Plugins',
|
|
946
|
+
* choices: [
|
|
947
|
+
* { title: 'Plugin A', value: 'a' },
|
|
948
|
+
* { title: 'Plugin B (Requires A)', value: 'b', dependsOn: ['a'] }
|
|
949
|
+
* ]
|
|
950
|
+
* });
|
|
951
|
+
* @param options - Choices with dependency rules.
|
|
952
|
+
* @returns A promise resolving to the valid set of selections.
|
|
953
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/dependency-prompts.ts}
|
|
954
|
+
*/
|
|
100
955
|
static dependency<V>(options: DependencyOptions<V>): Promise<V[]>;
|
|
956
|
+
/**
|
|
957
|
+
* Open Source License selector.
|
|
958
|
+
* @example
|
|
959
|
+
* const license = await MepCLI.license({
|
|
960
|
+
* message: 'Choose a license'
|
|
961
|
+
* });
|
|
962
|
+
* @param options - Default license.
|
|
963
|
+
* @returns A promise resolving to the SPDX ID.
|
|
964
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/license-prompts.ts}
|
|
965
|
+
*/
|
|
101
966
|
static license(options: LicenseOptions): Promise<string>;
|
|
967
|
+
/**
|
|
968
|
+
* Regex Builder & Tester.
|
|
969
|
+
* @example
|
|
970
|
+
* const regex = await MepCLI.regex({
|
|
971
|
+
* message: 'Create email regex',
|
|
972
|
+
* tests: ['test@example.com', 'invalid-email']
|
|
973
|
+
* });
|
|
974
|
+
* @param options - Test cases to validate against.
|
|
975
|
+
* @returns A promise resolving to the RegExp object.
|
|
976
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/regex-prompt.ts}
|
|
977
|
+
*/
|
|
102
978
|
static regex(options: RegexOptions): Promise<RegExp>;
|
|
979
|
+
/**
|
|
980
|
+
* Box Model Editor (CSS style).
|
|
981
|
+
* @example
|
|
982
|
+
* const margin = await MepCLI.box({
|
|
983
|
+
* message: 'Set Margins',
|
|
984
|
+
* initial: { top: 10, right: 20, bottom: 10, left: 20 }
|
|
985
|
+
* });
|
|
986
|
+
* @param options - Initial dimensions.
|
|
987
|
+
* @returns A promise resolving to the box object.
|
|
988
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/box-prompt.ts}
|
|
989
|
+
*/
|
|
103
990
|
static box(options: BoxOptions): Promise<{
|
|
104
991
|
top: number;
|
|
105
992
|
right: number;
|
|
106
993
|
bottom: number;
|
|
107
994
|
left: number;
|
|
108
995
|
}>;
|
|
996
|
+
/**
|
|
997
|
+
* Database Connection String Builder.
|
|
998
|
+
* @example
|
|
999
|
+
* const conn = await MepCLI.connectionString({
|
|
1000
|
+
* message: 'Configure Database',
|
|
1001
|
+
* initial: 'postgres://localhost:5432/mydb'
|
|
1002
|
+
* });
|
|
1003
|
+
* @param options - Initial URL.
|
|
1004
|
+
* @returns A promise resolving to parsed connection details.
|
|
1005
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/connection-string-prompt.ts}
|
|
1006
|
+
*/
|
|
109
1007
|
static connectionString(options: ConnectionStringOptions): Promise<ConnectionStringResult>;
|
|
1008
|
+
/**
|
|
1009
|
+
* cURL Command Builder.
|
|
1010
|
+
* @experimental
|
|
1011
|
+
* @example
|
|
1012
|
+
* const request = await MepCLI.curl({
|
|
1013
|
+
* message: 'Build API Request',
|
|
1014
|
+
* initial: 'curl -X POST https://api.example.com/v1/resource'
|
|
1015
|
+
* });
|
|
1016
|
+
* @param options - Initial command.
|
|
1017
|
+
* @returns A promise resolving to the parsed request object.
|
|
1018
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/curl-prompt.ts}
|
|
1019
|
+
*/
|
|
110
1020
|
static curl(options: CurlOptions): Promise<CurlResult>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Phone Number input (with country codes).
|
|
1023
|
+
* @example
|
|
1024
|
+
* const phone = await MepCLI.phone({
|
|
1025
|
+
* message: 'Enter phone number',
|
|
1026
|
+
* defaultCountry: 'US'
|
|
1027
|
+
* });
|
|
1028
|
+
* @param options - Default country ISO code.
|
|
1029
|
+
* @returns A promise resolving to the formatted number.
|
|
1030
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/phone-prompt.ts}
|
|
1031
|
+
*/
|
|
111
1032
|
static phone(options: PhoneOptions): Promise<string>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Fuzzy Multi-Column Selection.
|
|
1035
|
+
* @example
|
|
1036
|
+
* const user = await MepCLI.fuzzyMultiColumn({
|
|
1037
|
+
* message: 'Select User',
|
|
1038
|
+
* choices: [
|
|
1039
|
+
* { title: 'Alice', value: 1, description: 'Admin' },
|
|
1040
|
+
* { title: 'Bob', value: 2, description: 'User' }
|
|
1041
|
+
* ],
|
|
1042
|
+
* cols: 2
|
|
1043
|
+
* });
|
|
1044
|
+
* @param options - Choices and layout columns.
|
|
1045
|
+
* @returns A promise resolving to the selected value.
|
|
1046
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/fuzzy-multi-column-prompt.ts}
|
|
1047
|
+
*/
|
|
112
1048
|
static fuzzyMultiColumn<V>(options: MultiColumnSelectOptions<V>): Promise<V>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Multi-Range Selection (Discontinuous).
|
|
1051
|
+
* @example
|
|
1052
|
+
* const ranges = await MepCLI.multiRange({
|
|
1053
|
+
* message: 'Select lines to delete',
|
|
1054
|
+
* choices: lines.map((l, i) => ({ title: l, value: i }))
|
|
1055
|
+
* });
|
|
1056
|
+
* @param options - Choices.
|
|
1057
|
+
* @returns A promise resolving to selected values.
|
|
1058
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/multi-range-prompt.ts}
|
|
1059
|
+
*/
|
|
113
1060
|
static multiRange<V>(options: SelectRangeOptions<V>): Promise<V[]>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Breadcrumb Search (Navigator + Fuzzy Search).
|
|
1063
|
+
* @example
|
|
1064
|
+
* const file = await MepCLI.breadcrumbSearch({
|
|
1065
|
+
* message: 'Find file',
|
|
1066
|
+
* root: 'src'
|
|
1067
|
+
* });
|
|
1068
|
+
* @param options - Root path.
|
|
1069
|
+
* @returns A promise resolving to the selected path.
|
|
1070
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/breadcrumb-search-prompt.ts}
|
|
1071
|
+
*/
|
|
114
1072
|
static breadcrumbSearch(options: BreadcrumbOptions): Promise<string>;
|
|
115
1073
|
}
|