statusbar-quick-actions 0.0.11 → 0.0.13
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/CHANGELOG.md +99 -0
- package/README.md +207 -0
- package/out/config-cli.js +264 -1
- package/out/extension.js +61 -8
- package/out/utils/changelog.js +89 -0
- package/package.json +3 -2
- package/src/config-cli.ts +362 -1
- package/src/extension.ts +115 -23
- package/src/utils/changelog.ts +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Generated on: 2025-12-28T04:11:29.918Z
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 9a7592e improved perfomance
|
|
10
|
+
|
|
11
|
+
README.md
|
|
12
|
+
package-lock.json
|
|
13
|
+
package.json
|
|
14
|
+
src/config-cli.ts
|
|
15
|
+
src/extension.ts
|
|
16
|
+
171f982 scripts
|
|
17
|
+
package.json
|
|
18
|
+
8062493 scripts
|
|
19
|
+
package.json
|
|
20
|
+
4c58024 feat(extension): add config CLI and performance optimizations
|
|
21
|
+
bun.lock
|
|
22
|
+
docs/PERFORMANCE_OPTIMIZATIONS.md
|
|
23
|
+
docs/PRESET_AND_DYNAMIC_LABELS.md
|
|
24
|
+
docs/SAMPLE-CONFIGURATIONS.md
|
|
25
|
+
package-lock.json
|
|
26
|
+
package.json
|
|
27
|
+
src/config-cli.ts
|
|
28
|
+
src/extension.ts
|
|
29
|
+
tsconfig.dev.json
|
|
30
|
+
tsconfig.json
|
|
31
|
+
0ba010a feat(extension): add preset system and dynamic labels for enhanced button management
|
|
32
|
+
.github/FUNDING.yml
|
|
33
|
+
PRESET_AND_DYNAMIC_LABELS.md
|
|
34
|
+
README.md
|
|
35
|
+
package-lock.json
|
|
36
|
+
package.json
|
|
37
|
+
src/configuration.ts
|
|
38
|
+
src/dynamic-label.ts
|
|
39
|
+
src/extension.ts
|
|
40
|
+
src/preset-manager.ts
|
|
41
|
+
src/types.ts
|
|
42
|
+
ad18cce chore(config): add funding configuration
|
|
43
|
+
.github/FUNDING.yml
|
|
44
|
+
2702d5a feat(extension): add icon, metadata, and update dependencies
|
|
45
|
+
.gitignore
|
|
46
|
+
.vscodeignore
|
|
47
|
+
assets/icon.png
|
|
48
|
+
bun.lock
|
|
49
|
+
package.json
|
|
50
|
+
e9a340b feat(deps): replace minimatch with rimraf for better dependency management
|
|
51
|
+
bun.lock
|
|
52
|
+
package.json
|
|
53
|
+
src/configuration.ts
|
|
54
|
+
src/extension.ts
|
|
55
|
+
src/visibility.ts
|
|
56
|
+
ed94206 feat(config): implement command object validation and error handling
|
|
57
|
+
package.json
|
|
58
|
+
src/configuration.ts
|
|
59
|
+
src/extension.ts
|
|
60
|
+
src/output-panel.ts
|
|
61
|
+
a22c1f2 chore(deps): update dependencies and build configuration
|
|
62
|
+
bun.lock
|
|
63
|
+
package.json
|
|
64
|
+
f780131 v0.0.5
|
|
65
|
+
package.json
|
|
66
|
+
421c02b feat(extension): add streaming output support with output panel management
|
|
67
|
+
package.json
|
|
68
|
+
src/executor.ts
|
|
69
|
+
src/extension.ts
|
|
70
|
+
src/material-icons.ts
|
|
71
|
+
src/output-panel.ts
|
|
72
|
+
src/types.ts
|
|
73
|
+
src/utils/debounce.ts
|
|
74
|
+
src/visibility.ts
|
|
75
|
+
736a327 v0.0.2
|
|
76
|
+
package.json
|
|
77
|
+
e0d7c7f feat(deps): add @involvex/rmdir-cli dependency and update clean script
|
|
78
|
+
bun.lock
|
|
79
|
+
package.json
|
|
80
|
+
0e4ddf9 feat: initial implementation of StatusBar Quick Actions extension
|
|
81
|
+
.gitignore
|
|
82
|
+
.vscodeignore
|
|
83
|
+
CLAUDE.md
|
|
84
|
+
LICENSE
|
|
85
|
+
README.md
|
|
86
|
+
SAMPLE-CONFIGURATIONS.md
|
|
87
|
+
bun.lock
|
|
88
|
+
eslint.config.mjs
|
|
89
|
+
package-lock.json
|
|
90
|
+
package.json
|
|
91
|
+
src/configuration.ts
|
|
92
|
+
src/executor.ts
|
|
93
|
+
src/extension.ts
|
|
94
|
+
src/history.ts
|
|
95
|
+
src/notifications.ts
|
|
96
|
+
src/theme.ts
|
|
97
|
+
src/types.ts
|
|
98
|
+
src/visibility.ts
|
|
99
|
+
tsconfig.json
|
package/README.md
CHANGED
|
@@ -93,6 +93,213 @@ The extension includes comprehensive sample configurations for various project t
|
|
|
93
93
|
|
|
94
94
|
See `SAMPLE-CONFIGURATIONS.md` for detailed examples.
|
|
95
95
|
|
|
96
|
+
## Configuration CLI
|
|
97
|
+
|
|
98
|
+
The extension includes a powerful command-line interface for managing configurations without opening VSCode settings.
|
|
99
|
+
|
|
100
|
+
### Running the CLI
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Using bun (recommended)
|
|
104
|
+
bun run dev:cli
|
|
105
|
+
|
|
106
|
+
# Or directly
|
|
107
|
+
bun src/config-cli.ts
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### CLI Features
|
|
111
|
+
|
|
112
|
+
The CLI provides an interactive menu with the following options:
|
|
113
|
+
|
|
114
|
+
#### 1. View Current Configuration
|
|
115
|
+
|
|
116
|
+
Display all configured buttons with their properties:
|
|
117
|
+
|
|
118
|
+
- Button ID, text, and command type
|
|
119
|
+
- Enabled/disabled status
|
|
120
|
+
- Current debug mode setting
|
|
121
|
+
|
|
122
|
+
#### 2. Apply Preset
|
|
123
|
+
|
|
124
|
+
Apply pre-built button configurations:
|
|
125
|
+
|
|
126
|
+
- **Node.js Development**: npm start, test, build
|
|
127
|
+
- **Bun Development**: bun dev, test, build
|
|
128
|
+
- **Git Workflow**: git status, pull, push
|
|
129
|
+
|
|
130
|
+
Merge modes:
|
|
131
|
+
|
|
132
|
+
- Replace all (removes existing buttons)
|
|
133
|
+
- Append (adds to existing buttons)
|
|
134
|
+
- Merge (replaces buttons with same ID)
|
|
135
|
+
|
|
136
|
+
#### 3. Add Button
|
|
137
|
+
|
|
138
|
+
Interactive wizard to create new buttons:
|
|
139
|
+
|
|
140
|
+
- Supports all command types (npm, yarn, pnpm, bun, shell, vscode, task, detect)
|
|
141
|
+
- Auto-generates unique IDs
|
|
142
|
+
- Configures text, tooltip, and command
|
|
143
|
+
|
|
144
|
+
#### 4. Remove Button
|
|
145
|
+
|
|
146
|
+
Delete buttons from configuration with confirmation.
|
|
147
|
+
|
|
148
|
+
#### 5. Toggle Debug Mode
|
|
149
|
+
|
|
150
|
+
Enable or disable debug logging for the extension.
|
|
151
|
+
|
|
152
|
+
#### 6. Export Configuration
|
|
153
|
+
|
|
154
|
+
Save current configuration to a JSON file for backup or sharing.
|
|
155
|
+
|
|
156
|
+
#### 7. Import Configuration
|
|
157
|
+
|
|
158
|
+
Load configuration from a JSON file with merge or replace options.
|
|
159
|
+
|
|
160
|
+
#### 8. Apply Label Preset
|
|
161
|
+
|
|
162
|
+
Add dynamic labels to buttons for real-time information:
|
|
163
|
+
|
|
164
|
+
**Git Presets**:
|
|
165
|
+
|
|
166
|
+
- **Git Branch**: Show current branch (`$(git-branch) main`)
|
|
167
|
+
- **Git Status**: Show repository status (`$(git-commit) Clean`)
|
|
168
|
+
- **Git Remote URL**: Show remote origin URL
|
|
169
|
+
|
|
170
|
+
**Package Presets**:
|
|
171
|
+
|
|
172
|
+
- **NPM Package Version**: Monitor package versions from npm registry
|
|
173
|
+
- Prompts for package name (e.g., `vscode`, `react`)
|
|
174
|
+
- Updates every 5 minutes
|
|
175
|
+
- Shows version like `$(package) v1.2.3`
|
|
176
|
+
|
|
177
|
+
**System Presets**:
|
|
178
|
+
|
|
179
|
+
- **Current Time**: Display real-time clock
|
|
180
|
+
- **Environment Variable**: Show any environment variable value
|
|
181
|
+
|
|
182
|
+
Example workflow:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# 1. Select "Apply Label Preset"
|
|
186
|
+
# 2. Choose settings location (user/workspace)
|
|
187
|
+
# 3. Select button to modify
|
|
188
|
+
# 4. Choose preset (e.g., "Git Branch")
|
|
189
|
+
# 5. Label updates automatically in VSCode
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### 9. Configure Performance
|
|
193
|
+
|
|
194
|
+
Optimize extension performance with these settings:
|
|
195
|
+
|
|
196
|
+
**Visibility Debounce** (0-5000ms):
|
|
197
|
+
|
|
198
|
+
- Delay before checking button visibility conditions
|
|
199
|
+
- Lower = more responsive, higher = better performance
|
|
200
|
+
- Recommended: 300ms (balanced)
|
|
201
|
+
|
|
202
|
+
**Virtualization**:
|
|
203
|
+
|
|
204
|
+
- Enable for large button lists (10+ buttons)
|
|
205
|
+
- Improves rendering performance
|
|
206
|
+
- Slight delay on initial load
|
|
207
|
+
|
|
208
|
+
**Result Caching**:
|
|
209
|
+
|
|
210
|
+
- Cache visibility check results
|
|
211
|
+
- Reduces redundant computations
|
|
212
|
+
- Recommended: enabled
|
|
213
|
+
|
|
214
|
+
**Performance Presets**:
|
|
215
|
+
|
|
216
|
+
1. **Balanced** (300ms debounce, caching on)
|
|
217
|
+
- Best for most users
|
|
218
|
+
- Good balance of responsiveness and performance
|
|
219
|
+
|
|
220
|
+
2. **Fast** (100ms debounce, caching on, virtualization on)
|
|
221
|
+
- For users with many buttons
|
|
222
|
+
- Maximum responsiveness
|
|
223
|
+
- Slightly higher CPU usage
|
|
224
|
+
|
|
225
|
+
3. **Minimal** (0ms debounce, caching off)
|
|
226
|
+
- For debugging or testing
|
|
227
|
+
- Instant updates but higher resource usage
|
|
228
|
+
|
|
229
|
+
#### 10. Reset to Defaults
|
|
230
|
+
|
|
231
|
+
Remove all buttons and reset settings to defaults (requires confirmation).
|
|
232
|
+
|
|
233
|
+
#### 11. Help
|
|
234
|
+
|
|
235
|
+
Display comprehensive help and usage information.
|
|
236
|
+
|
|
237
|
+
### Settings Locations
|
|
238
|
+
|
|
239
|
+
The CLI allows managing two types of settings:
|
|
240
|
+
|
|
241
|
+
**User Settings (Global)**:
|
|
242
|
+
|
|
243
|
+
- Location: `%APPDATA%\Code\User\settings.json` (Windows)
|
|
244
|
+
- Location: `~/Library/Application Support/Code/User/settings.json` (macOS)
|
|
245
|
+
- Location: `~/.config/Code/User/settings.json` (Linux)
|
|
246
|
+
- Applies to all VSCode workspaces
|
|
247
|
+
|
|
248
|
+
**Workspace Settings (Project-specific)**:
|
|
249
|
+
|
|
250
|
+
- Location: `<workspace>/.vscode/settings.json`
|
|
251
|
+
- Only applies to current project
|
|
252
|
+
- Overrides user settings
|
|
253
|
+
|
|
254
|
+
### CLI Examples
|
|
255
|
+
|
|
256
|
+
**Example 1: Quick Setup with Preset**
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
$ bun run dev:cli
|
|
260
|
+
# Choose option 2 (Apply Preset)
|
|
261
|
+
# Select location: 1 (User settings)
|
|
262
|
+
# Select preset: 1 (Node.js Development)
|
|
263
|
+
# Select merge mode: 1 (Replace all)
|
|
264
|
+
✅ Preset "Node.js Development" applied to user settings
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Example 2: Add Dynamic Git Branch Label**
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
$ bun run dev:cli
|
|
271
|
+
# Choose option 8 (Apply Label Preset)
|
|
272
|
+
# Select location: 2 (Workspace settings)
|
|
273
|
+
# Select button: 1 (Your existing button)
|
|
274
|
+
# Select preset: 1 (Git Branch)
|
|
275
|
+
✅ Label preset "Git Branch" applied to button "My Button"
|
|
276
|
+
# Button now shows: $(git-branch) main (updates automatically)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Example 3: Optimize Performance**
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
$ bun run dev:cli
|
|
283
|
+
# Choose option 9 (Configure Performance)
|
|
284
|
+
# Select location: 1 (User settings)
|
|
285
|
+
# Choose option 4 (Apply Performance Preset)
|
|
286
|
+
# Select preset: 2 (Fast)
|
|
287
|
+
✅ Performance settings updated
|
|
288
|
+
# Debounce: 100ms, Caching: Enabled, Virtualization: Enabled
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Example 4: Add NPM Version Monitor**
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
$ bun run dev:cli
|
|
295
|
+
# Choose option 8 (Apply Label Preset)
|
|
296
|
+
# Select button to modify
|
|
297
|
+
# Select preset: 4 (NPM Package Version)
|
|
298
|
+
# Enter package name: react
|
|
299
|
+
✅ Label preset "NPM Package Version" applied
|
|
300
|
+
# Button shows: $(package) v18.2.0 (updates every 5 minutes)
|
|
301
|
+
```
|
|
302
|
+
|
|
96
303
|
## Configuration Options
|
|
97
304
|
|
|
98
305
|
### Button Configuration
|
package/out/config-cli.js
CHANGED
|
@@ -143,6 +143,73 @@ const BUILTIN_PRESETS = {
|
|
|
143
143
|
},
|
|
144
144
|
},
|
|
145
145
|
};
|
|
146
|
+
const LABEL_PRESETS = {
|
|
147
|
+
"git-branch": {
|
|
148
|
+
name: "Git Branch",
|
|
149
|
+
description: "Show current git branch",
|
|
150
|
+
config: {
|
|
151
|
+
type: "git",
|
|
152
|
+
gitInfo: "branch",
|
|
153
|
+
template: "$(git-branch) ${value}",
|
|
154
|
+
fallback: "$(git-branch) No Git",
|
|
155
|
+
refreshInterval: 5000,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
"git-status": {
|
|
159
|
+
name: "Git Status",
|
|
160
|
+
description: "Show git repository status",
|
|
161
|
+
config: {
|
|
162
|
+
type: "git",
|
|
163
|
+
gitInfo: "status",
|
|
164
|
+
template: "$(git-commit) ${value}",
|
|
165
|
+
fallback: "$(git-commit) Clean",
|
|
166
|
+
refreshInterval: 5000,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
"git-remote": {
|
|
170
|
+
name: "Git Remote URL",
|
|
171
|
+
description: "Show git remote origin URL",
|
|
172
|
+
config: {
|
|
173
|
+
type: "git",
|
|
174
|
+
gitInfo: "remote",
|
|
175
|
+
template: "$(globe) ${value}",
|
|
176
|
+
fallback: "$(globe) No Remote",
|
|
177
|
+
refreshInterval: 30000,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
"npm-version": {
|
|
181
|
+
name: "NPM Package Version",
|
|
182
|
+
description: "Show latest package version from npm registry",
|
|
183
|
+
config: {
|
|
184
|
+
type: "url",
|
|
185
|
+
url: "https://registry.npmjs.org/${packageName}/latest",
|
|
186
|
+
template: "$(package) v${value.version}",
|
|
187
|
+
fallback: "$(package) Unknown",
|
|
188
|
+
refreshInterval: 300000,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
"current-time": {
|
|
192
|
+
name: "Current Time",
|
|
193
|
+
description: "Show current time",
|
|
194
|
+
config: {
|
|
195
|
+
type: "time",
|
|
196
|
+
format: "HH:mm:ss",
|
|
197
|
+
template: "$(clock) ${value}",
|
|
198
|
+
refreshInterval: 1000,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
"env-variable": {
|
|
202
|
+
name: "Environment Variable",
|
|
203
|
+
description: "Show an environment variable value",
|
|
204
|
+
config: {
|
|
205
|
+
type: "env",
|
|
206
|
+
envVar: "NODE_ENV",
|
|
207
|
+
template: "$(symbol-property) ${value}",
|
|
208
|
+
fallback: "$(symbol-property) Not Set",
|
|
209
|
+
refreshInterval: 0,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
};
|
|
146
213
|
const MENU_OPTIONS = [
|
|
147
214
|
{
|
|
148
215
|
key: "1",
|
|
@@ -195,13 +262,27 @@ const MENU_OPTIONS = [
|
|
|
195
262
|
},
|
|
196
263
|
{
|
|
197
264
|
key: "8",
|
|
265
|
+
label: "Apply Label Preset",
|
|
266
|
+
description: "Apply dynamic label preset to a button",
|
|
267
|
+
action: applyLabelPreset,
|
|
268
|
+
requiresConfirmation: false,
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
key: "9",
|
|
272
|
+
label: "Configure Performance",
|
|
273
|
+
description: "Adjust performance settings (caching, debounce)",
|
|
274
|
+
action: configurePerformance,
|
|
275
|
+
requiresConfirmation: false,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
key: "10",
|
|
198
279
|
label: "Reset to Defaults",
|
|
199
280
|
description: "Reset all settings to default values",
|
|
200
281
|
action: resetToDefaults,
|
|
201
282
|
requiresConfirmation: true,
|
|
202
283
|
},
|
|
203
284
|
{
|
|
204
|
-
key: "
|
|
285
|
+
key: "11",
|
|
205
286
|
label: "Help",
|
|
206
287
|
description: "Show help and usage information",
|
|
207
288
|
action: showHelp,
|
|
@@ -372,6 +453,20 @@ class SettingsManager {
|
|
|
372
453
|
settings["statusbarQuickActions.settings.debug"] = enabled;
|
|
373
454
|
this.writeSettings(location, settings);
|
|
374
455
|
}
|
|
456
|
+
static getPerformanceSettings(location) {
|
|
457
|
+
const settings = this.readSettings(location);
|
|
458
|
+
const performance = settings["statusbarQuickActions.settings.performance"];
|
|
459
|
+
return {
|
|
460
|
+
visibilityDebounceMs: performance?.visibilityDebounceMs ?? 300,
|
|
461
|
+
enableVirtualization: performance?.enableVirtualization ?? false,
|
|
462
|
+
cacheResults: performance?.cacheResults ?? true,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
static setPerformanceSettings(location, performance) {
|
|
466
|
+
const settings = this.readSettings(location);
|
|
467
|
+
settings["statusbarQuickActions.settings.performance"] = performance;
|
|
468
|
+
this.writeSettings(location, settings);
|
|
469
|
+
}
|
|
375
470
|
}
|
|
376
471
|
class InputValidator {
|
|
377
472
|
static validateChoice(input) {
|
|
@@ -753,6 +848,174 @@ async function resetToDefaults() {
|
|
|
753
848
|
SettingsManager.setDebugMode(location, false);
|
|
754
849
|
ConsoleUI.printSuccess(`${location} settings reset to defaults`);
|
|
755
850
|
}
|
|
851
|
+
async function applyLabelPreset() {
|
|
852
|
+
ConsoleUI.clear();
|
|
853
|
+
ConsoleUI.printBanner();
|
|
854
|
+
const location = await InputHandler.promptLocation();
|
|
855
|
+
const buttons = SettingsManager.getButtons(location);
|
|
856
|
+
if (buttons.length === 0) {
|
|
857
|
+
ConsoleUI.printWarning("No buttons available. Add a button first.");
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
console.log("Select button to apply label preset:\n");
|
|
861
|
+
buttons.forEach((btn, idx) => {
|
|
862
|
+
console.log(` ${idx + 1}. ${btn.text} (${btn.id})`);
|
|
863
|
+
});
|
|
864
|
+
console.log(`\nChoice (1-${buttons.length}): `);
|
|
865
|
+
const buttonInput = await InputHandler.getInput(10000);
|
|
866
|
+
if (!buttonInput) {
|
|
867
|
+
ConsoleUI.printWarning("Operation cancelled");
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
const buttonIndex = parseInt(buttonInput, 10) - 1;
|
|
871
|
+
if (buttonIndex < 0 || buttonIndex >= buttons.length) {
|
|
872
|
+
ConsoleUI.printError("Invalid button selection");
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
console.log("\nAvailable Label Presets:\n");
|
|
876
|
+
const presetKeys = Object.keys(LABEL_PRESETS);
|
|
877
|
+
presetKeys.forEach((key, idx) => {
|
|
878
|
+
const preset = LABEL_PRESETS[key];
|
|
879
|
+
console.log(` ${idx + 1}. ${preset.name}`);
|
|
880
|
+
console.log(` ${CONFIG.colors.dim}${preset.description}${CONFIG.colors.reset}`);
|
|
881
|
+
console.log(` ${CONFIG.colors.dim}Refresh: ${preset.config.refreshInterval || 0}ms${CONFIG.colors.reset}`);
|
|
882
|
+
console.log();
|
|
883
|
+
});
|
|
884
|
+
console.log(`Select preset (1-${presetKeys.length}): `);
|
|
885
|
+
const presetInput = await InputHandler.getInput(10000);
|
|
886
|
+
if (!presetInput) {
|
|
887
|
+
ConsoleUI.printWarning("Operation cancelled");
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
const presetIndex = parseInt(presetInput, 10) - 1;
|
|
891
|
+
if (presetIndex < 0 || presetIndex >= presetKeys.length) {
|
|
892
|
+
ConsoleUI.printError("Invalid preset selection");
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
const presetKey = presetKeys[presetIndex];
|
|
896
|
+
const preset = LABEL_PRESETS[presetKey];
|
|
897
|
+
const button = buttons[buttonIndex];
|
|
898
|
+
if (presetKey === "npm-version") {
|
|
899
|
+
console.log("\nPackage name to monitor: ");
|
|
900
|
+
const packageName = await InputHandler.getInput(10000);
|
|
901
|
+
if (!packageName) {
|
|
902
|
+
ConsoleUI.printWarning("Operation cancelled");
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
preset.config.url = preset.config.url?.replace("${packageName}", packageName);
|
|
906
|
+
}
|
|
907
|
+
if (presetKey === "env-variable") {
|
|
908
|
+
console.log("\nEnvironment variable name: ");
|
|
909
|
+
const envVar = await InputHandler.getInput(10000);
|
|
910
|
+
if (!envVar) {
|
|
911
|
+
ConsoleUI.printWarning("Operation cancelled");
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
preset.config.envVar = envVar;
|
|
915
|
+
}
|
|
916
|
+
button.dynamicLabel = preset.config;
|
|
917
|
+
buttons[buttonIndex] = button;
|
|
918
|
+
SettingsManager.setButtons(location, buttons);
|
|
919
|
+
ConsoleUI.printSuccess(`Label preset "${preset.name}" applied to button "${button.text}"`);
|
|
920
|
+
}
|
|
921
|
+
async function configurePerformance() {
|
|
922
|
+
ConsoleUI.clear();
|
|
923
|
+
ConsoleUI.printBanner();
|
|
924
|
+
const location = await InputHandler.promptLocation();
|
|
925
|
+
const currentSettings = SettingsManager.getPerformanceSettings(location);
|
|
926
|
+
ConsoleUI.printDivider();
|
|
927
|
+
console.log("Current Performance Settings");
|
|
928
|
+
ConsoleUI.printDivider();
|
|
929
|
+
console.log();
|
|
930
|
+
console.log(`Visibility Debounce: ${currentSettings.visibilityDebounceMs}ms`);
|
|
931
|
+
console.log(`Virtualization: ${currentSettings.enableVirtualization ? "✅ Enabled" : "❌ Disabled"}`);
|
|
932
|
+
console.log(`Result Caching: ${currentSettings.cacheResults ? "✅ Enabled" : "❌ Disabled"}`);
|
|
933
|
+
console.log();
|
|
934
|
+
ConsoleUI.printDivider();
|
|
935
|
+
console.log("What would you like to configure?\n");
|
|
936
|
+
console.log(" 1. Visibility Debounce (delay before checking visibility)");
|
|
937
|
+
console.log(" 2. Enable/Disable Virtualization (for large button lists)");
|
|
938
|
+
console.log(" 3. Enable/Disable Result Caching");
|
|
939
|
+
console.log(" 4. Apply Performance Preset");
|
|
940
|
+
console.log(" 5. Cancel");
|
|
941
|
+
console.log("\nChoice (1-5): ");
|
|
942
|
+
const choice = await InputHandler.getInput(10000);
|
|
943
|
+
if (!choice || choice === "5") {
|
|
944
|
+
ConsoleUI.printWarning("Operation cancelled");
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
const newSettings = { ...currentSettings };
|
|
948
|
+
switch (choice) {
|
|
949
|
+
case "1": {
|
|
950
|
+
console.log("\nVisibility Debounce in milliseconds (current: ");
|
|
951
|
+
console.log(`${currentSettings.visibilityDebounceMs}ms): `);
|
|
952
|
+
const input = await InputHandler.getInput(10000);
|
|
953
|
+
if (input) {
|
|
954
|
+
const debounce = parseInt(input, 10);
|
|
955
|
+
if (!isNaN(debounce) && debounce >= 0 && debounce <= 5000) {
|
|
956
|
+
newSettings.visibilityDebounceMs = debounce;
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
ConsoleUI.printError("Invalid debounce value (0-5000ms)");
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
case "2": {
|
|
966
|
+
newSettings.enableVirtualization = !currentSettings.enableVirtualization;
|
|
967
|
+
ConsoleUI.printInfo(`Virtualization ${newSettings.enableVirtualization ? "enabled" : "disabled"}`);
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
case "3": {
|
|
971
|
+
newSettings.cacheResults = !currentSettings.cacheResults;
|
|
972
|
+
ConsoleUI.printInfo(`Result caching ${newSettings.cacheResults ? "enabled" : "disabled"}`);
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
case "4": {
|
|
976
|
+
console.log("\nPerformance Presets:\n");
|
|
977
|
+
console.log(" 1. Balanced (300ms debounce, caching on)");
|
|
978
|
+
console.log(" 2. Fast (100ms debounce, caching on, virtualization on)");
|
|
979
|
+
console.log(" 3. Minimal (0ms debounce, caching off)");
|
|
980
|
+
console.log("\nChoice (1-3): ");
|
|
981
|
+
const presetChoice = await InputHandler.getInput(10000);
|
|
982
|
+
switch (presetChoice) {
|
|
983
|
+
case "1":
|
|
984
|
+
newSettings.visibilityDebounceMs = 300;
|
|
985
|
+
newSettings.cacheResults = true;
|
|
986
|
+
newSettings.enableVirtualization = false;
|
|
987
|
+
break;
|
|
988
|
+
case "2":
|
|
989
|
+
newSettings.visibilityDebounceMs = 100;
|
|
990
|
+
newSettings.cacheResults = true;
|
|
991
|
+
newSettings.enableVirtualization = true;
|
|
992
|
+
break;
|
|
993
|
+
case "3":
|
|
994
|
+
newSettings.visibilityDebounceMs = 0;
|
|
995
|
+
newSettings.cacheResults = false;
|
|
996
|
+
newSettings.enableVirtualization = false;
|
|
997
|
+
break;
|
|
998
|
+
default:
|
|
999
|
+
ConsoleUI.printError("Invalid preset choice");
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
default:
|
|
1005
|
+
ConsoleUI.printError("Invalid choice");
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
SettingsManager.setPerformanceSettings(location, newSettings);
|
|
1009
|
+
ConsoleUI.printSuccess("Performance settings updated");
|
|
1010
|
+
console.log();
|
|
1011
|
+
ConsoleUI.printDivider();
|
|
1012
|
+
console.log("New Settings:");
|
|
1013
|
+
ConsoleUI.printDivider();
|
|
1014
|
+
console.log(`Visibility Debounce: ${newSettings.visibilityDebounceMs}ms`);
|
|
1015
|
+
console.log(`Virtualization: ${newSettings.enableVirtualization ? "✅ Enabled" : "❌ Disabled"}`);
|
|
1016
|
+
console.log(`Result Caching: ${newSettings.cacheResults ? "✅ Enabled" : "❌ Disabled"}`);
|
|
1017
|
+
console.log();
|
|
1018
|
+
}
|
|
756
1019
|
async function showHelp() {
|
|
757
1020
|
ConsoleUI.clear();
|
|
758
1021
|
ConsoleUI.printBanner();
|