mepcli 1.1.0 → 1.3.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/README.md +26 -2
- package/dist/core.d.ts +964 -7
- package/dist/core.js +964 -7
- package/dist/prompts/curl-utils.d.ts +25 -0
- package/dist/prompts/curl-utils.js +41 -0
- package/dist/prompts/curl.d.ts +8 -7
- package/dist/prompts/curl.js +200 -82
- package/dist/prompts/exec.d.ts +4 -0
- package/dist/prompts/exec.js +59 -5
- package/dist/prompts/map.d.ts +2 -0
- package/dist/prompts/map.js +60 -13
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -79,116 +79,507 @@ const curl_1 = require("./prompts/curl");
|
|
|
79
79
|
const pipeline_1 = require("./pipeline");
|
|
80
80
|
const tasks_1 = require("./tasks");
|
|
81
81
|
/**
|
|
82
|
-
* Public Facade for
|
|
82
|
+
* Public Facade for Mep
|
|
83
83
|
*/
|
|
84
84
|
class MepCLI {
|
|
85
85
|
/**
|
|
86
|
-
* Creates a new Spinner instance.
|
|
86
|
+
* Creates a new Spinner instance to indicate background activity.
|
|
87
|
+
* @example
|
|
88
|
+
* const spinner = MepCLI.spinner('Loading data...');
|
|
89
|
+
* spinner.start();
|
|
90
|
+
* await someAsyncOperation();
|
|
91
|
+
* spinner.stop('Done!');
|
|
92
|
+
* @param message - The initial text to display next to the spinner.
|
|
93
|
+
* @returns A Spinner instance to control the animation.
|
|
94
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/spinner.ts}
|
|
87
95
|
*/
|
|
88
96
|
static spinner(message) {
|
|
89
97
|
return new spinner_1.Spinner(message);
|
|
90
98
|
}
|
|
91
99
|
/**
|
|
92
100
|
* Creates a new TaskRunner for managing multiple concurrent tasks (spinners/progress bars).
|
|
101
|
+
* @example
|
|
102
|
+
* const tasks = MepCLI.tasks({ concurrency: 2 });
|
|
103
|
+
* tasks.add('Task 1', async () => { ... });
|
|
104
|
+
* tasks.add('Task 2', async () => { ... });
|
|
105
|
+
* await tasks.run();
|
|
106
|
+
* @param options - Configuration for concurrency and renderer style.
|
|
107
|
+
* @returns A TaskRunner instance.
|
|
108
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/task-runner.ts}
|
|
93
109
|
*/
|
|
94
110
|
static tasks(options) {
|
|
95
111
|
return new tasks_1.TaskRunner(options);
|
|
96
112
|
}
|
|
97
113
|
/**
|
|
98
|
-
* Creates a new Pipeline instance.
|
|
114
|
+
* Creates a new Pipeline instance for sequential workflow execution.
|
|
115
|
+
* @experimental
|
|
116
|
+
* @example
|
|
117
|
+
* const context = await MepCLI.pipeline()
|
|
118
|
+
* .step('ask-name', async (ctx) => {
|
|
119
|
+
* ctx.name = await MepCLI.text({ message: 'Name?' });
|
|
120
|
+
* })
|
|
121
|
+
* .run();
|
|
122
|
+
* @returns A fluent Pipeline builder.
|
|
123
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/pipeline-demo.ts}
|
|
99
124
|
*/
|
|
100
125
|
static pipeline() {
|
|
101
126
|
return new pipeline_1.Pipeline();
|
|
102
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Standard text input prompt.
|
|
130
|
+
* @example
|
|
131
|
+
* const name = await MepCLI.text({
|
|
132
|
+
* message: 'What is your GitHub username?',
|
|
133
|
+
* placeholder: 'e.g., octocat',
|
|
134
|
+
* validate: (val) => val.length > 0 ? true : 'Username is required!'
|
|
135
|
+
* });
|
|
136
|
+
* @param options - Configuration options including validation and placeholder.
|
|
137
|
+
* @returns A promise resolving to the user's input string.
|
|
138
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
139
|
+
*/
|
|
103
140
|
static text(options) {
|
|
104
141
|
return new text_1.TextPrompt(options).run();
|
|
105
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Single selection prompt from a list of choices.
|
|
145
|
+
* @example
|
|
146
|
+
* const framework = await MepCLI.select({
|
|
147
|
+
* message: 'Pick a framework',
|
|
148
|
+
* choices: [
|
|
149
|
+
* { title: 'React', value: 'react', description: 'Meta' },
|
|
150
|
+
* { title: 'Vue', value: 'vue', description: 'Community' },
|
|
151
|
+
* ]
|
|
152
|
+
* });
|
|
153
|
+
* @param options - Choices and configuration.
|
|
154
|
+
* @returns A promise resolving to the selected value (V).
|
|
155
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
156
|
+
*/
|
|
106
157
|
static select(options) {
|
|
107
158
|
return new select_1.SelectPrompt(options).run();
|
|
108
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Multiple selection prompt with checkboxes.
|
|
162
|
+
* @example
|
|
163
|
+
* const toppings = await MepCLI.checkbox({
|
|
164
|
+
* message: 'Select toppings',
|
|
165
|
+
* choices: [
|
|
166
|
+
* { title: 'Cheese', value: 'cheese', selected: true },
|
|
167
|
+
* { title: 'Pepperoni', value: 'pepperoni' },
|
|
168
|
+
* ],
|
|
169
|
+
* min: 1
|
|
170
|
+
* });
|
|
171
|
+
* @param options - Choices, limits (min/max), and initial state.
|
|
172
|
+
* @returns A promise resolving to an array of selected values (V[]).
|
|
173
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
174
|
+
*/
|
|
109
175
|
static checkbox(options) {
|
|
110
176
|
return new checkbox_1.CheckboxPrompt(options).run();
|
|
111
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Boolean confirmation prompt (Y/n).
|
|
180
|
+
* @example
|
|
181
|
+
* const proceed = await MepCLI.confirm({
|
|
182
|
+
* message: 'Delete production database?',
|
|
183
|
+
* initial: false
|
|
184
|
+
* });
|
|
185
|
+
* @param options - Message and initial boolean state.
|
|
186
|
+
* @returns A promise resolving to true or false.
|
|
187
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
188
|
+
*/
|
|
112
189
|
static confirm(options) {
|
|
113
190
|
return new confirm_1.ConfirmPrompt(options).run();
|
|
114
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Secure password input (masked with *).
|
|
194
|
+
* @example
|
|
195
|
+
* const password = await MepCLI.password({
|
|
196
|
+
* message: 'Enter password',
|
|
197
|
+
* validate: (val) => val.length >= 8 || 'Must be 8+ chars'
|
|
198
|
+
* });
|
|
199
|
+
* @param options - Same as TextOptions but defaults to hidden input.
|
|
200
|
+
* @returns A promise resolving to the password string.
|
|
201
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
202
|
+
*/
|
|
115
203
|
static password(options) {
|
|
116
204
|
return new text_1.TextPrompt({ ...options, isPassword: true }).run();
|
|
117
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Secret input prompt (no visual feedback).
|
|
208
|
+
* @example
|
|
209
|
+
* const apiKey = await MepCLI.secret({
|
|
210
|
+
* message: 'Paste API Key (hidden)'
|
|
211
|
+
* });
|
|
212
|
+
* @param options - Same as TextOptions, visual output is suppressed.
|
|
213
|
+
* @returns A promise resolving to the secret string.
|
|
214
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
215
|
+
*/
|
|
118
216
|
static secret(options) {
|
|
119
217
|
return new text_1.TextPrompt({ ...options, mask: '' }).run();
|
|
120
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Numeric input prompt with increments.
|
|
221
|
+
* @example
|
|
222
|
+
* const age = await MepCLI.number({
|
|
223
|
+
* message: 'How old are you?',
|
|
224
|
+
* min: 18,
|
|
225
|
+
* max: 99,
|
|
226
|
+
* initial: 25
|
|
227
|
+
* });
|
|
228
|
+
* @param options - Min, max, step, and initial value.
|
|
229
|
+
* @returns A promise resolving to the entered number.
|
|
230
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
231
|
+
*/
|
|
121
232
|
static number(options) {
|
|
122
233
|
return new number_1.NumberPrompt(options).run();
|
|
123
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Binary toggle switch.
|
|
237
|
+
* @example
|
|
238
|
+
* const isDarkMode = await MepCLI.toggle({
|
|
239
|
+
* message: 'Enable Dark Mode?',
|
|
240
|
+
* activeText: 'On',
|
|
241
|
+
* inactiveText: 'Off',
|
|
242
|
+
* initial: true
|
|
243
|
+
* });
|
|
244
|
+
* @param options - Text labels for states and initial value.
|
|
245
|
+
* @returns A promise resolving to the boolean state.
|
|
246
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/basic-prompts.ts}
|
|
247
|
+
*/
|
|
124
248
|
static toggle(options) {
|
|
125
249
|
return new toggle_1.TogglePrompt(options).run();
|
|
126
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Tag list input (comma separated or enter to add).
|
|
253
|
+
* @example
|
|
254
|
+
* const tags = await MepCLI.list({
|
|
255
|
+
* message: 'Enter keywords (comma separated)',
|
|
256
|
+
* initial: ['js', 'ts'],
|
|
257
|
+
* placeholder: 'react, vue, svelte'
|
|
258
|
+
* });
|
|
259
|
+
* @param options - Placeholder and initial list.
|
|
260
|
+
* @returns A promise resolving to an array of strings.
|
|
261
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/form-prompts.ts}
|
|
262
|
+
*/
|
|
127
263
|
static list(options) {
|
|
128
264
|
return new list_1.ListPrompt(options).run();
|
|
129
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Slider input for selecting a number within a range.
|
|
268
|
+
* @example
|
|
269
|
+
* const volume = await MepCLI.slider({
|
|
270
|
+
* message: 'Set volume',
|
|
271
|
+
* min: 0,
|
|
272
|
+
* max: 100,
|
|
273
|
+
* step: 5,
|
|
274
|
+
* initial: 50
|
|
275
|
+
* });
|
|
276
|
+
* @param options - Min/max range, step, and unit label.
|
|
277
|
+
* @returns A promise resolving to the selected number.
|
|
278
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
279
|
+
*/
|
|
130
280
|
static slider(options) {
|
|
131
281
|
return new slider_1.SliderPrompt(options).run();
|
|
132
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Dual-handle slider for selecting a numeric range.
|
|
285
|
+
* @example
|
|
286
|
+
* const priceRange = await MepCLI.range({
|
|
287
|
+
* message: 'Filter by price',
|
|
288
|
+
* min: 0,
|
|
289
|
+
* max: 1000,
|
|
290
|
+
* initial: [100, 500]
|
|
291
|
+
* });
|
|
292
|
+
* @param options - Range bounds and initial start/end values.
|
|
293
|
+
* @returns A promise resolving to a tuple `[start, end]`.
|
|
294
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
295
|
+
*/
|
|
133
296
|
static range(options) {
|
|
134
297
|
return new range_1.RangePrompt(options).run();
|
|
135
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Transfer list for moving items between two lists.
|
|
301
|
+
* @example
|
|
302
|
+
* const [left, right] = await MepCLI.transfer({
|
|
303
|
+
* message: 'Assign users to team',
|
|
304
|
+
* source: ['Alice', 'Bob', 'Charlie'],
|
|
305
|
+
* target: ['Dave']
|
|
306
|
+
* });
|
|
307
|
+
* @param options - Source and target lists.
|
|
308
|
+
* @returns A promise resolving to `[sourceItems, targetItems]`.
|
|
309
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
310
|
+
*/
|
|
136
311
|
static transfer(options) {
|
|
137
312
|
return new transfer_1.TransferPrompt(options).run();
|
|
138
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Cron expression generator/validator.
|
|
316
|
+
* @example
|
|
317
|
+
* const schedule = await MepCLI.cron({
|
|
318
|
+
* message: 'Schedule backup',
|
|
319
|
+
* initial: '0 0 * * *'
|
|
320
|
+
* });
|
|
321
|
+
* @param options - Initial cron string and placeholder.
|
|
322
|
+
* @returns A promise resolving to the valid cron string.
|
|
323
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/cron-prompt.ts}
|
|
324
|
+
*/
|
|
139
325
|
static cron(options) {
|
|
140
326
|
return new cron_1.CronPrompt(options).run();
|
|
141
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Interactive date picker.
|
|
330
|
+
* @example
|
|
331
|
+
* const birthday = await MepCLI.date({
|
|
332
|
+
* message: 'When is your birthday?',
|
|
333
|
+
* min: new Date(1900, 0, 1),
|
|
334
|
+
* max: new Date()
|
|
335
|
+
* });
|
|
336
|
+
* @param options - Min/max dates and localization.
|
|
337
|
+
* @returns A promise resolving to the selected Date object.
|
|
338
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/calendar-prompt.ts}
|
|
339
|
+
*/
|
|
142
340
|
static date(options) {
|
|
143
341
|
return new date_1.DatePrompt(options).run();
|
|
144
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* File system explorer.
|
|
345
|
+
* @example
|
|
346
|
+
* const configPath = await MepCLI.file({
|
|
347
|
+
* message: 'Select config file',
|
|
348
|
+
* basePath: './src',
|
|
349
|
+
* extensions: ['json', 'yaml'],
|
|
350
|
+
* });
|
|
351
|
+
* @param options - Root path, allowed extensions, and directory filtering.
|
|
352
|
+
* @returns A promise resolving to the absolute path of the selected file.
|
|
353
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/filesystem-prompts.ts}
|
|
354
|
+
*/
|
|
145
355
|
static file(options) {
|
|
146
356
|
return new file_1.FilePrompt(options).run();
|
|
147
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Multi-select checkbox with search support (alias for checkbox logic).
|
|
360
|
+
* @example
|
|
361
|
+
* const features = await MepCLI.multiSelect({
|
|
362
|
+
* message: 'Select features',
|
|
363
|
+
* choices: [
|
|
364
|
+
* { title: 'TypeScript', value: 'ts' },
|
|
365
|
+
* { title: 'ESLint', value: 'lint' }
|
|
366
|
+
* ]
|
|
367
|
+
* });
|
|
368
|
+
* @param options - Same as CheckboxOptions.
|
|
369
|
+
* @returns A promise resolving to an array of selected values.
|
|
370
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
371
|
+
*/
|
|
148
372
|
static multiSelect(options) {
|
|
149
373
|
return new multi_select_1.MultiSelectPrompt(options).run();
|
|
150
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Star rating input.
|
|
377
|
+
* @example
|
|
378
|
+
* const stars = await MepCLI.rating({
|
|
379
|
+
* message: 'Rate this library',
|
|
380
|
+
* min: 1,
|
|
381
|
+
* max: 5,
|
|
382
|
+
* initial: 5
|
|
383
|
+
* });
|
|
384
|
+
* @param options - Min/max stars.
|
|
385
|
+
* @returns A promise resolving to the numeric rating.
|
|
386
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
387
|
+
*/
|
|
151
388
|
static rating(options) {
|
|
152
389
|
return new rating_1.RatingPrompt(options).run();
|
|
153
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Autocomplete search with async data fetching.
|
|
393
|
+
* @example
|
|
394
|
+
* const city = await MepCLI.autocomplete({
|
|
395
|
+
* message: 'Search city',
|
|
396
|
+
* suggest: async (input) => {
|
|
397
|
+
* const results = await fetchCities(input);
|
|
398
|
+
* return results.map(c => ({ title: c.name, value: c.id }));
|
|
399
|
+
* }
|
|
400
|
+
* });
|
|
401
|
+
* @param options - `suggest` callback to filter/fetch choices.
|
|
402
|
+
* @returns A promise resolving to the selected value.
|
|
403
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
404
|
+
*/
|
|
154
405
|
static autocomplete(options) {
|
|
155
406
|
return new autocomplete_1.AutocompletePrompt(options).run();
|
|
156
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* List sorting prompt.
|
|
410
|
+
* @example
|
|
411
|
+
* const priority = await MepCLI.sort({
|
|
412
|
+
* message: 'Prioritize tasks',
|
|
413
|
+
* items: ['Fix bugs', 'Add features', 'Write docs']
|
|
414
|
+
* });
|
|
415
|
+
* @param options - Array of strings to be reordered.
|
|
416
|
+
* @returns A promise resolving to the reordered array of strings.
|
|
417
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
418
|
+
*/
|
|
157
419
|
static sort(options) {
|
|
158
420
|
return new sort_1.SortPrompt(options).run();
|
|
159
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* Interactive data table with row selection.
|
|
424
|
+
* @example
|
|
425
|
+
* const selectedRow = await MepCLI.table({
|
|
426
|
+
* message: 'Pick a user',
|
|
427
|
+
* columns: ['Name', 'Role'],
|
|
428
|
+
* data: [
|
|
429
|
+
* { value: 1, row: ['Alice', 'Admin'] },
|
|
430
|
+
* { value: 2, row: ['Bob', 'User'] }
|
|
431
|
+
* ]
|
|
432
|
+
* });
|
|
433
|
+
* @param options - Columns definition and row data.
|
|
434
|
+
* @returns A promise resolving to the `value` of the selected row.
|
|
435
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/data-visualization.ts}
|
|
436
|
+
*/
|
|
160
437
|
static table(options) {
|
|
161
438
|
return new table_1.TablePrompt(options).run();
|
|
162
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Open external editor (vim/nano/code) for long input.
|
|
442
|
+
* @example
|
|
443
|
+
* const bio = await MepCLI.editor({
|
|
444
|
+
* message: 'Write your biography',
|
|
445
|
+
* extension: 'md'
|
|
446
|
+
* });
|
|
447
|
+
* @param options - File extension for syntax highlighting.
|
|
448
|
+
* @returns A promise resolving to the saved content.
|
|
449
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/form-prompts.ts}
|
|
450
|
+
*/
|
|
163
451
|
static editor(options) {
|
|
164
452
|
return new editor_1.EditorPrompt(options).run();
|
|
165
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* Hierarchical tree selection.
|
|
456
|
+
* @example
|
|
457
|
+
* const node = await MepCLI.tree({
|
|
458
|
+
* message: 'Select component',
|
|
459
|
+
* data: [
|
|
460
|
+
* { title: 'src', value: 'src', children: [
|
|
461
|
+
* { title: 'index.ts', value: 'src/index.ts' }
|
|
462
|
+
* ]}
|
|
463
|
+
* ]
|
|
464
|
+
* });
|
|
465
|
+
* @param options - Tree structure data.
|
|
466
|
+
* @returns A promise resolving to the selected node's value.
|
|
467
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/tree-prompt.ts}
|
|
468
|
+
*/
|
|
166
469
|
static tree(options) {
|
|
167
470
|
return new tree_1.TreePrompt(options).run();
|
|
168
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Detect single keypress event.
|
|
474
|
+
* @example
|
|
475
|
+
* const key = await MepCLI.keypress({
|
|
476
|
+
* message: 'Press any key to continue...'
|
|
477
|
+
* });
|
|
478
|
+
* @param options - Optional allowed keys filter.
|
|
479
|
+
* @returns A promise resolving to the pressed key name.
|
|
480
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
481
|
+
*/
|
|
169
482
|
static keypress(options) {
|
|
170
483
|
return new keypress_1.KeypressPrompt(options).run();
|
|
171
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* Multi-field form input.
|
|
487
|
+
* @example
|
|
488
|
+
* const user = await MepCLI.form({
|
|
489
|
+
* message: 'User Registration',
|
|
490
|
+
* fields: [
|
|
491
|
+
* { name: 'first', message: 'First Name' },
|
|
492
|
+
* { name: 'last', message: 'Last Name' },
|
|
493
|
+
* { name: 'email', message: 'Email', validate: (v) => v.includes('@') }
|
|
494
|
+
* ]
|
|
495
|
+
* });
|
|
496
|
+
* @param options - Array of field definitions.
|
|
497
|
+
* @returns A promise resolving to an object with field names as keys.
|
|
498
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/form-prompts.ts}
|
|
499
|
+
*/
|
|
172
500
|
static form(options) {
|
|
173
501
|
return new form_1.FormPrompt(options).run();
|
|
174
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* Templated snippet generator.
|
|
505
|
+
* @example
|
|
506
|
+
* const component = await MepCLI.snippet({
|
|
507
|
+
* message: 'Create Component',
|
|
508
|
+
* template: `export function {{name}}() {
|
|
509
|
+
* return <div>{{content}}</div>;
|
|
510
|
+
* }`,
|
|
511
|
+
* fields: {
|
|
512
|
+
* name: { message: 'Component Name' },
|
|
513
|
+
* content: { message: 'Content' }
|
|
514
|
+
* }
|
|
515
|
+
* });
|
|
516
|
+
* @param options - Template string with {{variables}} and field config.
|
|
517
|
+
* @returns A promise resolving to the compiled string.
|
|
518
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/snippet-prompt.ts}
|
|
519
|
+
*/
|
|
175
520
|
static snippet(options) {
|
|
176
521
|
return new snippet_1.SnippetPrompt(options).run();
|
|
177
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* Anti-spam / Bot detection prompt.
|
|
525
|
+
* @example
|
|
526
|
+
* const isHuman = await MepCLI.spam({
|
|
527
|
+
* message: 'Press Space 5 times quickly!',
|
|
528
|
+
* threshold: 5,
|
|
529
|
+
* spamKey: ' '
|
|
530
|
+
* });
|
|
531
|
+
* @param options - Threshold frequency and key to mash.
|
|
532
|
+
* @returns A promise resolving to true (pass) or false (fail).
|
|
533
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/spam-prompt.ts}
|
|
534
|
+
*/
|
|
178
535
|
static spam(options) {
|
|
179
536
|
return new spam_1.SpamPrompt(options).run();
|
|
180
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Pause execution for a set time (with progress).
|
|
540
|
+
* @example
|
|
541
|
+
* await MepCLI.wait({
|
|
542
|
+
* message: 'Processing...',
|
|
543
|
+
* seconds: 3
|
|
544
|
+
* });
|
|
545
|
+
* @param options - Duration in seconds.
|
|
546
|
+
* @returns A promise resolving after the delay.
|
|
547
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/wait-prompt.ts}
|
|
548
|
+
*/
|
|
181
549
|
static wait(options) {
|
|
182
550
|
return new wait_1.WaitPrompt(options).run();
|
|
183
551
|
}
|
|
552
|
+
/**
|
|
553
|
+
* Source code editor with syntax highlighting.
|
|
554
|
+
* @example
|
|
555
|
+
* const json = await MepCLI.code({
|
|
556
|
+
* message: 'Edit Configuration',
|
|
557
|
+
* language: 'json',
|
|
558
|
+
* template: '{\n "name": "project"\n}'
|
|
559
|
+
* });
|
|
560
|
+
* @param options - Language, initial template, and syntax highlighting.
|
|
561
|
+
* @returns A promise resolving to the edited code string.
|
|
562
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/code-prompt.ts}
|
|
563
|
+
*/
|
|
184
564
|
static code(options) {
|
|
185
565
|
return new code_1.CodePrompt(options).run();
|
|
186
566
|
}
|
|
187
567
|
/**
|
|
188
|
-
* Tree Select Prompt (Multi-selection)
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
568
|
+
* Tree Select Prompt (Multi-selection).
|
|
569
|
+
* @example
|
|
570
|
+
* const selectedPaths = await MepCLI.treeSelect({
|
|
571
|
+
* message: 'Select files to include',
|
|
572
|
+
* data: [
|
|
573
|
+
* { title: 'src', value: 'src', children: [
|
|
574
|
+
* { title: 'core.ts', value: 'src/core.ts' }
|
|
575
|
+
* ]}
|
|
576
|
+
* ]
|
|
577
|
+
* });
|
|
578
|
+
* @param options - Tree structure and initial selections.
|
|
579
|
+
* @returns A promise that resolves to an array of selected values.
|
|
580
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
581
|
+
*
|
|
582
|
+
* @notice Windows Compatibility:
|
|
192
583
|
* When used in a long sequence of prompts, this component may experience
|
|
193
584
|
* an input delay. If it feels "blocked", simply press 'Enter' once
|
|
194
585
|
* to refresh the TTY stream.
|
|
@@ -196,141 +587,707 @@ class MepCLI {
|
|
|
196
587
|
static treeSelect(options) {
|
|
197
588
|
return new tree_select_1.TreeSelectPrompt(options).run();
|
|
198
589
|
}
|
|
590
|
+
/**
|
|
591
|
+
* Color picker (Hex, RGB, HSL).
|
|
592
|
+
* @example
|
|
593
|
+
* const color = await MepCLI.color({
|
|
594
|
+
* message: 'Pick a theme color',
|
|
595
|
+
* format: 'hex',
|
|
596
|
+
* initial: '#3B82F6'
|
|
597
|
+
* });
|
|
598
|
+
* @param options - Format preference and initial value.
|
|
599
|
+
* @returns A promise resolving to the color string.
|
|
600
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/color-prompt.ts}
|
|
601
|
+
*/
|
|
199
602
|
static color(options) {
|
|
200
603
|
return new color_1.ColorPrompt(options).run();
|
|
201
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* 2D Grid Checkbox (Boolean Matrix).
|
|
607
|
+
* @example
|
|
608
|
+
* const availability = await MepCLI.grid({
|
|
609
|
+
* message: 'Select availability',
|
|
610
|
+
* rows: ['Mon', 'Tue'],
|
|
611
|
+
* columns: ['AM', 'PM']
|
|
612
|
+
* });
|
|
613
|
+
* @param options - Row/Column labels.
|
|
614
|
+
* @returns A promise resolving to a 2D boolean array.
|
|
615
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/grid-prompt.ts}
|
|
616
|
+
*/
|
|
202
617
|
static grid(options) {
|
|
203
618
|
return new grid_1.GridPrompt(options).run();
|
|
204
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
* Calendar picker for dates or ranges.
|
|
622
|
+
* @example
|
|
623
|
+
* const range = await MepCLI.calendar({
|
|
624
|
+
* message: 'Select vacation dates',
|
|
625
|
+
* mode: 'range'
|
|
626
|
+
* });
|
|
627
|
+
* @param options - Selection mode (single/range) and bounds.
|
|
628
|
+
* @returns A promise resolving to a Date or [Date, Date].
|
|
629
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/calendar-prompt.ts}
|
|
630
|
+
*/
|
|
205
631
|
static calendar(options) {
|
|
206
632
|
return new calendar_1.CalendarPrompt(options).run();
|
|
207
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* Key-Value Map editor.
|
|
636
|
+
* @example
|
|
637
|
+
* const envVars = await MepCLI.map({
|
|
638
|
+
* message: 'Environment Variables',
|
|
639
|
+
* initial: { NODE_ENV: 'development', PORT: '3000' }
|
|
640
|
+
* });
|
|
641
|
+
* @param options - Initial key-value pairs.
|
|
642
|
+
* @returns A promise resolving to a record of strings.
|
|
643
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/map-prompt.ts}
|
|
644
|
+
*/
|
|
208
645
|
static map(options) {
|
|
209
646
|
return new map_1.MapPrompt(options).run();
|
|
210
647
|
}
|
|
648
|
+
/**
|
|
649
|
+
* Semantic Versioning incrementer.
|
|
650
|
+
* @example
|
|
651
|
+
* const nextVersion = await MepCLI.semver({
|
|
652
|
+
* message: 'Bump version',
|
|
653
|
+
* currentVersion: '1.0.0'
|
|
654
|
+
* });
|
|
655
|
+
* @param options - The current version string.
|
|
656
|
+
* @returns A promise resolving to the new version string.
|
|
657
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/semver-prompt.ts}
|
|
658
|
+
*/
|
|
211
659
|
static semver(options) {
|
|
212
660
|
return new semver_1.SemVerPrompt(options).run();
|
|
213
661
|
}
|
|
662
|
+
/**
|
|
663
|
+
* IP Address input validator.
|
|
664
|
+
* @example
|
|
665
|
+
* const ip = await MepCLI.ip({
|
|
666
|
+
* message: 'Enter Server IP',
|
|
667
|
+
* initial: '127.0.0.1'
|
|
668
|
+
* });
|
|
669
|
+
* @param options - Initial value.
|
|
670
|
+
* @returns A promise resolving to the valid IP string.
|
|
671
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/ip-prompt.ts}
|
|
672
|
+
*/
|
|
214
673
|
static ip(options) {
|
|
215
674
|
return new ip_1.IPPrompt(options).run();
|
|
216
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* One-Time Password / Pin Code input.
|
|
678
|
+
* @example
|
|
679
|
+
* const otp = await MepCLI.otp({
|
|
680
|
+
* message: 'Enter 2FA Code',
|
|
681
|
+
* length: 6
|
|
682
|
+
* });
|
|
683
|
+
* @param options - Length and masking options.
|
|
684
|
+
* @returns A promise resolving to the entered code.
|
|
685
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/otp-prompt.ts}
|
|
686
|
+
*/
|
|
217
687
|
static otp(options) {
|
|
218
688
|
return new otp_1.OTPPrompt(options).run();
|
|
219
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* Multiple choice quiz.
|
|
692
|
+
* @example
|
|
693
|
+
* const answer = await MepCLI.quizSelect({
|
|
694
|
+
* message: 'What is 2 + 2?',
|
|
695
|
+
* choices: [
|
|
696
|
+
* { title: '3', value: 3 },
|
|
697
|
+
* { title: '4', value: 4 }
|
|
698
|
+
* ],
|
|
699
|
+
* correctValue: 4
|
|
700
|
+
* });
|
|
701
|
+
* @param options - Choices and correct answer logic.
|
|
702
|
+
* @returns A promise resolving to the selected value.
|
|
703
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/quiz-select-prompt.ts}
|
|
704
|
+
*/
|
|
220
705
|
static quizSelect(options) {
|
|
221
706
|
return new quiz_select_1.QuizSelectPrompt(options).run();
|
|
222
707
|
}
|
|
708
|
+
/**
|
|
709
|
+
* Text-based quiz with verification.
|
|
710
|
+
* @example
|
|
711
|
+
* const answer = await MepCLI.quizText({
|
|
712
|
+
* message: 'Who is the author of Harry Potter?',
|
|
713
|
+
* correctAnswer: 'J.K. Rowling',
|
|
714
|
+
* verify: (val) => val.includes('Rowling')
|
|
715
|
+
* });
|
|
716
|
+
* @param options - Correct answer string or validation function.
|
|
717
|
+
* @returns A promise resolving to the input string.
|
|
718
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/quiz-text-prompt.ts}
|
|
719
|
+
*/
|
|
223
720
|
static quizText(options) {
|
|
224
721
|
return new quiz_text_1.QuizTextPrompt(options).run();
|
|
225
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* Kanban board for organizing items.
|
|
725
|
+
* @example
|
|
726
|
+
* const board = await MepCLI.kanban({
|
|
727
|
+
* message: 'Project Status',
|
|
728
|
+
* columns: [
|
|
729
|
+
* { id: 'todo', title: 'To Do', items: [{ id: '1', title: 'Task A' }] },
|
|
730
|
+
* { id: 'done', title: 'Done', items: [] }
|
|
731
|
+
* ]
|
|
732
|
+
* });
|
|
733
|
+
* @param options - Columns and their items.
|
|
734
|
+
* @returns A promise resolving to the final column state.
|
|
735
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/kanban-prompt.ts}
|
|
736
|
+
*/
|
|
226
737
|
static kanban(options) {
|
|
227
738
|
return new kanban_1.KanbanPrompt(options).run();
|
|
228
739
|
}
|
|
740
|
+
/**
|
|
741
|
+
* Time picker (HH:MM AM/PM).
|
|
742
|
+
* @example
|
|
743
|
+
* const time = await MepCLI.time({
|
|
744
|
+
* message: 'Wake up time',
|
|
745
|
+
* initial: '08:00 AM'
|
|
746
|
+
* });
|
|
747
|
+
* @param options - 12h/24h format and step intervals.
|
|
748
|
+
* @returns A promise resolving to the time string.
|
|
749
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/time-prompt.ts}
|
|
750
|
+
*/
|
|
229
751
|
static time(options) {
|
|
230
752
|
return new time_1.TimePrompt(options).run();
|
|
231
753
|
}
|
|
754
|
+
/**
|
|
755
|
+
* Heatmap/Weekly schedule selector.
|
|
756
|
+
* @example
|
|
757
|
+
* const schedule = await MepCLI.heatmap({
|
|
758
|
+
* message: 'When are you free?',
|
|
759
|
+
* rows: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
|
|
760
|
+
* columns: ['Morning', 'Afternoon', 'Evening'],
|
|
761
|
+
* legend: [
|
|
762
|
+
* { value: 0, char: ' ', color: (t) => t },
|
|
763
|
+
* { value: 1, char: '■', color: (t) => t }
|
|
764
|
+
* ]
|
|
765
|
+
* });
|
|
766
|
+
* @param options - Grid labels and color scale legend.
|
|
767
|
+
* @returns A promise resolving to a 2D array of values.
|
|
768
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/heatmap-prompt.ts}
|
|
769
|
+
*/
|
|
232
770
|
static heatmap(options) {
|
|
233
771
|
return new heatmap_1.HeatmapPrompt(options).run();
|
|
234
772
|
}
|
|
773
|
+
/**
|
|
774
|
+
* Byte size input (KB, MB, GB).
|
|
775
|
+
* @example
|
|
776
|
+
* const memory = await MepCLI.byte({
|
|
777
|
+
* message: 'Allocate memory',
|
|
778
|
+
* initial: 1024 * 1024 // 1MB
|
|
779
|
+
* });
|
|
780
|
+
* @param options - Min/Max bytes.
|
|
781
|
+
* @returns A promise resolving to the number of bytes.
|
|
782
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/byte-prompt.ts}
|
|
783
|
+
*/
|
|
235
784
|
static byte(options) {
|
|
236
785
|
return new byte_1.BytePrompt(options).run();
|
|
237
786
|
}
|
|
787
|
+
/**
|
|
788
|
+
* Slot machine style spinner.
|
|
789
|
+
* @example
|
|
790
|
+
* const fruit = await MepCLI.slot({
|
|
791
|
+
* message: 'Spin to win!',
|
|
792
|
+
* choices: ['🍒', '🍋', '🍇', '🍉'],
|
|
793
|
+
* rows: 3
|
|
794
|
+
* });
|
|
795
|
+
* @param options - Items to cycle through.
|
|
796
|
+
* @returns A promise resolving to the selected item string.
|
|
797
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/slot-prompt.ts}
|
|
798
|
+
*/
|
|
238
799
|
static slot(options) {
|
|
239
800
|
return new slot_1.SlotPrompt(options).run();
|
|
240
801
|
}
|
|
802
|
+
/**
|
|
803
|
+
* Rhythm game style gauge input.
|
|
804
|
+
* @example
|
|
805
|
+
* const result = await MepCLI.gauge({
|
|
806
|
+
* message: 'Hit the target!',
|
|
807
|
+
* safeZone: 0.2 // 20%
|
|
808
|
+
* });
|
|
809
|
+
* @param options - Width and difficulty (safeZone).
|
|
810
|
+
* @returns A promise resolving to 'success' or 'fail'.
|
|
811
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/gauge-prompt.ts}
|
|
812
|
+
*/
|
|
241
813
|
static gauge(options) {
|
|
242
814
|
return new gauge_1.GaugePrompt(options).run();
|
|
243
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Interactive calculator.
|
|
818
|
+
* @example
|
|
819
|
+
* const result = await MepCLI.calculator({
|
|
820
|
+
* message: 'Calculate total',
|
|
821
|
+
* initial: '10 + 5'
|
|
822
|
+
* });
|
|
823
|
+
* @param options - Initial expression.
|
|
824
|
+
* @returns A promise resolving to the numeric result.
|
|
825
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
826
|
+
*/
|
|
244
827
|
static calculator(options) {
|
|
245
828
|
return new calculator_1.CalculatorPrompt(options).run();
|
|
246
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* Emoji picker.
|
|
832
|
+
* @example
|
|
833
|
+
* const mood = await MepCLI.emoji({
|
|
834
|
+
* message: 'How are you feeling?',
|
|
835
|
+
* emojis: [
|
|
836
|
+
* { name: 'Happy', char: '😀' },
|
|
837
|
+
* { name: 'Sad', char: '😢' }
|
|
838
|
+
* ]
|
|
839
|
+
* });
|
|
840
|
+
* @param options - List of emojis and recent history.
|
|
841
|
+
* @returns A promise resolving to the selected emoji name/char.
|
|
842
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
843
|
+
*/
|
|
247
844
|
static emoji(options) {
|
|
248
845
|
return new emoji_1.EmojiPrompt(options).run();
|
|
249
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* Match/Connect items from two lists.
|
|
849
|
+
* @example
|
|
850
|
+
* const pairs = await MepCLI.match({
|
|
851
|
+
* message: 'Match Capital to Country',
|
|
852
|
+
* source: ['Paris', 'London'],
|
|
853
|
+
* target: ['France', 'UK']
|
|
854
|
+
* });
|
|
855
|
+
* @param options - Source and Target lists.
|
|
856
|
+
* @returns A promise resolving to linked pairs.
|
|
857
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
858
|
+
*/
|
|
250
859
|
static match(options) {
|
|
251
860
|
return new match_1.MatchPrompt(options).run();
|
|
252
861
|
}
|
|
862
|
+
/**
|
|
863
|
+
* Git-style diff viewer.
|
|
864
|
+
* @example
|
|
865
|
+
* await MepCLI.diff({
|
|
866
|
+
* message: 'Review changes',
|
|
867
|
+
* original: 'foo\nbar',
|
|
868
|
+
* modified: 'foo\nbaz'
|
|
869
|
+
* });
|
|
870
|
+
* @param options - Original and Modified strings.
|
|
871
|
+
* @returns A promise resolving to a confirmation string.
|
|
872
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
873
|
+
*/
|
|
253
874
|
static diff(options) {
|
|
254
875
|
return new diff_1.DiffPrompt(options).run();
|
|
255
876
|
}
|
|
877
|
+
/**
|
|
878
|
+
* Rotary dial input.
|
|
879
|
+
* @example
|
|
880
|
+
* const volume = await MepCLI.dial({
|
|
881
|
+
* message: 'Adjust Volume',
|
|
882
|
+
* min: 0,
|
|
883
|
+
* max: 100
|
|
884
|
+
* });
|
|
885
|
+
* @param options - Range and radius.
|
|
886
|
+
* @returns A promise resolving to the number.
|
|
887
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
888
|
+
*/
|
|
256
889
|
static dial(options) {
|
|
257
890
|
return new dial_1.DialPrompt(options).run();
|
|
258
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* Canvas drawing input.
|
|
894
|
+
* @example
|
|
895
|
+
* const art = await MepCLI.draw({
|
|
896
|
+
* message: 'Draw your signature',
|
|
897
|
+
* width: 20,
|
|
898
|
+
* height: 10
|
|
899
|
+
* });
|
|
900
|
+
* @param options - Canvas dimensions and export type.
|
|
901
|
+
* @returns A promise resolving to the raw matrix or text.
|
|
902
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
903
|
+
*/
|
|
259
904
|
static draw(options) {
|
|
260
905
|
return new draw_1.DrawPrompt(options).run();
|
|
261
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* Multi-column selection (Grid layout).
|
|
909
|
+
* @example
|
|
910
|
+
* const choice = await MepCLI.multiColumnSelect({
|
|
911
|
+
* message: 'Pick an option',
|
|
912
|
+
* choices: [
|
|
913
|
+
* { title: 'Option 1', value: 1 },
|
|
914
|
+
* { title: 'Option 2', value: 2 },
|
|
915
|
+
* { title: 'Option 3', value: 3 }
|
|
916
|
+
* ],
|
|
917
|
+
* cols: 3
|
|
918
|
+
* });
|
|
919
|
+
* @param options - Choices and column count.
|
|
920
|
+
* @returns A promise resolving to the selected value.
|
|
921
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
922
|
+
*/
|
|
262
923
|
static multiColumnSelect(options) {
|
|
263
924
|
return new multi_column_select_1.MultiColumnSelectPrompt(options).run();
|
|
264
925
|
}
|
|
926
|
+
/**
|
|
927
|
+
* Fuzzy search selection.
|
|
928
|
+
* @example
|
|
929
|
+
* const pkg = await MepCLI.fuzzySelect({
|
|
930
|
+
* message: 'Search package',
|
|
931
|
+
* choices: [
|
|
932
|
+
* { title: 'react', value: 'react' },
|
|
933
|
+
* { title: 'react-dom', value: 'react-dom' }
|
|
934
|
+
* ]
|
|
935
|
+
* });
|
|
936
|
+
* @param options - Choices to fuzzy search against.
|
|
937
|
+
* @returns A promise resolving to the selected value.
|
|
938
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/selection-prompts.ts}
|
|
939
|
+
*/
|
|
265
940
|
static fuzzySelect(options) {
|
|
266
941
|
return new fuzzy_1.FuzzySelectPrompt(options).run();
|
|
267
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* Miller Columns (Cascading lists).
|
|
945
|
+
* @example
|
|
946
|
+
* const path = await MepCLI.miller({
|
|
947
|
+
* message: 'Navigate file structure',
|
|
948
|
+
* data: [
|
|
949
|
+
* { title: 'src', value: 'src', children: [...] }
|
|
950
|
+
* ]
|
|
951
|
+
* });
|
|
952
|
+
* @param options - Hierarchical data and separator.
|
|
953
|
+
* @returns A promise resolving to the selected path array.
|
|
954
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
955
|
+
*/
|
|
268
956
|
static miller(options) {
|
|
269
957
|
return new miller_1.MillerPrompt(options).run();
|
|
270
958
|
}
|
|
959
|
+
/**
|
|
960
|
+
* Pattern Lock (Android style).
|
|
961
|
+
* @example
|
|
962
|
+
* const pattern = await MepCLI.pattern({
|
|
963
|
+
* message: 'Draw unlock pattern',
|
|
964
|
+
* rows: 3,
|
|
965
|
+
* cols: 3
|
|
966
|
+
* });
|
|
967
|
+
* @param options - Grid dimensions.
|
|
968
|
+
* @returns A promise resolving to an array of point indices.
|
|
969
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
970
|
+
*/
|
|
271
971
|
static pattern(options) {
|
|
272
972
|
return new pattern_1.PatternPrompt(options).run();
|
|
273
973
|
}
|
|
974
|
+
/**
|
|
975
|
+
* Region/Map Selector (ASCII Art).
|
|
976
|
+
* @example
|
|
977
|
+
* const zone = await MepCLI.region({
|
|
978
|
+
* message: 'Select Server Region',
|
|
979
|
+
* mapArt: `...ascii map...`,
|
|
980
|
+
* regions: [
|
|
981
|
+
* { id: 'us-east', label: 'US East', x: 10, y: 5 }
|
|
982
|
+
* ]
|
|
983
|
+
* });
|
|
984
|
+
* @param options - ASCII map string and interactive points.
|
|
985
|
+
* @returns A promise resolving to the selected region ID.
|
|
986
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/map-prompt.ts}
|
|
987
|
+
*/
|
|
274
988
|
static region(options) {
|
|
275
989
|
return new region_1.RegionPrompt(options).run();
|
|
276
990
|
}
|
|
991
|
+
/**
|
|
992
|
+
* Spreadsheet/Grid Editor.
|
|
993
|
+
* @example
|
|
994
|
+
* const data = await MepCLI.spreadsheet({
|
|
995
|
+
* message: 'Edit CSV Data',
|
|
996
|
+
* columns: [{ name: 'Name', key: 'name' }, { name: 'Age', key: 'age' }],
|
|
997
|
+
* data: [{ name: 'Alice', age: 25 }]
|
|
998
|
+
* });
|
|
999
|
+
* @param options - Column definitions and initial data rows.
|
|
1000
|
+
* @returns A promise resolving to the modified data array.
|
|
1001
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1002
|
+
*/
|
|
277
1003
|
static spreadsheet(options) {
|
|
278
1004
|
return new spreadsheet_1.SpreadsheetPrompt(options).run();
|
|
279
1005
|
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Text Scroller (EULA/Terms).
|
|
1008
|
+
* @example
|
|
1009
|
+
* const accepted = await MepCLI.scroll({
|
|
1010
|
+
* message: 'Read Terms & Conditions',
|
|
1011
|
+
* content: 'Long text here...',
|
|
1012
|
+
* requireScrollToBottom: true
|
|
1013
|
+
* });
|
|
1014
|
+
* @param options - Text content and scroll enforcement.
|
|
1015
|
+
* @returns A promise resolving to a boolean (accepted).
|
|
1016
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1017
|
+
*/
|
|
280
1018
|
static scroll(options) {
|
|
281
1019
|
return new scroll_1.ScrollPrompt(options).run();
|
|
282
1020
|
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Breadcrumb navigation.
|
|
1023
|
+
* @example
|
|
1024
|
+
* const path = await MepCLI.breadcrumb({
|
|
1025
|
+
* message: 'Navigate',
|
|
1026
|
+
* root: 'Home'
|
|
1027
|
+
* });
|
|
1028
|
+
* @param options - Initial path and separator.
|
|
1029
|
+
* @returns A promise resolving to the final path string.
|
|
1030
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/breadcrumb-search-prompt.ts}
|
|
1031
|
+
*/
|
|
283
1032
|
static breadcrumb(options) {
|
|
284
1033
|
return new breadcrumb_1.BreadcrumbPrompt(options).run();
|
|
285
1034
|
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Schedule Planner (Gantt-like).
|
|
1037
|
+
* @example
|
|
1038
|
+
* const tasks = await MepCLI.schedule({
|
|
1039
|
+
* message: 'Plan your day',
|
|
1040
|
+
* data: [
|
|
1041
|
+
* { name: 'Meeting', start: new Date(), end: new Date() }
|
|
1042
|
+
* ]
|
|
1043
|
+
* });
|
|
1044
|
+
* @param options - List of scheduled tasks.
|
|
1045
|
+
* @returns A promise resolving to the modified task list.
|
|
1046
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/schedule-prompt.ts}
|
|
1047
|
+
*/
|
|
286
1048
|
static schedule(options) {
|
|
287
1049
|
return new schedule_1.SchedulePrompt(options).run();
|
|
288
1050
|
}
|
|
1051
|
+
/**
|
|
1052
|
+
* JSON Data Inspector.
|
|
1053
|
+
* @example
|
|
1054
|
+
* await MepCLI.inspector({
|
|
1055
|
+
* message: 'Inspect Response',
|
|
1056
|
+
* data: { user: { id: 1, name: 'Alice' } }
|
|
1057
|
+
* });
|
|
1058
|
+
* @param options - Data object to explore.
|
|
1059
|
+
* @returns A promise resolving to the viewed data.
|
|
1060
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1061
|
+
*/
|
|
289
1062
|
static inspector(options) {
|
|
290
1063
|
return new data_inspector_1.DataInspectorPrompt(options).run();
|
|
291
1064
|
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Execute shell command with output streaming.
|
|
1067
|
+
* @experimental
|
|
1068
|
+
* @example
|
|
1069
|
+
* await MepCLI.exec({
|
|
1070
|
+
* message: 'Running build...',
|
|
1071
|
+
* command: 'npm run build'
|
|
1072
|
+
* });
|
|
1073
|
+
* @param options - Command string and streaming preferences.
|
|
1074
|
+
* @returns A promise resolving when execution completes.
|
|
1075
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/exec-prompt.ts}
|
|
1076
|
+
*/
|
|
292
1077
|
static exec(options) {
|
|
293
1078
|
return new exec_1.ExecPrompt(options).run();
|
|
294
1079
|
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Keyboard Shortcut recorder.
|
|
1082
|
+
* @example
|
|
1083
|
+
* const shortcut = await MepCLI.shortcut({
|
|
1084
|
+
* message: 'Press a key combination'
|
|
1085
|
+
* });
|
|
1086
|
+
* // Returns: { name: 'c', ctrl: true, shift: false, ... }
|
|
1087
|
+
* @param options - Initial value.
|
|
1088
|
+
* @returns A promise resolving to the captured key event.
|
|
1089
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1090
|
+
*/
|
|
295
1091
|
static shortcut(options) {
|
|
296
1092
|
return new shortcut_1.ShortcutPrompt(options).run();
|
|
297
1093
|
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Seat Booking/Reservation selector.
|
|
1096
|
+
* @example
|
|
1097
|
+
* const seats = await MepCLI.seat({
|
|
1098
|
+
* message: 'Choose seats',
|
|
1099
|
+
* layout: [
|
|
1100
|
+
* 'aa_aa',
|
|
1101
|
+
* 'bb_bb'
|
|
1102
|
+
* ],
|
|
1103
|
+
* rows: ['A', 'B'],
|
|
1104
|
+
* cols: ['1', '2', '', '3', '4']
|
|
1105
|
+
* });
|
|
1106
|
+
* @param options - Layout string array and labelling.
|
|
1107
|
+
* @returns A promise resolving to selected seat IDs.
|
|
1108
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1109
|
+
*/
|
|
298
1110
|
static seat(options) {
|
|
299
1111
|
return new seat_1.SeatPrompt(options).run();
|
|
300
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Range selection within a list (Shift+Click style).
|
|
1115
|
+
* @example
|
|
1116
|
+
* const chunk = await MepCLI.selectRange({
|
|
1117
|
+
* message: 'Select commits to squash',
|
|
1118
|
+
* choices: [
|
|
1119
|
+
* { title: 'feat: A', value: 'a' },
|
|
1120
|
+
* { title: 'fix: B', value: 'b' },
|
|
1121
|
+
* { title: 'chore: C', value: 'c' }
|
|
1122
|
+
* ]
|
|
1123
|
+
* });
|
|
1124
|
+
* @param options - Choices list.
|
|
1125
|
+
* @returns A promise resolving to the sub-array of values.
|
|
1126
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1127
|
+
*/
|
|
301
1128
|
static selectRange(options) {
|
|
302
1129
|
return new select_range_1.SelectRangePrompt(options).run();
|
|
303
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* 2D Grid Sorting.
|
|
1133
|
+
* @example
|
|
1134
|
+
* const layout = await MepCLI.sortGrid({
|
|
1135
|
+
* message: 'Arrange Dashboard Widgets',
|
|
1136
|
+
* data: [
|
|
1137
|
+
* ['Clock', 'Weather'],
|
|
1138
|
+
* ['News', 'Calendar']
|
|
1139
|
+
* ]
|
|
1140
|
+
* });
|
|
1141
|
+
* @param options - 2D array of strings.
|
|
1142
|
+
* @returns A promise resolving to the reordered 2D array.
|
|
1143
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/example.ts}
|
|
1144
|
+
*/
|
|
304
1145
|
static sortGrid(options) {
|
|
305
1146
|
return new sort_grid_1.SortGridPrompt(options).run();
|
|
306
1147
|
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Dependency Management (Resolves conflicts/requirements).
|
|
1150
|
+
* @example
|
|
1151
|
+
* const plugins = await MepCLI.dependency({
|
|
1152
|
+
* message: 'Install Plugins',
|
|
1153
|
+
* choices: [
|
|
1154
|
+
* { title: 'Plugin A', value: 'a' },
|
|
1155
|
+
* { title: 'Plugin B (Requires A)', value: 'b', dependsOn: ['a'] }
|
|
1156
|
+
* ]
|
|
1157
|
+
* });
|
|
1158
|
+
* @param options - Choices with dependency rules.
|
|
1159
|
+
* @returns A promise resolving to the valid set of selections.
|
|
1160
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/dependency-prompts.ts}
|
|
1161
|
+
*/
|
|
307
1162
|
static dependency(options) {
|
|
308
1163
|
return new dependency_1.DependencyPrompt(options).run();
|
|
309
1164
|
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Open Source License selector.
|
|
1167
|
+
* @example
|
|
1168
|
+
* const license = await MepCLI.license({
|
|
1169
|
+
* message: 'Choose a license'
|
|
1170
|
+
* });
|
|
1171
|
+
* @param options - Default license.
|
|
1172
|
+
* @returns A promise resolving to the SPDX ID.
|
|
1173
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/license-prompts.ts}
|
|
1174
|
+
*/
|
|
310
1175
|
static license(options) {
|
|
311
1176
|
return new license_1.LicensePrompt(options).run();
|
|
312
1177
|
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Regex Builder & Tester.
|
|
1180
|
+
* @example
|
|
1181
|
+
* const regex = await MepCLI.regex({
|
|
1182
|
+
* message: 'Create email regex',
|
|
1183
|
+
* tests: ['test@example.com', 'invalid-email']
|
|
1184
|
+
* });
|
|
1185
|
+
* @param options - Test cases to validate against.
|
|
1186
|
+
* @returns A promise resolving to the RegExp object.
|
|
1187
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/regex-prompt.ts}
|
|
1188
|
+
*/
|
|
313
1189
|
static regex(options) {
|
|
314
1190
|
return new regex_1.RegexPrompt(options).run();
|
|
315
1191
|
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Box Model Editor (CSS style).
|
|
1194
|
+
* @example
|
|
1195
|
+
* const margin = await MepCLI.box({
|
|
1196
|
+
* message: 'Set Margins',
|
|
1197
|
+
* initial: { top: 10, right: 20, bottom: 10, left: 20 }
|
|
1198
|
+
* });
|
|
1199
|
+
* @param options - Initial dimensions.
|
|
1200
|
+
* @returns A promise resolving to the box object.
|
|
1201
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/box-prompt.ts}
|
|
1202
|
+
*/
|
|
316
1203
|
static box(options) {
|
|
317
1204
|
return new box_1.BoxPrompt(options).run();
|
|
318
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Database Connection String Builder.
|
|
1208
|
+
* @example
|
|
1209
|
+
* const conn = await MepCLI.connectionString({
|
|
1210
|
+
* message: 'Configure Database',
|
|
1211
|
+
* initial: 'postgres://localhost:5432/mydb'
|
|
1212
|
+
* });
|
|
1213
|
+
* @param options - Initial URL.
|
|
1214
|
+
* @returns A promise resolving to parsed connection details.
|
|
1215
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/connection-string-prompt.ts}
|
|
1216
|
+
*/
|
|
319
1217
|
static connectionString(options) {
|
|
320
1218
|
return (0, connection_string_1.connectionString)(options);
|
|
321
1219
|
}
|
|
1220
|
+
/**
|
|
1221
|
+
* cURL Command Builder.
|
|
1222
|
+
* @example
|
|
1223
|
+
* const request = await MepCLI.curl({
|
|
1224
|
+
* message: 'Build API Request',
|
|
1225
|
+
* initial: 'curl -X POST https://api.example.com/v1/resource'
|
|
1226
|
+
* });
|
|
1227
|
+
* @param options - Initial command.
|
|
1228
|
+
* @returns A promise resolving to the parsed request object.
|
|
1229
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/curl-prompt.ts}
|
|
1230
|
+
*/
|
|
322
1231
|
static curl(options) {
|
|
323
1232
|
return new curl_1.CurlPrompt(options).run();
|
|
324
1233
|
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Phone Number input (with country codes).
|
|
1236
|
+
* @example
|
|
1237
|
+
* const phone = await MepCLI.phone({
|
|
1238
|
+
* message: 'Enter phone number',
|
|
1239
|
+
* defaultCountry: 'US'
|
|
1240
|
+
* });
|
|
1241
|
+
* @param options - Default country ISO code.
|
|
1242
|
+
* @returns A promise resolving to the formatted number.
|
|
1243
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/phone-prompt.ts}
|
|
1244
|
+
*/
|
|
325
1245
|
static phone(options) {
|
|
326
1246
|
return new phone_1.PhonePrompt(options).run();
|
|
327
1247
|
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Fuzzy Multi-Column Selection.
|
|
1250
|
+
* @example
|
|
1251
|
+
* const user = await MepCLI.fuzzyMultiColumn({
|
|
1252
|
+
* message: 'Select User',
|
|
1253
|
+
* choices: [
|
|
1254
|
+
* { title: 'Alice', value: 1, description: 'Admin' },
|
|
1255
|
+
* { title: 'Bob', value: 2, description: 'User' }
|
|
1256
|
+
* ],
|
|
1257
|
+
* cols: 2
|
|
1258
|
+
* });
|
|
1259
|
+
* @param options - Choices and layout columns.
|
|
1260
|
+
* @returns A promise resolving to the selected value.
|
|
1261
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/fuzzy-multi-column-prompt.ts}
|
|
1262
|
+
*/
|
|
328
1263
|
static fuzzyMultiColumn(options) {
|
|
329
1264
|
return new fuzzy_multi_column_1.FuzzyMultiColumnPrompt(options).run();
|
|
330
1265
|
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Multi-Range Selection (Discontinuous).
|
|
1268
|
+
* @example
|
|
1269
|
+
* const ranges = await MepCLI.multiRange({
|
|
1270
|
+
* message: 'Select lines to delete',
|
|
1271
|
+
* choices: lines.map((l, i) => ({ title: l, value: i }))
|
|
1272
|
+
* });
|
|
1273
|
+
* @param options - Choices.
|
|
1274
|
+
* @returns A promise resolving to selected values.
|
|
1275
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/multi-range-prompt.ts}
|
|
1276
|
+
*/
|
|
331
1277
|
static multiRange(options) {
|
|
332
1278
|
return new multi_range_1.MultiRangePrompt(options).run();
|
|
333
1279
|
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Breadcrumb Search (Navigator + Fuzzy Search).
|
|
1282
|
+
* @example
|
|
1283
|
+
* const file = await MepCLI.breadcrumbSearch({
|
|
1284
|
+
* message: 'Find file',
|
|
1285
|
+
* root: 'src'
|
|
1286
|
+
* });
|
|
1287
|
+
* @param options - Root path.
|
|
1288
|
+
* @returns A promise resolving to the selected path.
|
|
1289
|
+
* @see {@link https://github.com/CodeTease/mep/blob/main/examples/breadcrumb-search-prompt.ts}
|
|
1290
|
+
*/
|
|
334
1291
|
static breadcrumbSearch(options) {
|
|
335
1292
|
return new breadcrumb_search_1.BreadcrumbSearchPrompt(options).run();
|
|
336
1293
|
}
|