mepcli 0.6.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +512 -326
  3. package/dist/ansi.d.ts +8 -0
  4. package/dist/ansi.js +8 -0
  5. package/dist/base.d.ts +21 -0
  6. package/dist/base.js +57 -0
  7. package/dist/core.d.ts +48 -1
  8. package/dist/core.js +156 -0
  9. package/dist/data/licenses.d.ts +2 -0
  10. package/dist/data/licenses.js +109 -0
  11. package/dist/highlight.js +58 -26
  12. package/dist/index.d.ts +36 -0
  13. package/dist/index.js +36 -0
  14. package/dist/input.js +0 -3
  15. package/dist/prompts/box.d.ts +21 -0
  16. package/dist/prompts/box.js +192 -0
  17. package/dist/prompts/breadcrumb.d.ts +22 -0
  18. package/dist/prompts/breadcrumb.js +302 -0
  19. package/dist/prompts/byte.d.ts +13 -0
  20. package/dist/prompts/byte.js +159 -0
  21. package/dist/prompts/calculator.d.ts +16 -0
  22. package/dist/prompts/calculator.js +213 -0
  23. package/dist/prompts/calendar.js +0 -5
  24. package/dist/prompts/code.d.ts +2 -0
  25. package/dist/prompts/code.js +104 -70
  26. package/dist/prompts/connection-string.d.ts +18 -0
  27. package/dist/prompts/connection-string.js +97 -0
  28. package/dist/prompts/curl.d.ts +39 -0
  29. package/dist/prompts/curl.js +285 -0
  30. package/dist/prompts/data-inspector.d.ts +22 -0
  31. package/dist/prompts/data-inspector.js +256 -0
  32. package/dist/prompts/dependency.d.ts +16 -0
  33. package/dist/prompts/dependency.js +265 -0
  34. package/dist/prompts/dial.d.ts +10 -0
  35. package/dist/prompts/dial.js +110 -0
  36. package/dist/prompts/diff.d.ts +10 -0
  37. package/dist/prompts/diff.js +101 -0
  38. package/dist/prompts/draw.d.ts +20 -0
  39. package/dist/prompts/draw.js +188 -0
  40. package/dist/prompts/editor.js +0 -4
  41. package/dist/prompts/emoji.d.ts +18 -0
  42. package/dist/prompts/emoji.js +228 -0
  43. package/dist/prompts/exec.d.ts +13 -0
  44. package/dist/prompts/exec.js +83 -0
  45. package/dist/prompts/fuzzy.d.ts +12 -0
  46. package/dist/prompts/fuzzy.js +136 -0
  47. package/dist/prompts/gauge.d.ts +21 -0
  48. package/dist/prompts/gauge.js +130 -0
  49. package/dist/prompts/heatmap.d.ts +13 -0
  50. package/dist/prompts/heatmap.js +141 -0
  51. package/dist/prompts/ip.d.ts +11 -0
  52. package/dist/prompts/ip.js +118 -0
  53. package/dist/prompts/kanban.d.ts +17 -0
  54. package/dist/prompts/kanban.js +228 -0
  55. package/dist/prompts/keypress.js +0 -2
  56. package/dist/prompts/license.d.ts +9 -0
  57. package/dist/prompts/license.js +105 -0
  58. package/dist/prompts/map.d.ts +15 -0
  59. package/dist/prompts/map.js +199 -0
  60. package/dist/prompts/match.d.ts +19 -0
  61. package/dist/prompts/match.js +275 -0
  62. package/dist/prompts/miller.d.ts +15 -0
  63. package/dist/prompts/miller.js +221 -0
  64. package/dist/prompts/multi-column-select.d.ts +10 -0
  65. package/dist/prompts/multi-column-select.js +166 -0
  66. package/dist/prompts/number.js +0 -2
  67. package/dist/prompts/otp.d.ts +10 -0
  68. package/dist/prompts/otp.js +91 -0
  69. package/dist/prompts/pattern.d.ts +22 -0
  70. package/dist/prompts/pattern.js +249 -0
  71. package/dist/prompts/quiz-select.d.ts +10 -0
  72. package/dist/prompts/quiz-select.js +104 -0
  73. package/dist/prompts/quiz-text.d.ts +11 -0
  74. package/dist/prompts/quiz-text.js +82 -0
  75. package/dist/prompts/regex.d.ts +13 -0
  76. package/dist/prompts/regex.js +131 -0
  77. package/dist/prompts/region.d.ts +11 -0
  78. package/dist/prompts/region.js +164 -0
  79. package/dist/prompts/schedule.d.ts +18 -0
  80. package/dist/prompts/schedule.js +221 -0
  81. package/dist/prompts/scroll.d.ts +13 -0
  82. package/dist/prompts/scroll.js +152 -0
  83. package/dist/prompts/seat.d.ts +17 -0
  84. package/dist/prompts/seat.js +165 -0
  85. package/dist/prompts/select-range.d.ts +8 -0
  86. package/dist/prompts/select-range.js +136 -0
  87. package/dist/prompts/select.d.ts +9 -9
  88. package/dist/prompts/semver.d.ts +6 -0
  89. package/dist/prompts/semver.js +32 -0
  90. package/dist/prompts/shortcut.d.ts +9 -0
  91. package/dist/prompts/shortcut.js +135 -0
  92. package/dist/prompts/slot.d.ts +16 -0
  93. package/dist/prompts/slot.js +107 -0
  94. package/dist/prompts/snippet.js +0 -3
  95. package/dist/prompts/sort-grid.d.ts +16 -0
  96. package/dist/prompts/sort-grid.js +146 -0
  97. package/dist/prompts/sort.js +0 -1
  98. package/dist/prompts/spreadsheet.d.ts +21 -0
  99. package/dist/prompts/spreadsheet.js +239 -0
  100. package/dist/prompts/text.d.ts +9 -7
  101. package/dist/prompts/text.js +52 -0
  102. package/dist/prompts/time.d.ts +12 -0
  103. package/dist/prompts/time.js +202 -0
  104. package/dist/prompts/tree-select.d.ts +0 -1
  105. package/dist/prompts/tree-select.js +1 -5
  106. package/dist/symbols.d.ts +12 -0
  107. package/dist/symbols.js +14 -2
  108. package/dist/theme.js +10 -1
  109. package/dist/types.d.ts +264 -1
  110. package/dist/utils.d.ts +53 -0
  111. package/dist/utils.js +252 -0
  112. package/package.json +51 -47
  113. package/example.ts +0 -390
