@autoglm.js/cli 0.0.2 → 0.0.4
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/dist/Help-jPteckUo.mjs +241 -0
- package/dist/index.mjs +77 -16
- package/package.json +2 -2
- package/dist/Help-BZfoJEGE.mjs +0 -167
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Box, Text } from "ink";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { useLocation } from "react-router";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ErrorCode } from "autoglm.js";
|
|
6
|
+
|
|
7
|
+
//#region src/components/HelpContent.tsx
|
|
8
|
+
function HelpSection({ title, items }) {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
marginBottom: 2,
|
|
13
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
14
|
+
marginBottom: 1,
|
|
15
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
16
|
+
color: "blue",
|
|
17
|
+
bold: true,
|
|
18
|
+
children: t(title)
|
|
19
|
+
})
|
|
20
|
+
}), items.map((item, index) => /* @__PURE__ */ jsxs(Box, {
|
|
21
|
+
flexDirection: "row",
|
|
22
|
+
marginBottom: 1,
|
|
23
|
+
children: [item.step && /* @__PURE__ */ jsx(Box, {
|
|
24
|
+
width: 4,
|
|
25
|
+
marginRight: 1,
|
|
26
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
27
|
+
color: "yellow",
|
|
28
|
+
bold: true,
|
|
29
|
+
children: [item.step, "."]
|
|
30
|
+
})
|
|
31
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
32
|
+
flexGrow: 1,
|
|
33
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
34
|
+
color: item.important ? "yellow" : "white",
|
|
35
|
+
bold: item.important,
|
|
36
|
+
children: t(item.text)
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
}, index))]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function HelpContent({ content }) {
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
45
|
+
flexDirection: "column",
|
|
46
|
+
paddingX: 2,
|
|
47
|
+
paddingY: 1,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
50
|
+
marginBottom: 2,
|
|
51
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
52
|
+
color: content.titleColor || "red",
|
|
53
|
+
bold: true,
|
|
54
|
+
children: t(content.title)
|
|
55
|
+
}), content.errorCode && /* @__PURE__ */ jsxs(Text, {
|
|
56
|
+
color: "gray",
|
|
57
|
+
dimColor: true,
|
|
58
|
+
children: [
|
|
59
|
+
"Error Code:",
|
|
60
|
+
" ",
|
|
61
|
+
content.errorCode
|
|
62
|
+
]
|
|
63
|
+
})]
|
|
64
|
+
}),
|
|
65
|
+
content.sections.map((section, index) => /* @__PURE__ */ jsx(HelpSection, {
|
|
66
|
+
title: section.title,
|
|
67
|
+
items: section.items
|
|
68
|
+
}, index)),
|
|
69
|
+
content.footer && /* @__PURE__ */ jsx(Box, {
|
|
70
|
+
marginTop: 1,
|
|
71
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
72
|
+
color: content.footer.color || "green",
|
|
73
|
+
bold: true,
|
|
74
|
+
children: t(content.footer.text)
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx(Box, {
|
|
78
|
+
marginTop: 2,
|
|
79
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
80
|
+
color: "cyan",
|
|
81
|
+
dimColor: true,
|
|
82
|
+
children: [t("help.feedback.prompt"), ": https://github.com/FliPPeDround/autoglm.js/issues"]
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/config/helpContent.ts
|
|
91
|
+
const helpContentMap = {
|
|
92
|
+
[ErrorCode.ADB_DEVICE_UNCONNECTED]: {
|
|
93
|
+
title: "help.adbDeviceUnconnected.title",
|
|
94
|
+
titleColor: "red",
|
|
95
|
+
errorCode: ErrorCode.ADB_DEVICE_UNCONNECTED,
|
|
96
|
+
sections: [
|
|
97
|
+
{
|
|
98
|
+
title: "help.adbDeviceUnconnected.problemDescription",
|
|
99
|
+
items: [{
|
|
100
|
+
text: "help.adbDeviceUnconnected.deviceUnconnected",
|
|
101
|
+
important: true
|
|
102
|
+
}, { text: "help.adbDeviceUnconnected.checkSteps" }]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: "help.adbDeviceUnconnected.solution",
|
|
106
|
+
items: [
|
|
107
|
+
{
|
|
108
|
+
step: 1,
|
|
109
|
+
text: "help.adbDeviceUnconnected.ensureConnected",
|
|
110
|
+
important: true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
step: 2,
|
|
114
|
+
text: "help.adbDeviceUnconnected.enableDeveloperOptions"
|
|
115
|
+
},
|
|
116
|
+
{ text: "help.adbDeviceUnconnected.aboutPhone" },
|
|
117
|
+
{ text: "help.adbDeviceUnconnected.tapVersion" },
|
|
118
|
+
{
|
|
119
|
+
step: 3,
|
|
120
|
+
text: "help.adbDeviceUnconnected.enableUsbDebugging"
|
|
121
|
+
},
|
|
122
|
+
{ text: "help.adbDeviceUnconnected.developerOptions" },
|
|
123
|
+
{ text: "help.adbDeviceUnconnected.turnOnUsbDebugging" },
|
|
124
|
+
{
|
|
125
|
+
step: 4,
|
|
126
|
+
text: "help.adbDeviceUnconnected.authorizeUsbDebugging"
|
|
127
|
+
},
|
|
128
|
+
{ text: "help.adbDeviceUnconnected.allowUsbDebugging" },
|
|
129
|
+
{ text: "help.adbDeviceUnconnected.alwaysAllow" },
|
|
130
|
+
{
|
|
131
|
+
step: 5,
|
|
132
|
+
text: "help.adbDeviceUnconnected.checkConnection"
|
|
133
|
+
},
|
|
134
|
+
{ text: "help.adbDeviceUnconnected.reconnectUsb" },
|
|
135
|
+
{ text: "help.adbDeviceUnconnected.fileTransferMode" }
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
title: "help.adbDeviceUnconnected.commonIssues",
|
|
140
|
+
items: [
|
|
141
|
+
{ text: "help.adbDeviceUnconnected.noUsbDebuggingOption" },
|
|
142
|
+
{ text: "help.adbDeviceUnconnected.secureSettings" },
|
|
143
|
+
{ text: "help.adbDeviceUnconnected.directConnection" },
|
|
144
|
+
{ text: "help.adbDeviceUnconnected.dataCable" }
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
footer: {
|
|
149
|
+
text: "help.adbDeviceUnconnected.footer",
|
|
150
|
+
color: "green"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
[ErrorCode.MODEL_API_CHECK_FAILED]: {
|
|
154
|
+
title: "help.modelApiCheckFailed.title",
|
|
155
|
+
titleColor: "red",
|
|
156
|
+
errorCode: ErrorCode.MODEL_API_CHECK_FAILED,
|
|
157
|
+
sections: [
|
|
158
|
+
{
|
|
159
|
+
title: "help.modelApiCheckFailed.problemDescription",
|
|
160
|
+
items: [{
|
|
161
|
+
text: "help.modelApiCheckFailed.apiCheckFailed",
|
|
162
|
+
important: true
|
|
163
|
+
}, { text: "help.modelApiCheckFailed.checkConfig" }]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
title: "help.modelApiCheckFailed.solution",
|
|
167
|
+
items: [
|
|
168
|
+
{
|
|
169
|
+
step: 1,
|
|
170
|
+
text: "help.modelApiCheckFailed.openConfigFile",
|
|
171
|
+
important: true
|
|
172
|
+
},
|
|
173
|
+
{ text: "help.modelApiCheckFailed.configFilePath" },
|
|
174
|
+
{
|
|
175
|
+
step: 2,
|
|
176
|
+
text: "help.modelApiCheckFailed.checkBaseUrl",
|
|
177
|
+
important: true
|
|
178
|
+
},
|
|
179
|
+
{ text: "help.modelApiCheckFailed.baseUrlExample" },
|
|
180
|
+
{
|
|
181
|
+
step: 3,
|
|
182
|
+
text: "help.modelApiCheckFailed.checkApiKey",
|
|
183
|
+
important: true
|
|
184
|
+
},
|
|
185
|
+
{ text: "help.modelApiCheckFailed.apiKeyNotEmpty" },
|
|
186
|
+
{ text: "help.modelApiCheckFailed.apiKeyValid" },
|
|
187
|
+
{
|
|
188
|
+
step: 4,
|
|
189
|
+
text: "help.modelApiCheckFailed.checkModel",
|
|
190
|
+
important: true
|
|
191
|
+
},
|
|
192
|
+
{ text: "help.modelApiCheckFailed.modelExample" },
|
|
193
|
+
{
|
|
194
|
+
step: 5,
|
|
195
|
+
text: "help.modelApiCheckFailed.verifyConnection"
|
|
196
|
+
},
|
|
197
|
+
{ text: "help.modelApiCheckFailed.networkCheck" },
|
|
198
|
+
{ text: "help.modelApiCheckFailed.apiAvailable" }
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
title: "help.modelApiCheckFailed.commonIssues",
|
|
203
|
+
items: [
|
|
204
|
+
{ text: "help.modelApiCheckFailed.invalidBaseUrl" },
|
|
205
|
+
{ text: "help.modelApiCheckFailed.invalidApiKey" },
|
|
206
|
+
{ text: "help.modelApiCheckFailed.modelNotFound" },
|
|
207
|
+
{ text: "help.modelApiCheckFailed.networkError" },
|
|
208
|
+
{ text: "help.modelApiCheckFailed.quotaExceeded" }
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
footer: {
|
|
213
|
+
text: "help.modelApiCheckFailed.footer",
|
|
214
|
+
color: "green"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const defaultHelpContent = {
|
|
219
|
+
title: "help.title",
|
|
220
|
+
titleColor: "blue",
|
|
221
|
+
sections: [{
|
|
222
|
+
title: "help.genericHelp",
|
|
223
|
+
items: [{ text: "help.noSpecificHelp" }, { text: "help.contactSupport" }]
|
|
224
|
+
}]
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/pages/Help.tsx
|
|
229
|
+
function Help() {
|
|
230
|
+
const code = useLocation().state?.code;
|
|
231
|
+
const { t } = useTranslation();
|
|
232
|
+
const content = code ? helpContentMap[code] : null;
|
|
233
|
+
if (content) return /* @__PURE__ */ jsx(HelpContent, { content });
|
|
234
|
+
return /* @__PURE__ */ jsx(HelpContent, { content: {
|
|
235
|
+
...defaultHelpContent,
|
|
236
|
+
errorCode: code ? t("help.noErrorCode", { code }) : void 0
|
|
237
|
+
} });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
export { Help as default };
|
package/dist/index.mjs
CHANGED
|
@@ -330,6 +330,7 @@ function loadCliConfig(customConfigPath) {
|
|
|
330
330
|
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/locales/en-US.ts
|
|
333
|
+
const configFilePath$1 = join(AUTOGLM_FILEPATH, "config.json");
|
|
333
334
|
var en_US_default = {
|
|
334
335
|
welcome: {
|
|
335
336
|
enterTask: "Enter Your Task Below",
|
|
@@ -437,8 +438,35 @@ var en_US_default = {
|
|
|
437
438
|
dataCable: "• Check if the USB cable supports data transfer (some charging cables only support charging)",
|
|
438
439
|
footer: "After completing the above steps, please try connecting the device again"
|
|
439
440
|
},
|
|
441
|
+
modelApiCheckFailed: {
|
|
442
|
+
title: "Model API Configuration Error",
|
|
443
|
+
problemDescription: "Problem Description",
|
|
444
|
+
apiCheckFailed: "Model API request failed",
|
|
445
|
+
checkConfig: "Please check your configuration file settings",
|
|
446
|
+
solution: "Solution",
|
|
447
|
+
openConfigFile: "Open the configuration file",
|
|
448
|
+
configFilePath: ` • Location: ${configFilePath$1}`,
|
|
449
|
+
checkBaseUrl: "Check Base URL configuration",
|
|
450
|
+
baseUrlExample: " • Ensure baseUrl is correct (e.g., https://open.bigmodel.cn/api/paas/v4/)",
|
|
451
|
+
checkApiKey: "Check API Key configuration",
|
|
452
|
+
apiKeyNotEmpty: " • Ensure apiKey is not empty",
|
|
453
|
+
apiKeyValid: " • Verify the API key is valid and has sufficient permissions",
|
|
454
|
+
checkModel: "Check Model configuration",
|
|
455
|
+
modelExample: " • Ensure model name is correct (e.g., autoglm-phone)",
|
|
456
|
+
verifyConnection: "Verify network connection",
|
|
457
|
+
networkCheck: " • Check if your network can access the API service",
|
|
458
|
+
apiAvailable: " • Confirm the API service is available",
|
|
459
|
+
commonIssues: "Common Issues",
|
|
460
|
+
invalidBaseUrl: "• Base URL format is incorrect or service is unavailable",
|
|
461
|
+
invalidApiKey: "• API key is invalid, expired, or has insufficient permissions",
|
|
462
|
+
modelNotFound: "• Model name does not exist or is not supported",
|
|
463
|
+
networkError: "• Network connection issue or firewall blocking",
|
|
464
|
+
quotaExceeded: "• API quota exceeded or account balance insufficient",
|
|
465
|
+
footer: "After correcting the configuration, please restart the application"
|
|
466
|
+
},
|
|
440
467
|
contactSupport: "Or contact technical support for more help",
|
|
441
|
-
noSpecificHelp: "For help with specific errors, please jump to this page from the error page"
|
|
468
|
+
noSpecificHelp: "For help with specific errors, please jump to this page from the error page",
|
|
469
|
+
feedback: { prompt: "Feedback" }
|
|
442
470
|
},
|
|
443
471
|
version: {
|
|
444
472
|
title: "Version Info",
|
|
@@ -467,6 +495,7 @@ var en_US_default = {
|
|
|
467
495
|
|
|
468
496
|
//#endregion
|
|
469
497
|
//#region src/locales/zh-CN.ts
|
|
498
|
+
const configFilePath = join(AUTOGLM_FILEPATH, "config.json");
|
|
470
499
|
var zh_CN_default = {
|
|
471
500
|
welcome: {
|
|
472
501
|
enterTask: "输入您的任务",
|
|
@@ -574,8 +603,35 @@ var zh_CN_default = {
|
|
|
574
603
|
dataCable: "• 检查USB线是否支持数据传输(部分充电线仅支持充电)",
|
|
575
604
|
footer: "完成以上步骤后,请重新尝试连接设备"
|
|
576
605
|
},
|
|
606
|
+
modelApiCheckFailed: {
|
|
607
|
+
title: "模型API配置错误",
|
|
608
|
+
problemDescription: "问题描述",
|
|
609
|
+
apiCheckFailed: "模型API请求失败",
|
|
610
|
+
checkConfig: "请检查您的配置文件设置",
|
|
611
|
+
solution: "解决方案",
|
|
612
|
+
openConfigFile: "打开配置文件",
|
|
613
|
+
configFilePath: ` • 位置: ${configFilePath}`,
|
|
614
|
+
checkBaseUrl: "检查Base URL配置",
|
|
615
|
+
baseUrlExample: " • 确保baseUrl正确(例如:https://open.bigmodel.cn/api/paas/v4/)",
|
|
616
|
+
checkApiKey: "检查API Key配置",
|
|
617
|
+
apiKeyNotEmpty: " • 确保apiKey不为空",
|
|
618
|
+
apiKeyValid: " • 验证API密钥有效且具有足够权限",
|
|
619
|
+
checkModel: "检查Model配置",
|
|
620
|
+
modelExample: " • 确保模型名称正确(例如:autoglm-phone)",
|
|
621
|
+
verifyConnection: "验证网络连接",
|
|
622
|
+
networkCheck: " • 检查您的网络是否可以访问API服务",
|
|
623
|
+
apiAvailable: " • 确认API服务可用",
|
|
624
|
+
commonIssues: "常见问题",
|
|
625
|
+
invalidBaseUrl: "• Base URL格式错误或服务不可用",
|
|
626
|
+
invalidApiKey: "• API密钥无效、已过期或权限不足",
|
|
627
|
+
modelNotFound: "• 模型名称不存在或不支持",
|
|
628
|
+
networkError: "• 网络连接问题或防火墙阻止",
|
|
629
|
+
quotaExceeded: "• API配额已用完或账户余额不足",
|
|
630
|
+
footer: "修正配置后,请重新启动应用程序"
|
|
631
|
+
},
|
|
577
632
|
contactSupport: "或联系技术支持获取更多帮助",
|
|
578
|
-
noSpecificHelp: "如需特定错误的帮助信息,请从错误页面跳转至此"
|
|
633
|
+
noSpecificHelp: "如需特定错误的帮助信息,请从错误页面跳转至此",
|
|
634
|
+
feedback: { prompt: "反馈问题" }
|
|
579
635
|
},
|
|
580
636
|
version: {
|
|
581
637
|
title: "版本信息",
|
|
@@ -2549,6 +2605,12 @@ async function updateJSON(path$12, data) {
|
|
|
2549
2605
|
await import_lib$1.default.outputJson(path$12, config$1, { spaces: 2 });
|
|
2550
2606
|
}
|
|
2551
2607
|
|
|
2608
|
+
//#endregion
|
|
2609
|
+
//#region ../shared/src/utils.ts
|
|
2610
|
+
function sleep(ms) {
|
|
2611
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2552
2614
|
//#endregion
|
|
2553
2615
|
//#region src/context/agentInitializer.ts
|
|
2554
2616
|
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
@@ -2560,7 +2622,7 @@ async function initializeAgent(options) {
|
|
|
2560
2622
|
if (deviceId !== void 0) setCurrentDeviceId(deviceId);
|
|
2561
2623
|
await ensureADBAble(agent, navigate);
|
|
2562
2624
|
setSystemCheck(true);
|
|
2563
|
-
setApiCheck(await checkModelApi(agent));
|
|
2625
|
+
setApiCheck(await checkModelApi(agent, navigate));
|
|
2564
2626
|
}
|
|
2565
2627
|
var SystemStatus$1 = /* @__PURE__ */ function(SystemStatus$2) {
|
|
2566
2628
|
SystemStatus$2[SystemStatus$2["CHECKING"] = 0] = "CHECKING";
|
|
@@ -2596,18 +2658,23 @@ async function ensureADBAble(agent, navigate) {
|
|
|
2596
2658
|
}
|
|
2597
2659
|
case SystemStatus$1.NEED_DEVICE:
|
|
2598
2660
|
navigate("/help", { state: { code: ErrorCode.ADB_DEVICE_UNCONNECTED } });
|
|
2599
|
-
|
|
2600
|
-
|
|
2661
|
+
await sleep(1e3);
|
|
2662
|
+
process$1.exit(0);
|
|
2601
2663
|
}
|
|
2602
2664
|
}
|
|
2603
2665
|
async function ensureConfigFileExists(configPath, defaultConfig) {
|
|
2604
2666
|
if (!import_lib.default.existsSync(configPath)) await import_lib.default.outputJson(configPath, defaultConfig, { spaces: 2 });
|
|
2605
2667
|
}
|
|
2606
|
-
async function checkModelApi(agent) {
|
|
2668
|
+
async function checkModelApi(agent, navigate) {
|
|
2607
2669
|
try {
|
|
2608
|
-
|
|
2670
|
+
if ((await agent.checkModelApi()).success) return true;
|
|
2671
|
+
navigate("/help", { state: { code: ErrorCode.MODEL_API_CHECK_FAILED } });
|
|
2672
|
+
await sleep(1e3);
|
|
2673
|
+
process$1.exit(0);
|
|
2609
2674
|
} catch {
|
|
2610
|
-
|
|
2675
|
+
navigate("/help", { state: { code: ErrorCode.MODEL_API_CHECK_FAILED } });
|
|
2676
|
+
await sleep(1e3);
|
|
2677
|
+
process$1.exit(0);
|
|
2611
2678
|
}
|
|
2612
2679
|
}
|
|
2613
2680
|
async function fetchVersionInfo(agent) {
|
|
@@ -2863,12 +2930,6 @@ function getAllCommands() {
|
|
|
2863
2930
|
return commands;
|
|
2864
2931
|
}
|
|
2865
2932
|
|
|
2866
|
-
//#endregion
|
|
2867
|
-
//#region ../shared/src/utils.ts
|
|
2868
|
-
function sleep(ms) {
|
|
2869
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2870
|
-
}
|
|
2871
|
-
|
|
2872
2933
|
//#endregion
|
|
2873
2934
|
//#region src/store/userInputStore.ts
|
|
2874
2935
|
function isCommandQuery(query) {
|
|
@@ -3148,7 +3209,7 @@ const routes = [
|
|
|
3148
3209
|
},
|
|
3149
3210
|
{
|
|
3150
3211
|
path: "/help",
|
|
3151
|
-
component: lazy(() => import("./Help-
|
|
3212
|
+
component: lazy(() => import("./Help-jPteckUo.mjs")),
|
|
3152
3213
|
label: "Help"
|
|
3153
3214
|
},
|
|
3154
3215
|
{
|
|
@@ -3183,7 +3244,7 @@ var App_default = App;
|
|
|
3183
3244
|
|
|
3184
3245
|
//#endregion
|
|
3185
3246
|
//#region package.json
|
|
3186
|
-
var version$1 = "0.0.
|
|
3247
|
+
var version$1 = "0.0.4";
|
|
3187
3248
|
|
|
3188
3249
|
//#endregion
|
|
3189
3250
|
//#region src/pages/Version.tsx
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoglm.js/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "AutoGLM.js Command Line Interface",
|
|
7
7
|
"author": "FliPPeDround <flippedround@qq.com>",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-router": "^7.11.0",
|
|
46
46
|
"unconfig": "^7.4.2",
|
|
47
47
|
"zustand": "^5.0.9",
|
|
48
|
-
"autoglm.js": "0.0.
|
|
48
|
+
"autoglm.js": "0.0.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@clack/prompts": "^0.11.0",
|
package/dist/Help-BZfoJEGE.mjs
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { Box, Text } from "ink";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useLocation } from "react-router";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { ErrorCode } from "autoglm.js";
|
|
6
|
-
|
|
7
|
-
//#region src/components/HelpContent.tsx
|
|
8
|
-
function HelpSection({ title, items }) {
|
|
9
|
-
const { t } = useTranslation();
|
|
10
|
-
return /* @__PURE__ */ jsxs(Box, {
|
|
11
|
-
flexDirection: "column",
|
|
12
|
-
marginBottom: 2,
|
|
13
|
-
children: [/* @__PURE__ */ jsx(Box, {
|
|
14
|
-
marginBottom: 1,
|
|
15
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
16
|
-
color: "blue",
|
|
17
|
-
bold: true,
|
|
18
|
-
children: t(title)
|
|
19
|
-
})
|
|
20
|
-
}), items.map((item, index) => /* @__PURE__ */ jsxs(Box, {
|
|
21
|
-
flexDirection: "row",
|
|
22
|
-
marginBottom: 1,
|
|
23
|
-
children: [item.step && /* @__PURE__ */ jsx(Box, {
|
|
24
|
-
width: 4,
|
|
25
|
-
marginRight: 1,
|
|
26
|
-
children: /* @__PURE__ */ jsxs(Text, {
|
|
27
|
-
color: "yellow",
|
|
28
|
-
bold: true,
|
|
29
|
-
children: [item.step, "."]
|
|
30
|
-
})
|
|
31
|
-
}), /* @__PURE__ */ jsx(Box, {
|
|
32
|
-
flexGrow: 1,
|
|
33
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
34
|
-
color: item.important ? "yellow" : "white",
|
|
35
|
-
bold: item.important,
|
|
36
|
-
children: t(item.text)
|
|
37
|
-
})
|
|
38
|
-
})]
|
|
39
|
-
}, index))]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function HelpContent({ content }) {
|
|
43
|
-
const { t } = useTranslation();
|
|
44
|
-
return /* @__PURE__ */ jsxs(Box, {
|
|
45
|
-
flexDirection: "column",
|
|
46
|
-
paddingX: 2,
|
|
47
|
-
paddingY: 1,
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ jsxs(Box, {
|
|
50
|
-
marginBottom: 2,
|
|
51
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
52
|
-
color: content.titleColor || "red",
|
|
53
|
-
bold: true,
|
|
54
|
-
children: t(content.title)
|
|
55
|
-
}), content.errorCode && /* @__PURE__ */ jsxs(Text, {
|
|
56
|
-
color: "gray",
|
|
57
|
-
dimColor: true,
|
|
58
|
-
children: [
|
|
59
|
-
t("Error Code:"),
|
|
60
|
-
" ",
|
|
61
|
-
content.errorCode
|
|
62
|
-
]
|
|
63
|
-
})]
|
|
64
|
-
}),
|
|
65
|
-
content.sections.map((section, index) => /* @__PURE__ */ jsx(HelpSection, {
|
|
66
|
-
title: section.title,
|
|
67
|
-
items: section.items
|
|
68
|
-
}, index)),
|
|
69
|
-
content.footer && /* @__PURE__ */ jsx(Box, {
|
|
70
|
-
marginTop: 2,
|
|
71
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
72
|
-
color: content.footer.color || "green",
|
|
73
|
-
bold: true,
|
|
74
|
-
children: t(content.footer.text)
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/config/helpContent.ts
|
|
83
|
-
const helpContentMap = { [ErrorCode.ADB_DEVICE_UNCONNECTED]: {
|
|
84
|
-
title: "help.adbDeviceUnconnected.title",
|
|
85
|
-
titleColor: "red",
|
|
86
|
-
errorCode: ErrorCode.ADB_DEVICE_UNCONNECTED,
|
|
87
|
-
sections: [
|
|
88
|
-
{
|
|
89
|
-
title: "help.adbDeviceUnconnected.problemDescription",
|
|
90
|
-
items: [{
|
|
91
|
-
text: "help.adbDeviceUnconnected.deviceUnconnected",
|
|
92
|
-
important: true
|
|
93
|
-
}, { text: "help.adbDeviceUnconnected.checkSteps" }]
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
title: "help.adbDeviceUnconnected.solution",
|
|
97
|
-
items: [
|
|
98
|
-
{
|
|
99
|
-
step: 1,
|
|
100
|
-
text: "help.adbDeviceUnconnected.ensureConnected",
|
|
101
|
-
important: true
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
step: 2,
|
|
105
|
-
text: "help.adbDeviceUnconnected.enableDeveloperOptions"
|
|
106
|
-
},
|
|
107
|
-
{ text: "help.adbDeviceUnconnected.aboutPhone" },
|
|
108
|
-
{ text: "help.adbDeviceUnconnected.tapVersion" },
|
|
109
|
-
{
|
|
110
|
-
step: 3,
|
|
111
|
-
text: "help.adbDeviceUnconnected.enableUsbDebugging"
|
|
112
|
-
},
|
|
113
|
-
{ text: "help.adbDeviceUnconnected.developerOptions" },
|
|
114
|
-
{ text: "help.adbDeviceUnconnected.turnOnUsbDebugging" },
|
|
115
|
-
{
|
|
116
|
-
step: 4,
|
|
117
|
-
text: "help.adbDeviceUnconnected.authorizeUsbDebugging"
|
|
118
|
-
},
|
|
119
|
-
{ text: "help.adbDeviceUnconnected.allowUsbDebugging" },
|
|
120
|
-
{ text: "help.adbDeviceUnconnected.alwaysAllow" },
|
|
121
|
-
{
|
|
122
|
-
step: 5,
|
|
123
|
-
text: "help.adbDeviceUnconnected.checkConnection"
|
|
124
|
-
},
|
|
125
|
-
{ text: "help.adbDeviceUnconnected.reconnectUsb" },
|
|
126
|
-
{ text: "help.adbDeviceUnconnected.fileTransferMode" }
|
|
127
|
-
]
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
title: "help.adbDeviceUnconnected.commonIssues",
|
|
131
|
-
items: [
|
|
132
|
-
{ text: "help.adbDeviceUnconnected.noUsbDebuggingOption" },
|
|
133
|
-
{ text: "help.adbDeviceUnconnected.secureSettings" },
|
|
134
|
-
{ text: "help.adbDeviceUnconnected.directConnection" },
|
|
135
|
-
{ text: "help.adbDeviceUnconnected.dataCable" }
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
footer: {
|
|
140
|
-
text: "help.adbDeviceUnconnected.footer",
|
|
141
|
-
color: "green"
|
|
142
|
-
}
|
|
143
|
-
} };
|
|
144
|
-
const defaultHelpContent = {
|
|
145
|
-
title: "help.title",
|
|
146
|
-
titleColor: "blue",
|
|
147
|
-
sections: [{
|
|
148
|
-
title: "help.genericHelp",
|
|
149
|
-
items: [{ text: "help.noSpecificHelp" }, { text: "help.contactSupport" }]
|
|
150
|
-
}]
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/pages/Help.tsx
|
|
155
|
-
function Help() {
|
|
156
|
-
const code = useLocation().state?.code;
|
|
157
|
-
const { t } = useTranslation();
|
|
158
|
-
const content = code ? helpContentMap[code] : null;
|
|
159
|
-
if (content) return /* @__PURE__ */ jsx(HelpContent, { content });
|
|
160
|
-
return /* @__PURE__ */ jsx(HelpContent, { content: {
|
|
161
|
-
...defaultHelpContent,
|
|
162
|
-
errorCode: code ? t("help.noErrorCode", { code }) : void 0
|
|
163
|
-
} });
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
//#endregion
|
|
167
|
-
export { Help as default };
|