cursor-switch 1.0.1 → 1.0.3
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.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 3. 智能包管理器探测 (自动适配 npm / pnpm / yarn / bun)
|
|
7
7
|
* 4. 零第三方依赖,纯 Node.js 原生轻量实现
|
|
8
8
|
*/
|
|
9
|
-
export declare const CURRENT_VERSION
|
|
9
|
+
export declare const CURRENT_VERSION: string;
|
|
10
10
|
export declare const PACKAGE_NAME = "cursor-switch";
|
|
11
11
|
export interface VersionCheckResult {
|
|
12
12
|
currentVersion: string;
|
|
@@ -6,10 +6,26 @@
|
|
|
6
6
|
* 3. 智能包管理器探测 (自动适配 npm / pnpm / yarn / bun)
|
|
7
7
|
* 4. 零第三方依赖,纯 Node.js 原生轻量实现
|
|
8
8
|
*/
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
9
12
|
import { spawn } from 'node:child_process';
|
|
10
13
|
import chalk from 'chalk';
|
|
11
14
|
import { ConfigStore } from './config-store.js';
|
|
12
|
-
|
|
15
|
+
function getPackageVersion() {
|
|
16
|
+
try {
|
|
17
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const pkgPath = path.resolve(currentDir, '..', '..', 'package.json');
|
|
19
|
+
if (fs.existsSync(pkgPath)) {
|
|
20
|
+
const data = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
21
|
+
if (data?.version)
|
|
22
|
+
return data.version;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
return '1.0.2';
|
|
27
|
+
}
|
|
28
|
+
export const CURRENT_VERSION = getPackageVersion();
|
|
13
29
|
export const PACKAGE_NAME = 'cursor-switch';
|
|
14
30
|
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 小时检查周期
|
|
15
31
|
/**
|
package/dist/menu.js
CHANGED
|
@@ -1917,7 +1917,7 @@ async function handleRefundMenu(store, currentAcc) {
|
|
|
1917
1917
|
try {
|
|
1918
1918
|
action = await quickSelect({
|
|
1919
1919
|
header: subHeader,
|
|
1920
|
-
message: '操作选择 (
|
|
1920
|
+
message: '操作选择 (按键快捷直达):',
|
|
1921
1921
|
choices,
|
|
1922
1922
|
pageSize: 7,
|
|
1923
1923
|
});
|
|
@@ -1980,7 +1980,7 @@ async function handleRefundMenu(store, currentAcc) {
|
|
|
1980
1980
|
try {
|
|
1981
1981
|
selected = await quickSelect({
|
|
1982
1982
|
header: subHeader,
|
|
1983
|
-
message: '请选择目标账号或方式 (
|
|
1983
|
+
message: '请选择目标账号或方式 (按键快捷直达):',
|
|
1984
1984
|
choices: accChoices,
|
|
1985
1985
|
pageSize: 12,
|
|
1986
1986
|
});
|
package/dist/utils/live-menu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 现代终端极速响应式交互菜单引擎 (Live & Quick TUI Engine)
|
|
3
3
|
* 支持:
|
|
4
|
-
* 1.
|
|
4
|
+
* 1. 单键快捷直达 (按 0, 1, 2, s, q, Esc 键无需按回车直接触发秒选)
|
|
5
5
|
* 2. 方向键平滑巡览与动态说明 (↑↓ 移动光标,↵ 回车确认)
|
|
6
6
|
* 3. 毫秒级无闪烁响应式时钟 (主界面 HUD 每秒平滑走字)
|
|
7
7
|
*/
|
|
@@ -91,7 +91,7 @@ export const quickSelect = createPrompt((config, done) => {
|
|
|
91
91
|
setActive(next);
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
// 5.
|
|
94
|
+
// 5. 单键快捷直达:支持数字键 0-9、字符键 s (搜索)、q (退出/返回)
|
|
95
95
|
const char = key.name ? key.name.toLowerCase() : '';
|
|
96
96
|
if (char) {
|
|
97
97
|
// 快捷退出/返回: 按 q 直接触发返回项
|
|
@@ -123,7 +123,7 @@ export const quickSelect = createPrompt((config, done) => {
|
|
|
123
123
|
if (matchIdx !== -1) {
|
|
124
124
|
const target = items[matchIdx];
|
|
125
125
|
setActive(matchIdx);
|
|
126
|
-
//
|
|
126
|
+
// 单键快捷执行!无需再按回车
|
|
127
127
|
setStatus('done');
|
|
128
128
|
done(target.value);
|
|
129
129
|
return;
|