package/dist/ansi.d.ts CHANGED
@@ -15,6 +15,14 @@ export declare const ANSI: {
15
15
  FG_RED: string;
16
16
  FG_GRAY: string;
17
17
  FG_WHITE: string;
18
+ FG_BLUE: string;
19
+ FG_MAGENTA: string;
20
+ FG_BLACK: string;
21
+ BG_YELLOW: string;
22
+ BG_BLUE: string;
23
+ BG_CYAN: string;
24
+ BG_GREEN: string;
25
+ BG_RED: string;
18
26
  ERASE_LINE: string;
19
27
  ERASE_DOWN: string;
20
28
  CURSOR_LEFT: string;
package/dist/ansi.js CHANGED
@@ -19,6 +19,14 @@ exports.ANSI = {
19
19
  FG_RED: '\x1b[31m',
20
20
  FG_GRAY: '\x1b[90m',
21
21
  FG_WHITE: '\x1b[37m',
22
+ FG_BLUE: '\x1b[34m',
23
+ FG_MAGENTA: '\x1b[35m',
24
+ FG_BLACK: '\x1b[30m',
25
+ BG_YELLOW: '\x1b[43m',
26
+ BG_BLUE: '\x1b[44m',
27
+ BG_CYAN: '\x1b[46m',
28
+ BG_GREEN: '\x1b[42m',
29
+ BG_RED: '\x1b[41m',
22
30
  // Cursor & Erasing
23
31
  ERASE_LINE: '\x1b[2K', // Clear current line
24
32
  ERASE_DOWN: '\x1b[J', // Clear from cursor to end of screen
package/dist/base.d.ts CHANGED
@@ -14,17 +14,38 @@ export declare abstract class Prompt<T, O> {
14
14
  private _inputParser;
15
15
  private _onKeyHandler?;
16
16
  private _onDataHandler?;
17
+ private static warnedComponents;
17
18
  protected lastRenderLines: string[];
18
19
  protected lastRenderHeight: number;
19
20
  protected capabilities: ReturnType<typeof detectCapabilities>;
20
21
  constructor(options: O);
22
+ /**
23
+ * Checks if running on Windows and logs a warning message once per component type.
24
+ * Call this in the constructor of problematic prompts.
25
+ */
26
+ protected checkWindowsAttention(): void;
27
+ /**
28
+ * Warn about experimental prompts.
29
+ * Call this in the constructor of experimental prompts.
30
+ */
31
+ protected warnExperimental(): void;
21
32
  protected abstract render(firstRender: boolean): void;
22
33
  protected abstract handleInput(char: string, key: Buffer): void;
23
34
  protected handleMouse(_event: MouseEvent): void;
24
35
  protected print(text: string): void;
25
36
  run(): Promise<T>;
37
+ /**
38
+ * Pauses the input stream and removes listeners.
39
+ * Useful for yielding control to child processes.
40
+ */
41
+ protected pauseInput(): void;
42
+ /**
43
+ * Resumes the input stream and re-attaches listeners.
44
+ */
45
+ protected resumeInput(): void;
26
46
  protected cleanup(): void;
27
47
  protected submit(result: T): void;
48
+ protected cancel(reason: any): void;
28
49
  /**
29
50
  * Renders the frame using a linear scan diffing algorithm.
30
51
  * Prevents flicker and handles height changes (expand/collapse) robustly.
package/dist/base.js CHANGED
@@ -18,6 +18,31 @@ class Prompt {
18
18
  this._inputParser = new input_1.InputParser();
19
19
  this.capabilities = (0, utils_1.detectCapabilities)();
20
20
  }
21
+ /**
22
+ * Checks if running on Windows and logs a warning message once per component type.
23
+ * Call this in the constructor of problematic prompts.
24
+ */
25
+ checkWindowsAttention() {
26
+ const componentName = this.constructor.name;
27
+ // Check platform and if already warned
28
+ if (process.platform === 'win32' && !Prompt.warnedComponents.has(componentName)) {
29
+ console.warn(`${ansi_1.ANSI.FG_YELLOW}Warning:${ansi_1.ANSI.RESET} ${componentName} may hang on Windows TTY after multiple cycles. ` +
30
+ `Press 'Enter' if unresponsive.`);
31
+ Prompt.warnedComponents.add(componentName);
32
+ }
33
+ }
34
+ /**
35
+ * Warn about experimental prompts.
36
+ * Call this in the constructor of experimental prompts.
37
+ */
38
+ warnExperimental() {
39
+ const componentName = this.constructor.name;
40
+ if (!Prompt.warnedComponents.has(componentName)) {
41
+ console.warn(`${ansi_1.ANSI.FG_YELLOW}Warning:${ansi_1.ANSI.RESET} ${componentName} is an experimental prompt and may have bugs or unexpected behavior. ` +
42
+ `Use with caution.`);
43
+ Prompt.warnedComponents.add(componentName);
44
+ }
45
+ }
21
46
  handleMouse(_event) { }
22
47
  print(text) {
23
48
  this.stdout.write(text);
@@ -58,6 +83,31 @@ class Prompt {
58
83
  this.stdin.on('data', this._onDataHandler);
59
84
  });
60
85
  }
86
+ /**
87
+ * Pauses the input stream and removes listeners.
88
+ * Useful for yielding control to child processes.
89
+ */
90
+ pauseInput() {
91
+ if (this._onDataHandler) {
92
+ this.stdin.removeListener('data', this._onDataHandler);
93
+ }
94
+ if (typeof this.stdin.setRawMode === 'function') {
95
+ this.stdin.setRawMode(false);
96
+ }
97
+ this.stdin.pause();
98
+ }
99
+ /**
100
+ * Resumes the input stream and re-attaches listeners.
101
+ */
102
+ resumeInput() {
103
+ if (typeof this.stdin.setRawMode === 'function') {
104
+ this.stdin.setRawMode(true);
105
+ }
106
+ this.stdin.resume();
107
+ if (this._onDataHandler) {
108
+ this.stdin.on('data', this._onDataHandler);
109
+ }
110
+ }
61
111
  cleanup() {
62
112
  if (this._onDataHandler) {
63
113
  this.stdin.removeListener('data', this._onDataHandler);
@@ -78,6 +128,12 @@ class Prompt {
78
128
  if (this._resolve)
79
129
  this._resolve(result);
80
130
  }
131
+ cancel(reason) {
132
+ this.cleanup();
133
+ this.print('\n');
134
+ if (this._reject)
135
+ this._reject(reason);
136
+ }
81
137
  /**
82
138
  * Renders the frame using a linear scan diffing algorithm.
83
139
  * Prevents flicker and handles height changes (expand/collapse) robustly.
@@ -187,3 +243,4 @@ class Prompt {
187
243
  }
188
244
  }
189
245
  exports.Prompt = Prompt;
246
+ Prompt.warnedComponents = new Set();
package/dist/core.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import { TextOptions, SelectOptions, ConfirmOptions, CheckboxOptions, ThemeConfig, NumberOptions, ToggleOptions, ListOptions, SliderOptions, DateOptions, FileOptions, MultiSelectOptions, RatingOptions, AutocompleteOptions, SortOptions, TableOptions, EditorOptions, TreeOptions, KeypressOptions, FormOptions, SnippetOptions, SpamOptions, WaitOptions, CodeOptions, TreeSelectOptions, RangeOptions, TransferOptions, CronOptions, ColorOptions, GridOptions, CalendarOptions } from './types';
1
+ import { TextOptions, SelectOptions, ConfirmOptions, CheckboxOptions, ThemeConfig, NumberOptions, ToggleOptions, ListOptions, SliderOptions, DateOptions, FileOptions, MultiSelectOptions, RatingOptions, AutocompleteOptions, SortOptions, TableOptions, EditorOptions, TreeOptions, KeypressOptions, FormOptions, SnippetOptions, SpamOptions, WaitOptions, CodeOptions, TreeSelectOptions, RangeOptions, TransferOptions, CronOptions, ColorOptions, GridOptions, CalendarOptions, MapOptions, SemVerOptions, IPOptions, OTPOptions, QuizSelectOptions, QuizTextOptions, KanbanOptions, KanbanItem, TimeOptions, HeatmapOptions, ByteOptions, PatternOptions, RegionOptions, SpreadsheetOptions, SelectRangeOptions, SortGridOptions } from './types';
2
+ import { SlotOptions, GaugeOptions, CalculatorOptions, EmojiOptions, MatchOptions, DiffOptions, DialOptions, DrawOptions, MultiColumnSelectOptions, FuzzySelectOptions, MillerOptions, ScrollOptions, BreadcrumbOptions, ScheduleOptions, ScheduleTask, DataInspectorOptions, ExecOptions, ShortcutOptions, ShortcutResult, SeatOptions, DependencyOptions, LicenseOptions, RegexOptions, BoxOptions } from './types';
2
3
  import { Spinner } from './spinner';
4
+ import { ConnectionStringOptions, ConnectionStringResult } from './prompts/connection-string';
5
+ import { CurlOptions, CurlResult } from './prompts/curl';
3
6
  /**
4
7
  * Public Facade for MepCLI
5
8
  */
@@ -50,4 +53,48 @@ export declare class MepCLI {
50
53
  static color(options: ColorOptions): Promise<string>;
51
54
  static grid(options: GridOptions): Promise<boolean[][]>;
52
55
  static calendar(options: CalendarOptions): Promise<Date | [Date, Date]>;
56
+ static map(options: MapOptions): Promise<Record<string, string>>;
57
+ static semver(options: SemVerOptions): Promise<string>;
58
+ static ip(options: IPOptions): Promise<string>;
59
+ static otp(options: OTPOptions): Promise<string>;
60
+ static quizSelect<const V>(options: QuizSelectOptions<V>): Promise<V>;
61
+ static quizText(options: QuizTextOptions): Promise<string>;
62
+ static kanban<V extends KanbanItem>(options: KanbanOptions<V>): Promise<Record<string, V[]>>;
63
+ static time(options: TimeOptions): Promise<string>;
64
+ static heatmap(options: HeatmapOptions): Promise<number[][]>;
65
+ static byte(options: ByteOptions): Promise<number>;
66
+ static slot(options: SlotOptions): Promise<string>;
67
+ static gauge(options: GaugeOptions): Promise<string>;
68
+ static calculator(options: CalculatorOptions): Promise<number>;
69
+ static emoji(options: EmojiOptions): Promise<string>;
70
+ static match(options: MatchOptions): Promise<Record<string, any[]>>;
71
+ static diff(options: DiffOptions): Promise<string>;
72
+ static dial(options: DialOptions): Promise<number>;
73
+ static draw(options: DrawOptions): Promise<string | boolean[][]>;
74
+ static multiColumnSelect<V>(options: MultiColumnSelectOptions<V>): Promise<V>;
75
+ static fuzzySelect<V>(options: FuzzySelectOptions<V>): Promise<V>;
76
+ static miller<V>(options: MillerOptions<V>): Promise<V[]>;
77
+ static pattern(options: PatternOptions): Promise<number[]>;
78
+ static region(options: RegionOptions): Promise<string>;
79
+ static spreadsheet(options: SpreadsheetOptions): Promise<Record<string, any>[]>;
80
+ static scroll(options: ScrollOptions): Promise<boolean>;
81
+ static breadcrumb(options: BreadcrumbOptions): Promise<string>;
82
+ static schedule(options: ScheduleOptions): Promise<ScheduleTask[]>;
83
+ static inspector(options: DataInspectorOptions): Promise<any>;
84
+ static exec(options: ExecOptions): Promise<void>;
85
+ static shortcut(options: ShortcutOptions): Promise<ShortcutResult>;
86
+ static seat(options: SeatOptions): Promise<string[]>;
87
+ static selectRange<const V>(options: SelectRangeOptions<V>): Promise<V[]>;
88
+ static sortGrid(options: SortGridOptions): Promise<string[][]>;
89
+ static dependency<V>(options: DependencyOptions<V>): Promise<V[]>;
90
+ static license(options: LicenseOptions): Promise<string>;
91
+ static regex(options: RegexOptions): Promise<RegExp>;
92
+ static box(options: BoxOptions): Promise<{
93
+ top: number;
94
+ right: number;
95
+ bottom: number;
96
+ left: number;
97
+ }>;
98
+ static connectionString(options: ConnectionStringOptions): Promise<ConnectionStringResult>;
99
+ static curl(options: CurlOptions): Promise<CurlResult>;
53
100
  }
package/dist/core.js CHANGED
@@ -33,6 +33,45 @@ const tree_select_1 = require("./prompts/tree-select");
33
33
  const color_1 = require("./prompts/color");
34
34
  const grid_1 = require("./prompts/grid");
35
35
  const calendar_1 = require("./prompts/calendar");
36
+ const map_1 = require("./prompts/map");
37
+ const semver_1 = require("./prompts/semver");
38
+ const ip_1 = require("./prompts/ip");
39
+ const otp_1 = require("./prompts/otp");
40
+ const quiz_select_1 = require("./prompts/quiz-select");
41
+ const quiz_text_1 = require("./prompts/quiz-text");
42
+ const kanban_1 = require("./prompts/kanban");
43
+ const time_1 = require("./prompts/time");
44
+ const heatmap_1 = require("./prompts/heatmap");
45
+ const byte_1 = require("./prompts/byte");
46
+ const slot_1 = require("./prompts/slot");
47
+ const gauge_1 = require("./prompts/gauge");
48
+ const calculator_1 = require("./prompts/calculator");
49
+ const emoji_1 = require("./prompts/emoji");
50
+ const match_1 = require("./prompts/match");
51
+ const diff_1 = require("./prompts/diff");
52
+ const dial_1 = require("./prompts/dial");
53
+ const draw_1 = require("./prompts/draw");
54
+ const multi_column_select_1 = require("./prompts/multi-column-select");
55
+ const fuzzy_1 = require("./prompts/fuzzy");
56
+ const miller_1 = require("./prompts/miller");
57
+ const pattern_1 = require("./prompts/pattern");
58
+ const region_1 = require("./prompts/region");
59
+ const spreadsheet_1 = require("./prompts/spreadsheet");
60
+ const scroll_1 = require("./prompts/scroll");
61
+ const breadcrumb_1 = require("./prompts/breadcrumb");
62
+ const schedule_1 = require("./prompts/schedule");
63
+ const data_inspector_1 = require("./prompts/data-inspector");
64
+ const exec_1 = require("./prompts/exec");
65
+ const shortcut_1 = require("./prompts/shortcut");
66
+ const seat_1 = require("./prompts/seat");
67
+ const select_range_1 = require("./prompts/select-range");
68
+ const sort_grid_1 = require("./prompts/sort-grid");
69
+ const dependency_1 = require("./prompts/dependency");
70
+ const license_1 = require("./prompts/license");
71
+ const regex_1 = require("./prompts/regex");
72
+ const box_1 = require("./prompts/box");
73
+ const connection_string_1 = require("./prompts/connection-string");
74
+ const curl_1 = require("./prompts/curl");
36
75
  /**
37
76
  * Public Facade for MepCLI
38
77
  */
@@ -148,6 +187,123 @@ class MepCLI {
148
187
  static calendar(options) {
149
188
  return new calendar_1.CalendarPrompt(options).run();
150
189
  }
190
+ static map(options) {
191
+ return new map_1.MapPrompt(options).run();
192
+ }
193
+ static semver(options) {
194
+ return new semver_1.SemVerPrompt(options).run();
195
+ }
196
+ static ip(options) {
197
+ return new ip_1.IPPrompt(options).run();
198
+ }
199
+ static otp(options) {
200
+ return new otp_1.OTPPrompt(options).run();
201
+ }
202
+ static quizSelect(options) {
203
+ return new quiz_select_1.QuizSelectPrompt(options).run();
204
+ }
205
+ static quizText(options) {
206
+ return new quiz_text_1.QuizTextPrompt(options).run();
207
+ }
208
+ static kanban(options) {
209
+ return new kanban_1.KanbanPrompt(options).run();
210
+ }
211
+ static time(options) {
212
+ return new time_1.TimePrompt(options).run();
213
+ }
214
+ static heatmap(options) {
215
+ return new heatmap_1.HeatmapPrompt(options).run();
216
+ }
217
+ static byte(options) {
218
+ return new byte_1.BytePrompt(options).run();
219
+ }
220
+ static slot(options) {
221
+ return new slot_1.SlotPrompt(options).run();
222
+ }
223
+ static gauge(options) {
224
+ return new gauge_1.GaugePrompt(options).run();
225
+ }
226
+ static calculator(options) {
227
+ return new calculator_1.CalculatorPrompt(options).run();
228
+ }
229
+ static emoji(options) {
230
+ return new emoji_1.EmojiPrompt(options).run();
231
+ }
232
+ static match(options) {
233
+ return new match_1.MatchPrompt(options).run();
234
+ }
235
+ static diff(options) {
236
+ return new diff_1.DiffPrompt(options).run();
237
+ }
238
+ static dial(options) {
239
+ return new dial_1.DialPrompt(options).run();
240
+ }
241
+ static draw(options) {
242
+ return new draw_1.DrawPrompt(options).run();
243
+ }
244
+ static multiColumnSelect(options) {
245
+ return new multi_column_select_1.MultiColumnSelectPrompt(options).run();
246
+ }
247
+ static fuzzySelect(options) {
248
+ return new fuzzy_1.FuzzySelectPrompt(options).run();
249
+ }
250
+ static miller(options) {
251
+ return new miller_1.MillerPrompt(options).run();
252
+ }
253
+ static pattern(options) {
254
+ return new pattern_1.PatternPrompt(options).run();
255
+ }
256
+ static region(options) {
257
+ return new region_1.RegionPrompt(options).run();
258
+ }
259
+ static spreadsheet(options) {
260
+ return new spreadsheet_1.SpreadsheetPrompt(options).run();
261
+ }
262
+ static scroll(options) {
263
+ return new scroll_1.ScrollPrompt(options).run();
264
+ }
265
+ static breadcrumb(options) {
266
+ return new breadcrumb_1.BreadcrumbPrompt(options).run();
267
+ }
268
+ static schedule(options) {
269
+ return new schedule_1.SchedulePrompt(options).run();
270
+ }
271
+ static inspector(options) {
272
+ return new data_inspector_1.DataInspectorPrompt(options).run();
273
+ }
274
+ static exec(options) {
275
+ return new exec_1.ExecPrompt(options).run();
276
+ }
277
+ static shortcut(options) {
278
+ return new shortcut_1.ShortcutPrompt(options).run();
279
+ }
280
+ static seat(options) {
281
+ return new seat_1.SeatPrompt(options).run();
282
+ }
283
+ static selectRange(options) {
284
+ return new select_range_1.SelectRangePrompt(options).run();
285
+ }
286
+ static sortGrid(options) {
287
+ return new sort_grid_1.SortGridPrompt(options).run();
288
+ }
289
+ static dependency(options) {
290
+ return new dependency_1.DependencyPrompt(options).run();
291
+ }
292
+ static license(options) {
293
+ return new license_1.LicensePrompt(options).run();
294
+ }
295
+ static regex(options) {
296
+ return new regex_1.RegexPrompt(options).run();
297
+ }
298
+ static box(options) {
299
+ return new box_1.BoxPrompt(options).run();
300
+ }
301
+ static connectionString(options) {
302
+ return (0, connection_string_1.connectionString)(options);
303
+ }
304
+ static curl(options) {
305
+ return new curl_1.CurlPrompt(options).run();
306
+ }
151
307
  }
152
308
  exports.MepCLI = MepCLI;
153
309
  MepCLI.theme = theme_1.theme;
@@ -0,0 +1,2 @@
1
+ import { License } from '../types';
2
+ export declare const POPULAR_LICENSES: License[];
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.POPULAR_LICENSES = void 0;
4
+ exports.POPULAR_LICENSES = [
5
+ {
6
+ id: 'MIT',
7
+ name: 'MIT License',
8
+ description: 'A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.',
9
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
10
+ conditions: ['License and copyright notice'],
11
+ limitations: ['Liability', 'Warranty']
12
+ },
13
+ {
14
+ id: 'Apache-2.0',
15
+ name: 'Apache License 2.0',
16
+ description: 'A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms.',
17
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Patent use', 'Private use'],
18
+ conditions: ['License and copyright notice', 'State changes'],
19
+ limitations: ['Liability', 'Warranty', 'Trademark use']
20
+ },
21
+ {
22
+ id: 'GPL-3.0',
23
+ name: 'GNU General Public License v3.0',
24
+ description: 'Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved.',
25
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Patent use', 'Private use'],
26
+ conditions: ['Disclose source', 'License and copyright notice', 'Same license', 'State changes'],
27
+ limitations: ['Liability', 'Warranty']
28
+ },
29
+ {
30
+ id: 'BSD-3-Clause',
31
+ name: 'BSD 3-Clause "New" or "Revised" License',
32
+ description: 'A permissive license similar to the BSD 2-Clause License, but with a 3rd clause that prohibits others from using the name of the project or its contributors to promote derived products without written consent.',
33
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
34
+ conditions: ['License and copyright notice'],
35
+ limitations: ['Liability', 'Warranty']
36
+ },
37
+ {
38
+ id: 'ISC',
39
+ name: 'ISC License',
40
+ description: 'A permissive license that is functionally equivalent to the BSD 2-Clause and MIT licenses, but removing some language that is no longer necessary.',
41
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
42
+ conditions: ['License and copyright notice'],
43
+ limitations: ['Liability', 'Warranty']
44
+ },
45
+ {
46
+ id: 'Unlicense',
47
+ name: 'The Unlicense',
48
+ description: 'A license with no conditions whatsoever which dedicates works to the public domain. Unlicensed works, modifications, and larger works may be distributed under different terms and without source code.',
49
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
50
+ conditions: [],
51
+ limitations: ['Liability', 'Warranty']
52
+ },
53
+ {
54
+ id: 'BSD-2-Clause',
55
+ name: 'BSD 2-Clause "Simplified" License',
56
+ description: 'A permissive license that is similar to the MIT License, with conditions requiring preservation of copyright and license notices.',
57
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
58
+ conditions: ['License and copyright notice'],
59
+ limitations: ['Liability', 'Warranty']
60
+ },
61
+ {
62
+ id: 'LGPL-3.0',
63
+ name: 'GNU Lesser General Public License v3.0',
64
+ description: 'A weak copyleft license permitting proprietary use. Requires preservation of copyright and license notices. Modifications of the library under the same license must be provided under the LGPL, but applications built on top may be licensed proprietary.',
65
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Patent use', 'Private use'],
66
+ conditions: ['Disclose source', 'License and copyright notice', 'Same license', 'State changes'],
67
+ limitations: ['Liability', 'Warranty']
68
+ },
69
+ {
70
+ id: 'AGPL-3.0',
71
+ name: 'GNU Affero General Public License v3.0',
72
+ description: 'A strong copyleft license that requires releasing source code when distributing the software over a network. Includes all conditions of GPL-3.0 plus a network use clause.',
73
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Patent use', 'Private use'],
74
+ conditions: ['Disclose source', 'License and copyright notice', 'Network use disclosure', 'Same license', 'State changes'],
75
+ limitations: ['Liability', 'Warranty']
76
+ },
77
+ {
78
+ id: 'MPL-2.0',
79
+ name: 'Mozilla Public License 2.0',
80
+ description: 'A copyleft license that is easy to comply with. You must make the source code for any of your modifications available under MPL-2.0, but you can combine the software with code under other licenses.',
81
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Patent use', 'Private use'],
82
+ conditions: ['Disclose source', 'License and copyright notice', 'Same license'],
83
+ limitations: ['Liability', 'Warranty', 'Trademark use']
84
+ },
85
+ {
86
+ id: 'EPL-2.0',
87
+ name: 'Eclipse Public License 2.0',
88
+ description: 'A copyleft license based on the Mozilla Public License, designed for programs and libraries. Modified code under the same license must be provided.',
89
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Patent use', 'Private use'],
90
+ conditions: ['Disclose source', 'License and copyright notice', 'Same license'],
91
+ limitations: ['Liability', 'Warranty']
92
+ },
93
+ {
94
+ id: 'CC0-1.0',
95
+ name: 'Creative Commons Zero v1.0 Universal',
96
+ description: 'A public domain dedication waiver that places works in the public domain. A work released under CC0 incurs no obligations and anyone may use the work in any way.',
97
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
98
+ conditions: [],
99
+ limitations: ['Liability', 'Warranty']
100
+ },
101
+ {
102
+ id: 'WTFPL',
103
+ name: 'Do What The F* You Want To Public License',
104
+ description: 'An extremely permissive license that allows anyone to do whatever they want with the work with no restrictions whatsoever.',
105
+ permissions: ['Commercial use', 'Modification', 'Distribution', 'Private use'],
106
+ conditions: [],
107
+ limitations: ['Liability', 'Warranty']
108
+ }
109
+ ];
package/dist/highlight.js CHANGED
@@ -2,39 +2,71 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.highlightJson = highlightJson;
4
4
  const ansi_1 = require("./ansi");
5
+ const theme_1 = require("./theme");
5
6
  function highlightJson(json) {
6
7
  if (!json)
7
8
  return '';
8
- // Regex for JSON tokens
9
- // Captures:
10
- // 1. Strings (potentially keys if followed by :)
9
+ // Updated Regex for better partial matching and separation
10
+ // 1. Strings (keys or values), allowing unclosed quotes for partial typing
11
11
  // 2. Numbers
12
12
  // 3. Booleans/Null
13
- // 4. Punctuation
14
- const tokenRegex = /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?)|(-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)|(true|false|null)|([{}[\],:])/g;
15
- return json.replace(tokenRegex, (match) => {
16
- // String
17
- if (match.startsWith('"')) {
18
- // Check if it's a key (ends with :)
19
- if (match.trim().endsWith(':')) {
20
- const colonIndex = match.lastIndexOf(':');
21
- const keyPart = match.substring(0, colonIndex);
22
- const colonPart = match.substring(colonIndex);
23
- // Key in Cyan
24
- return `${ansi_1.ANSI.FG_CYAN}${keyPart}${ansi_1.ANSI.RESET}${colonPart}`;
13
+ // 4. Punctuation (separated colon from keys logic)
14
+ // Regex explanation:
15
+ // ("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"?) -> Captures strings, optionally unclosed at the end
16
+ // (-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?) -> Captures numbers
17
+ // (true|false|null) -> Captures keywords
18
+ // ([{}[\],:]) -> Captures punctuation
19
+ const tokenRegex = /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"?)|(-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)|(true|false|null)|([{}[\],:])/g;
20
+ let result = '';
21
+ let lastIndex = 0;
22
+ let match;
23
+ while ((match = tokenRegex.exec(json)) !== null) {
24
+ // Add any non-matching text (whitespace/invalid) as-is
25
+ if (match.index > lastIndex) {
26
+ result += json.substring(lastIndex, match.index);
27
+ }
28
+ const token = match[0];
29
+ // 1. Strings (Key or Value determination is context-based, but here we do simple check)
30
+ // Note: In strict JSON, keys are strings followed by :, but since we separated colon,
31
+ // we can't easily distinguish keys just by regex lookahead safely without lookbehind support.
32
+ // However, for visual highlighting, colouring all strings consistently is often acceptable
33
+ // or we can try to peek ahead.
34
+ if (token.startsWith('"')) {
35
+ // Simple heuristic: If the NEXT non-whitespace char is ':', treat as key
36
+ const remaining = json.substring(tokenRegex.lastIndex);
37
+ if (/^\s*:/.test(remaining)) {
38
+ result += `${theme_1.theme.syntax.key}${token}${ansi_1.ANSI.RESET}`;
39
+ }
40
+ else {
41
+ result += `${theme_1.theme.syntax.string}${token}${ansi_1.ANSI.RESET}`;
42
+ }
43
+ }
44
+ // 2. Numbers
45
+ else if (/^-?\d/.test(token)) {
46
+ result += `${theme_1.theme.syntax.number}${token}${ansi_1.ANSI.RESET}`;
47
+ }
48
+ // 3. Booleans/Null
49
+ else if (/^(true|false|null)$/.test(token)) {
50
+ if (token === 'null') {
51
+ result += `${theme_1.theme.syntax.null}${token}${ansi_1.ANSI.RESET}`;
52
+ }
53
+ else {
54
+ result += `${theme_1.theme.syntax.boolean}${token}${ansi_1.ANSI.RESET}`;
25
55
  }
26
- // String value in Green
27
- return `${ansi_1.ANSI.FG_GREEN}${match}${ansi_1.ANSI.RESET}`;
28
56
  }
29
- // Number in Yellow
30
- if (/^-?\d/.test(match)) {
31
- return `${ansi_1.ANSI.FG_YELLOW}${match}${ansi_1.ANSI.RESET}`;
57
+ // 4. Punctuation
58
+ else if (/^[{}[\],:]$/.test(token)) {
59
+ result += `${theme_1.theme.syntax.punctuation}${token}${ansi_1.ANSI.RESET}`;
32
60
  }
33
- // Boolean/Null in Red (or Magenta if available, using Red for now)
34
- if (/^(true|false|null)$/.test(match)) {
35
- return `${ansi_1.ANSI.FG_RED}${match}${ansi_1.ANSI.RESET}`;
61
+ // Fallback
62
+ else {
63
+ result += token;
36
64
  }
37
- // Punctuation in White (or default)
38
- return `${ansi_1.ANSI.FG_WHITE}${match}${ansi_1.ANSI.RESET}`;
39
- });
65
+ lastIndex = tokenRegex.lastIndex;
66
+ }
67
+ // Append remaining text
68
+ if (lastIndex < json.length) {
69
+ result += json.substring(lastIndex);
70
+ }
71
+ return result;
40
72
  }
package/dist/index.d.ts CHANGED
@@ -4,3 +4,39 @@
4
4
  */
5
5
  export * from './types';
6
6
  export * from './core';
7
+ export * from './prompts/map';
8
+ export * from './prompts/semver';
9
+ export * from './prompts/ip';
10
+ export * from './prompts/kanban';
11
+ export * from './prompts/time';
12
+ export * from './prompts/heatmap';
13
+ export * from './prompts/byte';
14
+ export * from './prompts/slot';
15
+ export * from './prompts/gauge';
16
+ export * from './prompts/calculator';
17
+ export * from './prompts/emoji';
18
+ export * from './prompts/match';
19
+ export * from './prompts/diff';
20
+ export * from './prompts/dial';
21
+ export * from './prompts/draw';
22
+ export * from './prompts/multi-column-select';
23
+ export * from './prompts/fuzzy';
24
+ export * from './prompts/miller';
25
+ export * from './prompts/pattern';
26
+ export * from './prompts/region';
27
+ export * from './prompts/spreadsheet';
28
+ export * from './prompts/scroll';
29
+ export * from './prompts/breadcrumb';
30
+ export * from './prompts/schedule';
31
+ export * from './prompts/data-inspector';
32
+ export * from './prompts/exec';
33
+ export * from './prompts/shortcut';
34
+ export * from './prompts/seat';
35
+ export * from './prompts/select-range';
36
+ export * from './prompts/sort-grid';
37
+ export * from './prompts/dependency';
38
+ export * from './prompts/license';
39
+ export * from './prompts/regex';
40
+ export * from './prompts/box';
41
+ export * from './prompts/connection-string';
42
+ export * from './prompts/curl';