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,34 @@
1
+ {
2
+ "name": "fast-string-width",
3
+ "repository": "github:fabiospampinato/fast-string-width",
4
+ "description": "A fast function for calculating the visual width of a string once printed to the terminal.",
5
+ "license": "MIT",
6
+ "version": "3.0.2",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "exports": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "scripts": {
12
+ "clean": "tsex clean",
13
+ "compile": "tsex compile",
14
+ "compile:watch": "tsex compile --watch",
15
+ "test": "tsex test",
16
+ "test:watch": "tsex test --watch",
17
+ "prepublishOnly": "tsex prepare"
18
+ },
19
+ "keywords": [
20
+ "fast",
21
+ "string",
22
+ "width",
23
+ "cli",
24
+ "terminal"
25
+ ],
26
+ "dependencies": {
27
+ "fast-string-truncated-width": "^3.0.2"
28
+ },
29
+ "devDependencies": {
30
+ "fava": "^0.3.4",
31
+ "tsex": "^4.0.2",
32
+ "typescript": "^5.7.3"
33
+ }
34
+ }
@@ -0,0 +1,42 @@
1
+ # Fast String Width
2
+
3
+ A fast function for calculating the visual width of a string once printed to the terminal.
4
+
5
+ See [`fast-string-truncated-width`](https://github.com/fabiospampinato/fast-string-truncated-width) for a lower-level version of this.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install fast-string-width
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import fastStringWidth from 'fast-string-width';
17
+
18
+ // The width of various classes of characters is configurable
19
+
20
+ const options = {
21
+ controlWidth: 0,
22
+ tabWidth: 8,
23
+ emojiWidth: 2,
24
+ regularWidth: 1,
25
+ wideWidth: 2
26
+ };
27
+
28
+ // Calculating the visual width of some strings
29
+
30
+ fastStringWidth ( 'hello', options ); // => 5
31
+ fastStringWidth ( '\x1b[31mhello', options ); // => 5
32
+ fastStringWidth ( '👨‍👩‍👧‍👦', options ); // => 2
33
+ fastStringWidth ( 'hello👨‍👩‍👧‍👦', options ); // => 7
34
+
35
+ // Calculating the visual width while tweaking the width of emojis
36
+
37
+ fastStringWidth ( '👶👶🏽', { ...options, emojiWidth: 1.5 } ); // => 3
38
+ ```
39
+
40
+ ## License
41
+
42
+ MIT © Fabio Spampinato
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 James Garbutt
4
+
5
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ # fast-wrap-ansi
2
+
3
+ Wordwrap a string, taking ANSI escape codes into account.
4
+
5
+ A fast, light fork of the `wrap-ansi` package.
6
+
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm i -S fast-wrap-ansi
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import {wrapAnsi} from 'fast-wrap-ansi';
18
+
19
+ const str = 'This is a string with some \x1b[31mANSI\x1b[39m codes.';
20
+ const wrapped = wrapAnsi(str, 20);
21
+ console.log(wrapped);
22
+ ```
23
+
24
+ ## License
25
+
26
+ MIT
@@ -0,0 +1,6 @@
1
+ export interface Options {
2
+ trim?: boolean;
3
+ wordWrap?: boolean;
4
+ hard?: boolean;
5
+ }
6
+ export declare function wrapAnsi(string: string, columns: number, options?: Options): string;
@@ -0,0 +1,218 @@
1
+ import stringWidth from 'fast-string-width';
2
+ const ESC = '\x1B';
3
+ const CSI = '\x9B';
4
+ const END_CODE = 39;
5
+ const ANSI_ESCAPE_BELL = '\u0007';
6
+ const ANSI_CSI = '[';
7
+ const ANSI_OSC = ']';
8
+ const ANSI_SGR_TERMINATOR = 'm';
9
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
10
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
11
+ const getClosingCode = (openingCode) => {
12
+ if (openingCode >= 30 && openingCode <= 37)
13
+ return 39;
14
+ if (openingCode >= 90 && openingCode <= 97)
15
+ return 39;
16
+ if (openingCode >= 40 && openingCode <= 47)
17
+ return 49;
18
+ if (openingCode >= 100 && openingCode <= 107)
19
+ return 49;
20
+ if (openingCode === 1 || openingCode === 2)
21
+ return 22;
22
+ if (openingCode === 3)
23
+ return 23;
24
+ if (openingCode === 4)
25
+ return 24;
26
+ if (openingCode === 7)
27
+ return 27;
28
+ if (openingCode === 8)
29
+ return 28;
30
+ if (openingCode === 9)
31
+ return 29;
32
+ if (openingCode === 0)
33
+ return 0;
34
+ return undefined;
35
+ };
36
+ const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
37
+ const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
38
+ const wrapWord = (rows, word, columns) => {
39
+ const characters = word[Symbol.iterator]();
40
+ let isInsideEscape = false;
41
+ let isInsideLinkEscape = false;
42
+ let lastRow = rows.at(-1);
43
+ let visible = lastRow === undefined ? 0 : stringWidth(lastRow);
44
+ let currentCharacter = characters.next();
45
+ let nextCharacter = characters.next();
46
+ let rawCharacterIndex = 0;
47
+ while (!currentCharacter.done) {
48
+ const character = currentCharacter.value;
49
+ const characterLength = stringWidth(character);
50
+ if (visible + characterLength <= columns) {
51
+ rows[rows.length - 1] += character;
52
+ }
53
+ else {
54
+ rows.push(character);
55
+ visible = 0;
56
+ }
57
+ if (character === ESC || character === CSI) {
58
+ isInsideEscape = true;
59
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
60
+ }
61
+ if (isInsideEscape) {
62
+ if (isInsideLinkEscape) {
63
+ if (character === ANSI_ESCAPE_BELL) {
64
+ isInsideEscape = false;
65
+ isInsideLinkEscape = false;
66
+ }
67
+ }
68
+ else if (character === ANSI_SGR_TERMINATOR) {
69
+ isInsideEscape = false;
70
+ }
71
+ }
72
+ else {
73
+ visible += characterLength;
74
+ if (visible === columns && !nextCharacter.done) {
75
+ rows.push('');
76
+ visible = 0;
77
+ }
78
+ }
79
+ currentCharacter = nextCharacter;
80
+ nextCharacter = characters.next();
81
+ rawCharacterIndex += character.length;
82
+ }
83
+ lastRow = rows.at(-1);
84
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
85
+ rows[rows.length - 2] += rows.pop();
86
+ }
87
+ };
88
+ const stringVisibleTrimSpacesRight = (string) => {
89
+ const words = string.split(' ');
90
+ let last = words.length;
91
+ while (last) {
92
+ if (stringWidth(words[last - 1])) {
93
+ break;
94
+ }
95
+ last--;
96
+ }
97
+ if (last === words.length) {
98
+ return string;
99
+ }
100
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
101
+ };
102
+ const exec = (string, columns, options = {}) => {
103
+ if (options.trim !== false && string.trim() === '') {
104
+ return '';
105
+ }
106
+ let returnValue = '';
107
+ let escapeCode;
108
+ let escapeUrl;
109
+ const words = string.split(' ');
110
+ let rows = [''];
111
+ let rowLength = 0;
112
+ for (let index = 0; index < words.length; index++) {
113
+ const word = words[index];
114
+ if (options.trim !== false) {
115
+ const row = rows.at(-1) ?? '';
116
+ const trimmed = row.trimStart();
117
+ if (row.length !== trimmed.length) {
118
+ rows[rows.length - 1] = trimmed;
119
+ rowLength = stringWidth(trimmed);
120
+ }
121
+ }
122
+ if (index !== 0) {
123
+ if (rowLength >= columns &&
124
+ (options.wordWrap === false || options.trim === false)) {
125
+ rows.push('');
126
+ rowLength = 0;
127
+ }
128
+ if (rowLength || options.trim === false) {
129
+ rows[rows.length - 1] += ' ';
130
+ rowLength++;
131
+ }
132
+ }
133
+ const wordLength = stringWidth(word);
134
+ if (options.hard && wordLength > columns) {
135
+ const remainingColumns = columns - rowLength;
136
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
137
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
138
+ if (breaksStartingNextLine < breaksStartingThisLine) {
139
+ rows.push('');
140
+ }
141
+ wrapWord(rows, word, columns);
142
+ rowLength = stringWidth(rows.at(-1) ?? '');
143
+ continue;
144
+ }
145
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
146
+ if (options.wordWrap === false && rowLength < columns) {
147
+ wrapWord(rows, word, columns);
148
+ rowLength = stringWidth(rows.at(-1) ?? '');
149
+ continue;
150
+ }
151
+ rows.push('');
152
+ rowLength = 0;
153
+ }
154
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
155
+ wrapWord(rows, word, columns);
156
+ rowLength = stringWidth(rows.at(-1) ?? '');
157
+ continue;
158
+ }
159
+ rows[rows.length - 1] += word;
160
+ rowLength += wordLength;
161
+ }
162
+ if (options.trim !== false) {
163
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
164
+ }
165
+ const preString = rows.join('\n');
166
+ let inSurrogate = false;
167
+ for (let i = 0; i < preString.length; i++) {
168
+ const character = preString[i];
169
+ returnValue += character;
170
+ if (!inSurrogate) {
171
+ inSurrogate = character >= '\ud800' && character <= '\udbff';
172
+ if (inSurrogate) {
173
+ continue;
174
+ }
175
+ }
176
+ else {
177
+ inSurrogate = false;
178
+ }
179
+ if (character === ESC || character === CSI) {
180
+ GROUP_REGEX.lastIndex = i + 1;
181
+ const groupsResult = GROUP_REGEX.exec(preString);
182
+ const groups = groupsResult?.groups;
183
+ if (groups?.code !== undefined) {
184
+ const code = Number.parseFloat(groups.code);
185
+ escapeCode = code === END_CODE ? undefined : code;
186
+ }
187
+ else if (groups?.uri !== undefined) {
188
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
189
+ }
190
+ }
191
+ if (preString[i + 1] === '\n') {
192
+ if (escapeUrl) {
193
+ returnValue += wrapAnsiHyperlink('');
194
+ }
195
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
196
+ if (escapeCode && closingCode) {
197
+ returnValue += wrapAnsiCode(closingCode);
198
+ }
199
+ }
200
+ else if (character === '\n') {
201
+ if (escapeCode && getClosingCode(escapeCode)) {
202
+ returnValue += wrapAnsiCode(escapeCode);
203
+ }
204
+ if (escapeUrl) {
205
+ returnValue += wrapAnsiHyperlink(escapeUrl);
206
+ }
207
+ }
208
+ }
209
+ return returnValue;
210
+ };
211
+ const CRLF_OR_LF = /\r?\n/;
212
+ export function wrapAnsi(string, columns, options) {
213
+ return String(string)
214
+ .normalize()
215
+ .split(CRLF_OR_LF)
216
+ .map((line) => exec(line, columns, options))
217
+ .join('\n');
218
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "fast-wrap-ansi",
3
+ "version": "0.2.2",
4
+ "files": [
5
+ "lib"
6
+ ],
7
+ "description": "A tiny and fast text wrap library which takes ANSI escapes into account.",
8
+ "keywords": [
9
+ "wrap",
10
+ "ansi",
11
+ "term",
12
+ "colors"
13
+ ],
14
+ "homepage": "https://github.com/43081j/fast-wrap-ansi#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/43081j/fast-wrap-ansi/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/43081j/fast-wrap-ansi.git"
21
+ },
22
+ "license": "MIT",
23
+ "author": "James Garbutt (https://github.com/43081j)",
24
+ "type": "module",
25
+ "main": "lib/main.js",
26
+ "scripts": {
27
+ "format": "prettier --write src test",
28
+ "lint": "npm run lint:js && npm run lint:format && npm run lint:types",
29
+ "lint:js": "eslint src test",
30
+ "lint:format": "prettier --check src test",
31
+ "lint:types": "npx tsc --noEmit -p tsconfig.test.json",
32
+ "build": "tsc",
33
+ "test": "vitest run"
34
+ },
35
+ "devDependencies": {
36
+ "@eslint/js": "^10.0.1",
37
+ "@types/node": "^25.8.0",
38
+ "eslint": "^10.4.0",
39
+ "fast-wrap-ansi-prod": "npm:fast-wrap-ansi@*",
40
+ "picocolors": "^1.1.1",
41
+ "prettier": "^3.8.3",
42
+ "tinybench": "^6.0.2",
43
+ "typescript": "^6.0.3",
44
+ "typescript-eslint": "^8.59.3",
45
+ "vitest": "^4.1.6",
46
+ "wrap-ansi": "^10.0.0"
47
+ },
48
+ "dependencies": {
49
+ "fast-string-width": "^3.0.2"
50
+ }
51
+ }
@@ -0,0 +1,15 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter and Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,68 @@
1
+ # mute-stream
2
+
3
+ Bytes go in, but they don't come out (when muted).
4
+
5
+ This is a basic pass-through stream, but when muted, the bytes are
6
+ silently dropped, rather than being passed through.
7
+
8
+ ## Usage
9
+
10
+ ```javascript
11
+ const MuteStream = require('mute-stream')
12
+
13
+ const ms = new MuteStream(options)
14
+
15
+ ms.pipe(process.stdout)
16
+ ms.write('foo') // writes 'foo' to stdout
17
+ ms.mute()
18
+ ms.write('bar') // does not write 'bar'
19
+ ms.unmute()
20
+ ms.write('baz') // writes 'baz' to stdout
21
+
22
+ // can also be used to mute incoming data
23
+ const ms = new MuteStream()
24
+ input.pipe(ms)
25
+
26
+ ms.on('data', function (c) {
27
+ console.log('data: ' + c)
28
+ })
29
+
30
+ input.emit('data', 'foo') // logs 'foo'
31
+ ms.mute()
32
+ input.emit('data', 'bar') // does not log 'bar'
33
+ ms.unmute()
34
+ input.emit('data', 'baz') // logs 'baz'
35
+ ```
36
+
37
+ ## Options
38
+
39
+ All options are optional.
40
+
41
+ * `replace` Set to a string to replace each character with the
42
+ specified string when muted. (So you can show `****` instead of the
43
+ password, for example.)
44
+
45
+ * `prompt` If you are using a replacement char, and also using a
46
+ prompt with a readline stream (as for a `Password: *****` input),
47
+ then specify what the prompt is so that backspace will work
48
+ properly. Otherwise, pressing backspace will overwrite the prompt
49
+ with the replacement character, which is weird.
50
+
51
+ ## ms.mute()
52
+
53
+ Set `muted` to `true`. Turns `.write()` into a no-op.
54
+
55
+ ## ms.unmute()
56
+
57
+ Set `muted` to `false`
58
+
59
+ ## ms.isTTY
60
+
61
+ True if the pipe destination is a TTY, or if the incoming pipe source is
62
+ a TTY.
63
+
64
+ ## Other stream methods...
65
+
66
+ The other standard readable and writable stream methods are all
67
+ available. The MuteStream object acts as a facade to its pipe source
68
+ and destination.
@@ -0,0 +1,142 @@
1
+ const Stream = require('stream')
2
+
3
+ class MuteStream extends Stream {
4
+ #isTTY = null
5
+
6
+ constructor (opts = {}) {
7
+ super(opts)
8
+ this.writable = this.readable = true
9
+ this.muted = false
10
+ this.on('pipe', this._onpipe)
11
+ this.replace = opts.replace
12
+
13
+ // For readline-type situations
14
+ // This much at the start of a line being redrawn after a ctrl char
15
+ // is seen (such as backspace) won't be redrawn as the replacement
16
+ this._prompt = opts.prompt || null
17
+ this._hadControl = false
18
+ }
19
+
20
+ #destSrc (key, def) {
21
+ if (this._dest) {
22
+ return this._dest[key]
23
+ }
24
+ if (this._src) {
25
+ return this._src[key]
26
+ }
27
+ return def
28
+ }
29
+
30
+ #proxy (method, ...args) {
31
+ if (typeof this._dest?.[method] === 'function') {
32
+ this._dest[method](...args)
33
+ }
34
+ if (typeof this._src?.[method] === 'function') {
35
+ this._src[method](...args)
36
+ }
37
+ }
38
+
39
+ get isTTY () {
40
+ if (this.#isTTY !== null) {
41
+ return this.#isTTY
42
+ }
43
+ return this.#destSrc('isTTY', false)
44
+ }
45
+
46
+ // basically just get replace the getter/setter with a regular value
47
+ set isTTY (val) {
48
+ this.#isTTY = val
49
+ }
50
+
51
+ get rows () {
52
+ return this.#destSrc('rows')
53
+ }
54
+
55
+ get columns () {
56
+ return this.#destSrc('columns')
57
+ }
58
+
59
+ mute () {
60
+ this.muted = true
61
+ }
62
+
63
+ unmute () {
64
+ this.muted = false
65
+ }
66
+
67
+ _onpipe (src) {
68
+ this._src = src
69
+ }
70
+
71
+ pipe (dest, options) {
72
+ this._dest = dest
73
+ return super.pipe(dest, options)
74
+ }
75
+
76
+ pause () {
77
+ if (this._src) {
78
+ return this._src.pause()
79
+ }
80
+ }
81
+
82
+ resume () {
83
+ if (this._src) {
84
+ return this._src.resume()
85
+ }
86
+ }
87
+
88
+ write (c) {
89
+ if (this.muted) {
90
+ if (!this.replace) {
91
+ return true
92
+ }
93
+ // eslint-disable-next-line no-control-regex
94
+ if (c.match(/^\u001b/)) {
95
+ if (c.indexOf(this._prompt) === 0) {
96
+ c = c.slice(this._prompt.length)
97
+ c = c.replace(/./g, this.replace)
98
+ c = this._prompt + c
99
+ }
100
+ this._hadControl = true
101
+ return this.emit('data', c)
102
+ } else {
103
+ if (this._prompt && this._hadControl &&
104
+ c.indexOf(this._prompt) === 0) {
105
+ this._hadControl = false
106
+ this.emit('data', this._prompt)
107
+ c = c.slice(this._prompt.length)
108
+ }
109
+ c = c.toString().replace(/./g, this.replace)
110
+ }
111
+ }
112
+ this.emit('data', c)
113
+ }
114
+
115
+ end (c) {
116
+ if (this.muted) {
117
+ if (c && this.replace) {
118
+ c = c.toString().replace(/./g, this.replace)
119
+ } else {
120
+ c = null
121
+ }
122
+ }
123
+ if (c) {
124
+ this.emit('data', c)
125
+ }
126
+ this.emit('end')
127
+ }
128
+
129
+ destroy (...args) {
130
+ return this.#proxy('destroy', ...args)
131
+ }
132
+
133
+ destroySoon (...args) {
134
+ return this.#proxy('destroySoon', ...args)
135
+ }
136
+
137
+ close (...args) {
138
+ return this.#proxy('close', ...args)
139
+ }
140
+ }
141
+
142
+ module.exports = MuteStream
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "mute-stream",
3
+ "version": "3.0.0",
4
+ "main": "lib/index.js",
5
+ "devDependencies": {
6
+ "@npmcli/eslint-config": "^5.0.0",
7
+ "@npmcli/template-oss": "4.27.1",
8
+ "tap": "^16.3.0"
9
+ },
10
+ "scripts": {
11
+ "test": "tap",
12
+ "lint": "npm run eslint",
13
+ "postlint": "template-oss-check",
14
+ "template-oss-apply": "template-oss-apply --force",
15
+ "lintfix": "npm run eslint -- --fix",
16
+ "snap": "tap",
17
+ "posttest": "npm run lint",
18
+ "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/npm/mute-stream.git"
23
+ },
24
+ "keywords": [
25
+ "mute",
26
+ "stream",
27
+ "pipe"
28
+ ],
29
+ "author": "GitHub Inc.",
30
+ "license": "ISC",
31
+ "description": "Bytes go in, but they don't come out (when muted).",
32
+ "files": [
33
+ "bin/",
34
+ "lib/"
35
+ ],
36
+ "tap": {
37
+ "statements": 70,
38
+ "branches": 60,
39
+ "functions": 81,
40
+ "lines": 70,
41
+ "nyc-arg": [
42
+ "--exclude",
43
+ "tap-snapshots/**"
44
+ ]
45
+ },
46
+ "engines": {
47
+ "node": "^20.17.0 || >=22.9.0"
48
+ },
49
+ "templateOSS": {
50
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
51
+ "version": "4.27.1",
52
+ "publish": true
53
+ }
54
+ }