devlyn-cli 4.2.0 → 4.2.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 (132) hide show
  1. package/README.md +4 -2
  2. package/bin/devlyn.js +184 -147
  3. package/bin/skill-history.json +140 -0
  4. package/bin/skill-ownership.js +67 -0
  5. package/node_modules/@inquirer/ansi/LICENSE +22 -0
  6. package/node_modules/@inquirer/ansi/README.md +121 -0
  7. package/node_modules/@inquirer/ansi/dist/index.d.ts +14 -0
  8. package/node_modules/@inquirer/ansi/dist/index.js +21 -0
  9. package/node_modules/@inquirer/ansi/package.json +79 -0
  10. package/node_modules/@inquirer/checkbox/LICENSE +22 -0
  11. package/node_modules/@inquirer/checkbox/README.md +265 -0
  12. package/node_modules/@inquirer/checkbox/dist/index.d.ts +67 -0
  13. package/node_modules/@inquirer/checkbox/dist/index.js +210 -0
  14. package/node_modules/@inquirer/checkbox/package.json +93 -0
  15. package/node_modules/@inquirer/core/LICENSE +22 -0
  16. package/node_modules/@inquirer/core/README.md +424 -0
  17. package/node_modules/@inquirer/core/dist/index.d.ts +13 -0
  18. package/node_modules/@inquirer/core/dist/index.js +12 -0
  19. package/node_modules/@inquirer/core/dist/lib/Separator.d.ts +10 -0
  20. package/node_modules/@inquirer/core/dist/lib/Separator.js +21 -0
  21. package/node_modules/@inquirer/core/dist/lib/__probe/p1.d.ts +9 -0
  22. package/node_modules/@inquirer/core/dist/lib/__probe/p1.js +4 -0
  23. package/node_modules/@inquirer/core/dist/lib/__probe/p2.d.ts +9 -0
  24. package/node_modules/@inquirer/core/dist/lib/__probe/p2.js +3 -0
  25. package/node_modules/@inquirer/core/dist/lib/__probe/p3.d.ts +9 -0
  26. package/node_modules/@inquirer/core/dist/lib/__probe/p3.js +5 -0
  27. package/node_modules/@inquirer/core/dist/lib/create-prompt.d.ts +11 -0
  28. package/node_modules/@inquirer/core/dist/lib/create-prompt.js +185 -0
  29. package/node_modules/@inquirer/core/dist/lib/errors.d.ts +20 -0
  30. package/node_modules/@inquirer/core/dist/lib/errors.js +21 -0
  31. package/node_modules/@inquirer/core/dist/lib/hook-engine.d.ts +17 -0
  32. package/node_modules/@inquirer/core/dist/lib/hook-engine.js +109 -0
  33. package/node_modules/@inquirer/core/dist/lib/key.d.ts +15 -0
  34. package/node_modules/@inquirer/core/dist/lib/key.js +34 -0
  35. package/node_modules/@inquirer/core/dist/lib/make-theme.d.ts +3 -0
  36. package/node_modules/@inquirer/core/dist/lib/make-theme.js +33 -0
  37. package/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.d.ts +15 -0
  38. package/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js +121 -0
  39. package/node_modules/@inquirer/core/dist/lib/screen-manager.d.ts +14 -0
  40. package/node_modules/@inquirer/core/dist/lib/screen-manager.js +84 -0
  41. package/node_modules/@inquirer/core/dist/lib/theme.d.ts +166 -0
  42. package/node_modules/@inquirer/core/dist/lib/theme.js +29 -0
  43. package/node_modules/@inquirer/core/dist/lib/use-effect.d.ts +2 -0
  44. package/node_modules/@inquirer/core/dist/lib/use-effect.js +11 -0
  45. package/node_modules/@inquirer/core/dist/lib/use-keypress.d.ts +3 -0
  46. package/node_modules/@inquirer/core/dist/lib/use-keypress.js +20 -0
  47. package/node_modules/@inquirer/core/dist/lib/use-memo.d.ts +1 -0
  48. package/node_modules/@inquirer/core/dist/lib/use-memo.js +14 -0
  49. package/node_modules/@inquirer/core/dist/lib/use-prefix.d.ts +5 -0
  50. package/node_modules/@inquirer/core/dist/lib/use-prefix.js +35 -0
  51. package/node_modules/@inquirer/core/dist/lib/use-ref.d.ts +6 -0
  52. package/node_modules/@inquirer/core/dist/lib/use-ref.js +4 -0
  53. package/node_modules/@inquirer/core/dist/lib/use-state.d.ts +7 -0
  54. package/node_modules/@inquirer/core/dist/lib/use-state.js +28 -0
  55. package/node_modules/@inquirer/core/dist/lib/utils.d.ts +13 -0
  56. package/node_modules/@inquirer/core/dist/lib/utils.js +25 -0
  57. package/node_modules/@inquirer/core/package.json +98 -0
  58. package/node_modules/@inquirer/figures/LICENSE +22 -0
  59. package/node_modules/@inquirer/figures/dist/index.d.ts +275 -0
  60. package/node_modules/@inquirer/figures/dist/index.js +315 -0
  61. package/node_modules/@inquirer/figures/package.json +81 -0
  62. package/node_modules/@inquirer/select/LICENSE +22 -0
  63. package/node_modules/@inquirer/select/README.md +258 -0
  64. package/node_modules/@inquirer/select/dist/index.d.ts +42 -0
  65. package/node_modules/@inquirer/select/dist/index.js +191 -0
  66. package/node_modules/@inquirer/select/package.json +93 -0
  67. package/node_modules/@inquirer/type/LICENSE +22 -0
  68. package/node_modules/@inquirer/type/dist/index.d.ts +2 -0
  69. package/node_modules/@inquirer/type/dist/index.js +2 -0
  70. package/node_modules/@inquirer/type/dist/inquirer.d.ts +35 -0
  71. package/node_modules/@inquirer/type/dist/inquirer.js +1 -0
  72. package/node_modules/@inquirer/type/dist/utils.d.ts +45 -0
  73. package/node_modules/@inquirer/type/dist/utils.js +16 -0
  74. package/node_modules/@inquirer/type/package.json +88 -0
  75. package/node_modules/cli-width/LICENSE +13 -0
  76. package/node_modules/cli-width/README.md +71 -0
  77. package/node_modules/cli-width/index.d.ts +13 -0
  78. package/node_modules/cli-width/index.js +49 -0
  79. package/node_modules/cli-width/package.json +40 -0
  80. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  81. package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  82. package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  83. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  84. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  85. package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  86. package/node_modules/fast-string-truncated-width/license +21 -0
  87. package/node_modules/fast-string-truncated-width/package.json +35 -0
  88. package/node_modules/fast-string-truncated-width/readme.md +59 -0
  89. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  90. package/node_modules/fast-string-width/dist/index.js +14 -0
  91. package/node_modules/fast-string-width/license +21 -0
  92. package/node_modules/fast-string-width/package.json +34 -0
  93. package/node_modules/fast-string-width/readme.md +42 -0
  94. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  95. package/node_modules/fast-wrap-ansi/README.md +26 -0
  96. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  97. package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
  98. package/node_modules/fast-wrap-ansi/package.json +51 -0
  99. package/node_modules/mute-stream/LICENSE +15 -0
  100. package/node_modules/mute-stream/README.md +68 -0
  101. package/node_modules/mute-stream/lib/index.js +142 -0
  102. package/node_modules/mute-stream/package.json +54 -0
  103. package/node_modules/signal-exit/LICENSE.txt +16 -0
  104. package/node_modules/signal-exit/README.md +74 -0
  105. package/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
  106. package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
  107. package/node_modules/signal-exit/dist/cjs/browser.js +10 -0
  108. package/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
  109. package/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
  110. package/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
  111. package/node_modules/signal-exit/dist/cjs/index.js +279 -0
  112. package/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
  113. package/node_modules/signal-exit/dist/cjs/package.json +3 -0
  114. package/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
  115. package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
  116. package/node_modules/signal-exit/dist/cjs/signals.js +42 -0
  117. package/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
  118. package/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
  119. package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
  120. package/node_modules/signal-exit/dist/mjs/browser.js +4 -0
  121. package/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
  122. package/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
  123. package/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
  124. package/node_modules/signal-exit/dist/mjs/index.js +275 -0
  125. package/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
  126. package/node_modules/signal-exit/dist/mjs/package.json +3 -0
  127. package/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
  128. package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
  129. package/node_modules/signal-exit/dist/mjs/signals.js +39 -0
  130. package/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
  131. package/node_modules/signal-exit/package.json +106 -0
  132. package/package.json +16 -2
