mepcli 1.0.0-beta.6 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/dist/prompts/breadcrumb-search.js +0 -26
- package/dist/prompts/multi-range.js +0 -14
- package/dist/prompts/phone.js +1 -5
- package/package.json +51 -51
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 CodeTease
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CodeTease
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ A **CodeTease** project.
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
16
16
|
- **Zero Dependency:** Keeps your project clean and fast.
|
|
17
|
-
- **Comprehensive:**
|
|
17
|
+
- **Comprehensive:** 70+ prompt types for every need.
|
|
18
18
|
- **Mouse Support:** Built-in scroll and click interaction.
|
|
19
19
|
- **Responsive:** Fluid cursor movement and validation.
|
|
20
20
|
- **Elegant:** Modern ANSI color styling.
|
|
@@ -98,9 +98,6 @@ class BreadcrumbSearchPrompt extends breadcrumb_1.BreadcrumbPrompt {
|
|
|
98
98
|
const entry = this.filteredEntries[this.searchCursor];
|
|
99
99
|
if (entry.isDirectory) {
|
|
100
100
|
// Drill down
|
|
101
|
-
// We need to match the cursor in the real currentEntries list to call drillDown?
|
|
102
|
-
// Or just implement custom drillDown logic here.
|
|
103
|
-
// Because `drillDown` uses `this.cursor` and `this.currentEntries`.
|
|
104
101
|
// Hack: Find index in currentEntries
|
|
105
102
|
const realIndex = this.currentEntries.findIndex(e => e.name === entry.name);
|
|
106
103
|
if (realIndex !== -1) {
|
|
@@ -167,7 +164,6 @@ class BreadcrumbSearchPrompt extends breadcrumb_1.BreadcrumbPrompt {
|
|
|
167
164
|
return;
|
|
168
165
|
}
|
|
169
166
|
// Render Search Overlay
|
|
170
|
-
const width = this.stdout.columns || 80;
|
|
171
167
|
let output = '';
|
|
172
168
|
// Breadcrumb + Search Bar
|
|
173
169
|
const relative = path.relative(this.root, this.currentPath);
|
|
@@ -181,28 +177,6 @@ class BreadcrumbSearchPrompt extends breadcrumb_1.BreadcrumbPrompt {
|
|
|
181
177
|
else {
|
|
182
178
|
const pageSize = this.pageSize;
|
|
183
179
|
let start = 0;
|
|
184
|
-
// Adjust Scroll Top for Search
|
|
185
|
-
// We reuse `scrollTop`? No, let's just calc dynamically or use local var?
|
|
186
|
-
// Since `render` is called frequently, let's just show top N for now or simple scroll logic
|
|
187
|
-
// To keep it simple, we can center the cursor or just standard scroll
|
|
188
|
-
// Reuse scrollTop logic but locally
|
|
189
|
-
let localScrollTop = 0;
|
|
190
|
-
if (this.searchCursor < localScrollTop) {
|
|
191
|
-
localScrollTop = this.searchCursor;
|
|
192
|
-
}
|
|
193
|
-
else if (this.searchCursor >= localScrollTop + pageSize) {
|
|
194
|
-
localScrollTop = this.searchCursor - pageSize + 1;
|
|
195
|
-
}
|
|
196
|
-
// But wait, `localScrollTop` isn't persisted across renders.
|
|
197
|
-
// We should persist it or derive it from searchCursor assuming we want to keep cursor in view.
|
|
198
|
-
// Since we re-render whole frame, we can just compute "window" around searchCursor.
|
|
199
|
-
// Simplest: Always show cursor in view.
|
|
200
|
-
// We can't really do smooth scrolling without state.
|
|
201
|
-
// Let's assume we show a window where cursor is roughly middle or just clamped.
|
|
202
|
-
// Actually, the base class persists `scrollTop`. We can use a separate property if we want,
|
|
203
|
-
// but `this.scrollTop` is protected. We can use it for search mode too?
|
|
204
|
-
// But switching back and forth might mess it up.
|
|
205
|
-
// Let's rely on calculating start index.
|
|
206
180
|
const half = Math.floor(pageSize / 2);
|
|
207
181
|
start = Math.max(0, this.searchCursor - half);
|
|
208
182
|
if (start + pageSize > this.filteredEntries.length) {
|
|
@@ -51,9 +51,6 @@ class MultiRangePrompt extends select_range_1.SelectRangePrompt {
|
|
|
51
51
|
allIndices.add(i);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
// If no ranges committed, maybe they just wanted to select the current item?
|
|
55
|
-
// "MultiRange" implies multiple ranges. If empty, maybe just current item?
|
|
56
|
-
// Behavior: if empty, select current item (as a range of 1).
|
|
57
54
|
if (allIndices.size === 0) {
|
|
58
55
|
allIndices.add(this.selectedIndex);
|
|
59
56
|
}
|
|
@@ -87,17 +84,6 @@ class MultiRangePrompt extends select_range_1.SelectRangePrompt {
|
|
|
87
84
|
this.render(false);
|
|
88
85
|
return;
|
|
89
86
|
}
|
|
90
|
-
// Delegate navigation and search to SelectPrompt (parent of SelectRangePrompt)
|
|
91
|
-
// We skip SelectRangePrompt.handleInput because we overrode the logic completely for Space/Enter
|
|
92
|
-
// But we want SelectPrompt's navigation. SelectRangePrompt inherits SelectPrompt.
|
|
93
|
-
// `super` here refers to SelectRangePrompt.
|
|
94
|
-
// SelectRangePrompt calls super.handleInput for navigation.
|
|
95
|
-
// So we can call super.handleInput for non-special keys?
|
|
96
|
-
// Wait, SelectRangePrompt.handleInput handles Space and Enter.
|
|
97
|
-
// If we call super.handleInput(char), it might handle Space/Enter incorrectly (SelectRangePrompt logic).
|
|
98
|
-
// So we should call SelectPrompt.prototype.handleInput if we could, but we can't easily.
|
|
99
|
-
// Or we can manually check for navigation keys, OR just rely on the fact that we handled Space/Enter above,
|
|
100
|
-
// so if we pass other keys to super.handleInput, they will fall through to SelectPrompt logic.
|
|
101
87
|
super.handleInput(char, key);
|
|
102
88
|
}
|
|
103
89
|
render(_firstRender) {
|
package/dist/prompts/phone.js
CHANGED
|
@@ -49,8 +49,6 @@ class PhonePrompt extends base_1.Prompt {
|
|
|
49
49
|
if (mask[i] === '#') {
|
|
50
50
|
return i;
|
|
51
51
|
}
|
|
52
|
-
else {
|
|
53
|
-
}
|
|
54
52
|
}
|
|
55
53
|
if (mask[i] === '#') {
|
|
56
54
|
rawCounter++;
|
|
@@ -164,7 +162,7 @@ class PhonePrompt extends base_1.Prompt {
|
|
|
164
162
|
}
|
|
165
163
|
// Input Section
|
|
166
164
|
const formatted = this.renderFormattedNumber();
|
|
167
|
-
|
|
165
|
+
const inputRender = formatted;
|
|
168
166
|
// Layout: [Prefix] [Input]
|
|
169
167
|
const line = `${prefixRender} ${inputRender}`;
|
|
170
168
|
let output = title + line;
|
|
@@ -255,8 +253,6 @@ class PhonePrompt extends base_1.Prompt {
|
|
|
255
253
|
this.activeSection = 'country';
|
|
256
254
|
}
|
|
257
255
|
}
|
|
258
|
-
else {
|
|
259
|
-
}
|
|
260
256
|
this.render(false);
|
|
261
257
|
return;
|
|
262
258
|
}
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mepcli",
|
|
3
|
-
"version": "1.0.0-
|
|
4
|
-
"description": "Zero-dependency, interactive CLI prompt for Node.js",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/CodeTease/mep.git"
|
|
8
|
-
},
|
|
9
|
-
"main": "dist/index.js",
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"README.md",
|
|
14
|
-
"LICENSE"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
18
|
-
"prepublishOnly": "npm run build",
|
|
19
|
-
"test": "jest",
|
|
20
|
-
"demo": "ts-node example.ts",
|
|
21
|
-
"lint": "eslint .",
|
|
22
|
-
"lint:fix": "eslint . --fix"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"cli",
|
|
26
|
-
"prompt",
|
|
27
|
-
"inquirer",
|
|
28
|
-
"enquirer",
|
|
29
|
-
"interactive",
|
|
30
|
-
"zero-dependency",
|
|
31
|
-
"codetease",
|
|
32
|
-
"command-line",
|
|
33
|
-
"typescript",
|
|
34
|
-
"color",
|
|
35
|
-
"ansi"
|
|
36
|
-
],
|
|
37
|
-
"author": "CodeTease",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@eslint/js": "^9",
|
|
41
|
-
"@types/jest": "^30",
|
|
42
|
-
"@types/node": "^22",
|
|
43
|
-
"eslint": "^9",
|
|
44
|
-
"globals": "^17",
|
|
45
|
-
"jest": "^30",
|
|
46
|
-
"ts-jest": "^29",
|
|
47
|
-
"ts-node": "^10",
|
|
48
|
-
"typescript": "^5",
|
|
49
|
-
"typescript-eslint": "^8"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mepcli",
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"description": "Zero-dependency, interactive CLI prompt for Node.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/CodeTease/mep.git"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"demo": "ts-node example.ts",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"lint:fix": "eslint . --fix"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"cli",
|
|
26
|
+
"prompt",
|
|
27
|
+
"inquirer",
|
|
28
|
+
"enquirer",
|
|
29
|
+
"interactive",
|
|
30
|
+
"zero-dependency",
|
|
31
|
+
"codetease",
|
|
32
|
+
"command-line",
|
|
33
|
+
"typescript",
|
|
34
|
+
"color",
|
|
35
|
+
"ansi"
|
|
36
|
+
],
|
|
37
|
+
"author": "CodeTease",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^9",
|
|
41
|
+
"@types/jest": "^30",
|
|
42
|
+
"@types/node": "^22",
|
|
43
|
+
"eslint": "^9",
|
|
44
|
+
"globals": "^17",
|
|
45
|
+
"jest": "^30",
|
|
46
|
+
"ts-jest": "^29",
|
|
47
|
+
"ts-node": "^10",
|
|
48
|
+
"typescript": "^5",
|
|
49
|
+
"typescript-eslint": "^8"
|
|
50
|
+
}
|
|
51
|
+
}
|