@@ -0,0 +1,258 @@
1
+ # `@inquirer/select`
2
+
3
+ Simple interactive command line prompt to display a list of choices (single select.)
4
+
5
+ ![select prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/list.svg)
6
+
7
+ # Installation
8
+
9
+ <table>
10
+ <tr>
11
+ <th>yarn</th>
12
+ <th>pnpm</th>
13
+ </tr>
14
+ <tr>
15
+ <td>
16
+
17
+ ```sh
18
+ yarn add @inquirer/prompts
19
+ ```
20
+
21
+ </td>
22
+ <td>
23
+
24
+ ```sh
25
+ pnpm add @inquirer/prompts
26
+ ```
27
+
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <th>bun</th>
32
+ <th>deno</th>
33
+ </tr>
34
+ <tr>
35
+ <td>
36
+
37
+ ```sh
38
+ bun add @inquirer/prompts
39
+ ```
40
+
41
+ </td>
42
+ <td>
43
+
44
+ ```sh
45
+ deno add npm:@inquirer/prompts
46
+ ```
47
+
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <th colSpan="2">npm</th>
52
+ </tr>
53
+ <tr>
54
+ <td colSpan="2">
55
+
56
+ ```sh
57
+ npm install @inquirer/prompts
58
+ ```
59
+
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <td colSpan="2" align="center">Or</td>
64
+ </tr>
65
+ <tr>
66
+ <th>yarn</th>
67
+ <th>pnpm</th>
68
+ </tr>
69
+ <tr>
70
+ <td>
71
+
72
+ ```sh
73
+ yarn add @inquirer/select
74
+ ```
75
+
76
+ </td>
77
+ <td>
78
+
79
+ ```sh
80
+ pnpm add @inquirer/select
81
+ ```
82
+
83
+ </td>
84
+ </tr>
85
+ <tr>
86
+ <th>bun</th>
87
+ <th>deno</th>
88
+ </tr>
89
+ <tr>
90
+ <td>
91
+
92
+ ```sh
93
+ bun add @inquirer/select
94
+ ```
95
+
96
+ </td>
97
+ <td>
98
+
99
+ ```sh
100
+ deno add npm:@inquirer/select
101
+ ```
102
+
103
+ </td>
104
+ </tr>
105
+ <tr>
106
+ <th colSpan="2">npm</th>
107
+ </tr>
108
+ <tr>
109
+ <td colSpan="2">
110
+
111
+ ```sh
112
+ npm install @inquirer/select
113
+ ```
114
+
115
+ </td>
116
+ </tr>
117
+ </table>
118
+
119
+ On Deno, prompts detect the terminal's unicode and color support from the environment, so run your script with `--allow-env`.
120
+
121
+ # Usage
122
+
123
+ ```js
124
+ import { select, Separator } from '@inquirer/prompts';
125
+ // Or
126
+ // import select, { Separator } from '@inquirer/select';
127
+
128
+ const answer = await select({
129
+ message: 'Select a package manager',
130
+ choices: [
131
+ {
132
+ name: 'npm',
133
+ value: 'npm',
134
+ description: 'npm is the most popular package manager',
135
+ },
136
+ {
137
+ name: 'yarn',
138
+ value: 'yarn',
139
+ description: 'yarn is an awesome package manager',
140
+ },
141
+ new Separator(),
142
+ {
143
+ name: 'jspm',
144
+ value: 'jspm',
145
+ disabled: true,
146
+ },
147
+ {
148
+ name: 'pnpm',
149
+ value: 'pnpm',
150
+ disabled: '(pnpm is not available)',
151
+ },
152
+ ],
153
+ });
154
+ ```
155
+
156
+ ## Options
157
+
158
+ | Property | Type | Required | Description |
159
+ | -------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
160
+ | message | `string` | yes | The question to ask |
161
+ | choices | `Choice[]` | yes | List of the available choices. |
162
+ | default | `string` | no | Defines in front of which item the cursor will initially appear. When omitted, the cursor will appear on the first selectable item. |
163
+ | pageSize | `number` | no | By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once. |
164
+ | loop | `boolean` | no | Defaults to `true`. When set to `false`, the cursor will be constrained to the top and bottom of the choice list without looping. |
165
+ | theme | [See Theming](#Theming) | no | Customize look of the prompt. |
166
+
167
+ `Separator` objects can be used in the `choices` array to render non-selectable lines in the choice list. By default it'll render a line, but you can provide the text as argument (`new Separator('-- Dependencies --')`). This option is often used to add labels to groups within long list of options.
168
+
169
+ ### `Choice` object
170
+
171
+ The `Choice` object is typed as
172
+
173
+ ```ts
174
+ type Choice<Value> = {
175
+ value: Value;
176
+ name?: string;
177
+ description?: string;
178
+ short?: string;
179
+ disabled?: boolean | string;
180
+ };
181
+ ```
182
+
183
+ Here's each property:
184
+
185
+ - `value`: The value is what will be returned by `await select()`.
186
+ - `name`: This is the string displayed in the choice list.
187
+ - `description`: Option for a longer description string that'll appear under the list when the cursor highlight a given choice.
188
+ - `short`: Once the prompt is done (press enter), we'll use `short` if defined to render next to the question. By default we'll use `name`.
189
+ - `disabled`: Disallow the option from being selected. If `disabled` is a string, it'll be used as a help tip explaining why the choice isn't available.
190
+
191
+ `choices` can also be an array of string, in which case the string will be used both as the `value` and the `name`.
192
+
193
+ ## Keybindings
194
+
195
+ Set `INQUIRER_KEYBINDINGS=vim`, `INQUIRER_KEYBINDINGS=emacs`, or `INQUIRER_KEYBINDINGS=vim,emacs` to enable alternative navigation keybindings globally.
196
+
197
+ When Vim keybindings are enabled, the prompt disables type-to-search so navigation keys are not interpreted as search input. You can override the environment setting per prompt with `theme.keybindings`.
198
+
199
+ ## Theming
200
+
201
+ You can theme a prompt by passing a `theme` object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.
202
+
203
+ ```ts
204
+ type Theme = {
205
+ prefix: string | { idle: string; done: string };
206
+ spinner: {
207
+ interval: number;
208
+ frames: string[];
209
+ };
210
+ style: {
211
+ answer: (text: string) => string;
212
+ message: (text: string, status: 'idle' | 'done' | 'loading') => string;
213
+ error: (text: string) => string;
214
+ help: (text: string) => string;
215
+ highlight: (text: string) => string;
216
+ description: (text: string) => string;
217
+ disabled: (text: string) => string;
218
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
219
+ };
220
+ icon: {
221
+ cursor: string;
222
+ };
223
+ indexMode: 'hidden' | 'number';
224
+ keybindings: readonly ('emacs' | 'vim')[];
225
+ };
226
+ ```
227
+
228
+ ### `theme.style.keysHelpTip`
229
+
230
+ This function allows you to customize the keyboard shortcuts help tip displayed below the prompt. It receives an array of key-action pairs and should return a formatted string. You can also hook here to localize the labels to different languages.
231
+
232
+ It can also returns `undefined` to hide the help tip entirely.
233
+
234
+ ```js
235
+ theme: {
236
+ style: {
237
+ keysHelpTip: (keys) => {
238
+ // Return undefined to hide the help tip completely.
239
+ return undefined;
240
+
241
+ // Or customize the formatting. Or localize the labels.
242
+ return keys.map(([key, action]) => `${key}: ${action}`).join(' | ');
243
+ };
244
+ }
245
+ }
246
+ ```
247
+
248
+ ### `theme.indexMode`
249
+
250
+ Controls how indices are displayed before each choice:
251
+
252
+ - `hidden` (default): No indices are shown
253
+ - `number`: Display a number before each choice (e.g. "1. Option A")
254
+
255
+ # License
256
+
257
+ Copyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
258
+ Licensed under the MIT license.
@@ -0,0 +1,42 @@
1
+ import { Separator, type Theme } from '@inquirer/core';
2
+ import type { PartialDeep } from '@inquirer/type';
3
+ type SelectTheme = {
4
+ icon: {
5
+ cursor: string;
6
+ };
7
+ style: {
8
+ disabled: (text: string) => string;
9
+ description: (text: string) => string;
10
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
11
+ };
12
+ i18n: {
13
+ disabledError: string;
14
+ };
15
+ indexMode: 'hidden' | 'number';
16
+ };
17
+ type Choice<Value> = {
18
+ value: Value;
19
+ name?: string;
20
+ description?: string;
21
+ short?: string;
22
+ disabled?: boolean | string;
23
+ type?: never;
24
+ };
25
+ type SelectConfig<Value> = {
26
+ message: string;
27
+ choices: ReadonlyArray<Value | Choice<Value> | Separator>;
28
+ pageSize?: number;
29
+ loop?: boolean;
30
+ default?: NoInfer<Value>;
31
+ theme?: PartialDeep<Theme<SelectTheme>>;
32
+ };
33
+ declare const _default: <const Value>(config: {
34
+ message: string;
35
+ choices: readonly (Separator | Value | Choice<Value>)[];
36
+ pageSize?: number | undefined;
37
+ loop?: boolean | undefined;
38
+ default?: NoInfer<Value> | undefined;
39
+ theme?: PartialDeep<Theme<SelectTheme>> | undefined;
40
+ } & SelectConfig<Value>, context?: import("@inquirer/type").Context) => Promise<Value>;
41
+ export default _default;
42
+ export { Separator } from '@inquirer/core';
@@ -0,0 +1,191 @@
1
+ import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, useEffect, isBackspaceKey, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, ValidationError, makeTheme, } from '@inquirer/core';
2
+ import { cursorHide } from '@inquirer/ansi';
3
+ import { styleText } from 'node:util';
4
+ import figures from '@inquirer/figures';
5
+ const selectTheme = {
6
+ icon: { cursor: figures.pointer },
7
+ style: {
8
+ disabled: (text) => styleText('dim', text),
9
+ description: (text) => styleText('cyan', text),
10
+ keysHelpTip: (keys) => keys
11
+ .map(([key, action]) => `${styleText('bold', key)} ${styleText('dim', action)}`)
12
+ .join(styleText('dim', ' • ')),
13
+ },
14
+ i18n: { disabledError: 'This option is disabled and cannot be selected.' },
15
+ indexMode: 'hidden',
16
+ };
17
+ function isSelectable(item) {
18
+ return !Separator.isSeparator(item) && !item.disabled;
19
+ }
20
+ function isNavigable(item) {
21
+ return !Separator.isSeparator(item);
22
+ }
23
+ function normalizeChoices(choices) {
24
+ return choices.map((choice) => {
25
+ if (Separator.isSeparator(choice))
26
+ return choice;
27
+ if (typeof choice !== 'object' || choice === null || !('value' in choice)) {
28
+ // It's a raw value (string, number, etc.)
29
+ const name = String(choice);
30
+ return {
31
+ value: choice,
32
+ name,
33
+ short: name,
34
+ disabled: false,
35
+ };
36
+ }
37
+ const name = choice.name ?? String(choice.value);
38
+ const normalizedChoice = {
39
+ value: choice.value,
40
+ name,
41
+ short: choice.short ?? name,
42
+ disabled: choice.disabled ?? false,
43
+ };
44
+ if (choice.description) {
45
+ normalizedChoice.description = choice.description;
46
+ }
47
+ return normalizedChoice;
48
+ });
49
+ }
50
+ export default createPrompt((config, done) => {
51
+ const { loop = true, pageSize = 7 } = config;
52
+ const theme = makeTheme(selectTheme, config.theme);
53
+ const { keybindings } = theme;
54
+ const [status, setStatus] = useState('idle');
55
+ const prefix = usePrefix({ status, theme });
56
+ const searchTimeoutRef = useRef();
57
+ // Vim keybindings (j/k) conflict with typing those letters in search.
58
+ const searchEnabled = !keybindings.includes('vim');
59
+ const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
60
+ const bounds = useMemo(() => {
61
+ const first = items.findIndex(isNavigable);
62
+ const last = items.findLastIndex(isNavigable);
63
+ if (first === -1) {
64
+ throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');
65
+ }
66
+ return { first, last };
67
+ }, [items]);
68
+ const defaultItemIndex = useMemo(() => {
69
+ if (!('default' in config))
70
+ return -1;
71
+ return items.findIndex((item) => isSelectable(item) && item.value === config.default);
72
+ }, [config.default, items]);
73
+ const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
74
+ const selectedChoice = items[active];
75
+ if (selectedChoice == null || Separator.isSeparator(selectedChoice)) {
76
+ throw new Error('Active index does not point to a choice');
77
+ }
78
+ const [errorMsg, setError] = useState();
79
+ useKeypress((key, rl) => {
80
+ clearTimeout(searchTimeoutRef.current);
81
+ if (errorMsg) {
82
+ setError(undefined);
83
+ }
84
+ if (isEnterKey(key)) {
85
+ if (selectedChoice.disabled) {
86
+ setError(theme.i18n.disabledError);
87
+ }
88
+ else {
89
+ setStatus('done');
90
+ done(selectedChoice.value);
91
+ }
92
+ }
93
+ else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
94
+ rl.clearLine(0);
95
+ if (loop ||
96
+ (isUpKey(key, keybindings) && active !== bounds.first) ||
97
+ (isDownKey(key, keybindings) && active !== bounds.last)) {
98
+ const offset = isUpKey(key, keybindings) ? -1 : 1;
99
+ let next = active;
100
+ do {
101
+ next = (next + offset + items.length) % items.length;
102
+ } while (!isNavigable(items[next]));
103
+ setActive(next);
104
+ }
105
+ }
106
+ else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
107
+ const selectedIndex = Number(rl.line) - 1;
108
+ // Find the nth item (ignoring separators)
109
+ let selectableIndex = -1;
110
+ const position = items.findIndex((item) => {
111
+ if (Separator.isSeparator(item))
112
+ return false;
113
+ selectableIndex++;
114
+ return selectableIndex === selectedIndex;
115
+ });
116
+ const item = items[position];
117
+ if (item != null && isSelectable(item)) {
118
+ setActive(position);
119
+ }
120
+ searchTimeoutRef.current = setTimeout(() => {
121
+ rl.clearLine(0);
122
+ }, 700);
123
+ }
124
+ else if (isBackspaceKey(key)) {
125
+ rl.clearLine(0);
126
+ }
127
+ else if (searchEnabled) {
128
+ const searchTerm = rl.line.toLowerCase();
129
+ const matchIndex = items.findIndex((item) => {
130
+ if (Separator.isSeparator(item) || !isSelectable(item))
131
+ return false;
132
+ return item.name.toLowerCase().startsWith(searchTerm);
133
+ });
134
+ if (matchIndex !== -1) {
135
+ setActive(matchIndex);
136
+ }
137
+ searchTimeoutRef.current = setTimeout(() => {
138
+ rl.clearLine(0);
139
+ }, 700);
140
+ }
141
+ });
142
+ useEffect(() => () => {
143
+ clearTimeout(searchTimeoutRef.current);
144
+ }, []);
145
+ const message = theme.style.message(config.message, status);
146
+ const helpLine = theme.style.keysHelpTip([
147
+ ['↑↓', 'navigate'],
148
+ ['⏎', 'select'],
149
+ ]);
150
+ let separatorCount = 0;
151
+ const page = usePagination({
152
+ items,
153
+ active,
154
+ renderItem({ item, isActive, index }) {
155
+ if (Separator.isSeparator(item)) {
156
+ separatorCount++;
157
+ return ` ${item.separator}`;
158
+ }
159
+ const cursor = isActive ? theme.icon.cursor : ' ';
160
+ const indexLabel = theme.indexMode === 'number' ? `${index + 1 - separatorCount}. ` : '';
161
+ if (item.disabled) {
162
+ const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';
163
+ const disabledCursor = isActive ? theme.icon.cursor : '-';
164
+ return theme.style.disabled(`${disabledCursor} ${indexLabel}${item.name} ${disabledLabel}`);
165
+ }
166
+ const color = isActive ? theme.style.highlight : (x) => x;
167
+ return color(`${cursor} ${indexLabel}${item.name}`);
168
+ },
169
+ pageSize,
170
+ loop,
171
+ });
172
+ if (status === 'done') {
173
+ return [prefix, message, theme.style.answer(selectedChoice.short)]
174
+ .filter(Boolean)
175
+ .join(' ');
176
+ }
177
+ const { description } = selectedChoice;
178
+ const lines = [
179
+ [prefix, message].filter(Boolean).join(' '),
180
+ page,
181
+ ' ',
182
+ description ? theme.style.description(description) : '',
183
+ errorMsg ? theme.style.error(errorMsg) : '',
184
+ helpLine,
185
+ ]
186
+ .filter(Boolean)
187
+ .join('\n')
188
+ .trimEnd();
189
+ return `${lines}${cursorHide}`;
190
+ });
191
+ export { Separator } from '@inquirer/core';
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "@inquirer/select",
3
+ "version": "5.2.6",
4
+ "description": "Inquirer select/list prompt",
5
+ "keywords": [
6
+ "answer",
7
+ "answers",
8
+ "ask",
9
+ "base",
10
+ "cli",
11
+ "command",
12
+ "command-line",
13
+ "confirm",
14
+ "enquirer",
15
+ "generate",
16
+ "generator",
17
+ "hyper",
18
+ "input",
19
+ "inquire",
20
+ "inquirer",
21
+ "interface",
22
+ "iterm",
23
+ "javascript",
24
+ "menu",
25
+ "node",
26
+ "nodejs",
27
+ "prompt",
28
+ "promptly",
29
+ "prompts",
30
+ "question",
31
+ "readline",
32
+ "scaffold",
33
+ "scaffolder",
34
+ "scaffolding",
35
+ "stdin",
36
+ "stdout",
37
+ "terminal",
38
+ "tty",
39
+ "ui",
40
+ "yeoman",
41
+ "yo",
42
+ "zsh"
43
+ ],
44
+ "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/select/README.md",
45
+ "license": "MIT",
46
+ "author": "Simon Boudrias <admin@simonboudrias.com>",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/SBoudrias/Inquirer.js.git"
50
+ },
51
+ "files": [
52
+ "dist"
53
+ ],
54
+ "type": "module",
55
+ "sideEffects": false,
56
+ "exports": {
57
+ ".": {
58
+ "types": "./dist/index.d.ts",
59
+ "default": "./dist/index.js"
60
+ },
61
+ "./package.json": "./package.json"
62
+ },
63
+ "publishConfig": {
64
+ "access": "public"
65
+ },
66
+ "scripts": {
67
+ "tsc": "tsc"
68
+ },
69
+ "dependencies": {
70
+ "@inquirer/ansi": "^2.0.9",
71
+ "@inquirer/core": "^12.0.4",
72
+ "@inquirer/figures": "^2.0.9",
73
+ "@inquirer/type": "4.2.0"
74
+ },
75
+ "devDependencies": {
76
+ "@repo/tsconfig": "0.0.0",
77
+ "typescript": "^6.0.2"
78
+ },
79
+ "peerDependencies": {
80
+ "@types/node": ">=18"
81
+ },
82
+ "peerDependenciesMeta": {
83
+ "@types/node": {
84
+ "optional": true
85
+ }
86
+ },
87
+ "engines": {
88
+ "node": ">=23.5.0 || ^22.13.0 || ^20.17.0"
89
+ },
90
+ "main": "./dist/index.js",
91
+ "types": "./dist/index.d.ts",
92
+ "gitHead": "a9436bd94d55a439df308f50e77a7cd0b2078e98"
93
+ }
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2025 Simon Boudrias
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export * from './inquirer.ts';
2
+ export * from './utils.ts';
@@ -0,0 +1,2 @@
1
+ export * from "./inquirer.js";
2
+ export * from "./utils.js";
@@ -0,0 +1,35 @@
1
+ import { Duplex } from 'node:stream';
2
+ /**
3
+ * `InquirerReadline` is a re-implementation of `readline.Interface` from Node.js.
4
+ * We're reimplementing it because of 3 reasons:
5
+ * 1. The `readline.Interface` API is not complete; it's missing for example `clearLine`.
6
+ * 2. The input/output streams are not generics, meaning they're inexact.
7
+ * 3. Since ReadLine isn't built-in Typescript Global NodeJS type, it'd force us to ship `@types/node` as a dependency to all users.
8
+ */
9
+ export type InquirerReadline = {
10
+ output: Duplex & {
11
+ mute: () => void;
12
+ unmute: () => void;
13
+ };
14
+ input: NodeJS.ReadableStream;
15
+ clearLine: (dir: 0 | 1 | -1) => void;
16
+ getCursorPos: () => {
17
+ rows: number;
18
+ cols: number;
19
+ };
20
+ setPrompt: (prompt: string) => void;
21
+ line: string;
22
+ write: (data: string) => void;
23
+ on: (event: string, listener: (...args: unknown[]) => void) => void;
24
+ removeListener: (event: string, listener: (...args: unknown[]) => void) => void;
25
+ pause: () => void;
26
+ resume: () => void;
27
+ close: () => void;
28
+ };
29
+ export type Context = {
30
+ input?: NodeJS.ReadableStream;
31
+ output?: NodeJS.WritableStream;
32
+ clearPromptOnDone?: boolean;
33
+ signal?: AbortSignal;
34
+ };
35
+ export type Prompt<Value, Config> = (config: Config, context?: Context) => Promise<Value>;
@@ -0,0 +1 @@
1
+ export {};