@workclaw/cli 1.0.18 → 1.0.19
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/README.md +8 -12
- package/dist/{index-DrOcptQl.js → index-K7R_QFg0.js} +18 -38
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npx @workclaw/cli local
|
|
|
21
21
|
| 命令 | 说明 |
|
|
22
22
|
|------|------|
|
|
23
23
|
| `workclaw local` | 本地账户安装(需要登录) |
|
|
24
|
-
| `workclaw box` |
|
|
24
|
+
| `workclaw box` | 盒子设备安装(无需登录,仅支持 Linux) |
|
|
25
25
|
|
|
26
26
|
### 交互式初始化
|
|
27
27
|
|
|
@@ -52,14 +52,13 @@ npx @workclaw/cli box
|
|
|
52
52
|
|
|
53
53
|
#### box 命令参数
|
|
54
54
|
|
|
55
|
-
| 参数 | 缩写 | 说明
|
|
56
|
-
| ---------------- | -- |
|
|
57
|
-
| --scenario | -s | 安装场景 |
|
|
55
|
+
| 参数 | 缩写 | 说明 |
|
|
56
|
+
| ---------------- | -- | ---- |
|
|
58
57
|
| --env | -e | 环境 (test/prod) |
|
|
59
|
-
| --app-key | 无 | App Key
|
|
60
|
-
| --app-secret | 无 | App Secret
|
|
61
|
-
| --plugin-version | 无 | 插件版本号
|
|
62
|
-
| --debug | 无 | 调试模式
|
|
58
|
+
| --app-key | 无 | App Key |
|
|
59
|
+
| --app-secret | 无 | App Secret |
|
|
60
|
+
| --plugin-version | 无 | 插件版本号 |
|
|
61
|
+
| --debug | 无 | 调试模式 |
|
|
63
62
|
|
|
64
63
|
### 安装场景
|
|
65
64
|
|
|
@@ -122,7 +121,7 @@ workclaw local --scenario linux-local --phone 13800138000 --user-pass your_passw
|
|
|
122
121
|
|
|
123
122
|
### 盒子安装
|
|
124
123
|
|
|
125
|
-
盒子安装适用于不需要用户登录的场景,直接使用 AppKey 和 AppSecret
|
|
124
|
+
盒子安装适用于不需要用户登录的场景,直接使用 AppKey 和 AppSecret 进行安装。**仅支持 Linux 环境**。
|
|
126
125
|
|
|
127
126
|
```bash
|
|
128
127
|
# 基本用法
|
|
@@ -130,9 +129,6 @@ workclaw box --app-key your_app_key --app-secret your_app_secret
|
|
|
130
129
|
|
|
131
130
|
# 指定环境
|
|
132
131
|
workclaw box --app-key your_app_key --app-secret your_app_secret --env prod
|
|
133
|
-
|
|
134
|
-
# 指定场景
|
|
135
|
-
workclaw box --app-key your_app_key --app-secret your_app_secret --scenario linux-local
|
|
136
132
|
```
|
|
137
133
|
|
|
138
134
|
### 指定插件版本
|
|
@@ -4959,34 +4959,17 @@ function checkEnv() {
|
|
|
4959
4959
|
}
|
|
4960
4960
|
async function createBoxCommand(options) {
|
|
4961
4961
|
setDebug(!!options.debug);
|
|
4962
|
-
debugLog("[
|
|
4963
|
-
debugLog(`[
|
|
4962
|
+
debugLog("[盒子安装] 开始处理...");
|
|
4963
|
+
debugLog(`[盒子安装] 参数: env=${options.env}, appKey=${options.appKey ? "***" : "未提供"}, debug=${options.debug}`);
|
|
4964
4964
|
checkEnv();
|
|
4965
|
-
debugLog("[
|
|
4965
|
+
debugLog("[盒子安装] 环境检查通过");
|
|
4966
4966
|
try {
|
|
4967
|
-
let scenario = options.scenario;
|
|
4968
4967
|
let env = options.env;
|
|
4969
4968
|
let appKey = options.appKey;
|
|
4970
4969
|
let appSecret = options.appSecret;
|
|
4971
4970
|
const questions = [];
|
|
4972
|
-
if (!scenario) {
|
|
4973
|
-
debugLog("[初始化] 需要选择安装场景");
|
|
4974
|
-
questions.push({
|
|
4975
|
-
type: "list",
|
|
4976
|
-
name: "scenario",
|
|
4977
|
-
message: `${nodeEmoji.get("desktop_computer")} 请选择安装场景:`,
|
|
4978
|
-
default: "windows-local",
|
|
4979
|
-
choices: [
|
|
4980
|
-
{ name: `${chalk.green("Windows")} ${chalk.gray("本地安装")}`, value: "windows-local" },
|
|
4981
|
-
{ name: `${chalk.green("macOS")} ${chalk.gray("本地安装")}`, value: "mac-local" },
|
|
4982
|
-
{ name: `${chalk.green("Linux")} ${chalk.gray("本地安装")}`, value: "linux-local" }
|
|
4983
|
-
]
|
|
4984
|
-
});
|
|
4985
|
-
} else {
|
|
4986
|
-
debugLog(`[初始化] 使用命令行参数: scenario=${scenario}`);
|
|
4987
|
-
}
|
|
4988
4971
|
if (!env) {
|
|
4989
|
-
debugLog("[
|
|
4972
|
+
debugLog("[盒子安装] 需要选择环境");
|
|
4990
4973
|
questions.push({
|
|
4991
4974
|
type: "list",
|
|
4992
4975
|
name: "env",
|
|
@@ -4998,10 +4981,10 @@ async function createBoxCommand(options) {
|
|
|
4998
4981
|
]
|
|
4999
4982
|
});
|
|
5000
4983
|
} else {
|
|
5001
|
-
debugLog(`[
|
|
4984
|
+
debugLog(`[盒子安装] 使用命令行参数: env=${env}`);
|
|
5002
4985
|
}
|
|
5003
4986
|
if (!appKey) {
|
|
5004
|
-
debugLog("[
|
|
4987
|
+
debugLog("[盒子安装] 需要输入 AppKey");
|
|
5005
4988
|
questions.push({
|
|
5006
4989
|
type: "input",
|
|
5007
4990
|
name: "appKey",
|
|
@@ -5014,10 +4997,10 @@ async function createBoxCommand(options) {
|
|
|
5014
4997
|
}
|
|
5015
4998
|
});
|
|
5016
4999
|
} else {
|
|
5017
|
-
debugLog("[
|
|
5000
|
+
debugLog("[盒子安装] 使用命令行参数: appKey");
|
|
5018
5001
|
}
|
|
5019
5002
|
if (!appSecret) {
|
|
5020
|
-
debugLog("[
|
|
5003
|
+
debugLog("[盒子安装] 需要输入 AppSecret");
|
|
5021
5004
|
questions.push({
|
|
5022
5005
|
type: "input",
|
|
5023
5006
|
name: "appSecret",
|
|
@@ -5030,29 +5013,26 @@ async function createBoxCommand(options) {
|
|
|
5030
5013
|
}
|
|
5031
5014
|
});
|
|
5032
5015
|
} else {
|
|
5033
|
-
debugLog("[
|
|
5016
|
+
debugLog("[盒子安装] 使用命令行参数: appSecret");
|
|
5034
5017
|
}
|
|
5035
5018
|
if (questions.length > 0) {
|
|
5036
|
-
debugLog(`[
|
|
5019
|
+
debugLog(`[盒子安装] 开始交互式问答,共 ${questions.length} 个问题`);
|
|
5037
5020
|
const answers = await inquirer.prompt(questions);
|
|
5038
|
-
debugLog("[
|
|
5039
|
-
scenario = scenario || answers.scenario;
|
|
5021
|
+
debugLog("[盒子安装] 交互式问答完成");
|
|
5040
5022
|
env = env || answers.env || "test";
|
|
5041
5023
|
appKey = appKey || answers.appKey;
|
|
5042
5024
|
appSecret = appSecret || answers.appSecret;
|
|
5043
5025
|
}
|
|
5044
|
-
debugLog(`[
|
|
5045
|
-
debugLog("[
|
|
5026
|
+
debugLog(`[盒子安装] 最终参数: env=${env}`);
|
|
5027
|
+
debugLog("[盒子安装] 创建 BoxInstaller 实例...");
|
|
5046
5028
|
const installer = new BoxInstaller({
|
|
5047
5029
|
appKey,
|
|
5048
5030
|
appSecret,
|
|
5049
|
-
|
|
5050
|
-
env,
|
|
5051
|
-
pluginVersion: options.pluginVersion
|
|
5031
|
+
env
|
|
5052
5032
|
});
|
|
5053
|
-
debugLog("[
|
|
5033
|
+
debugLog("[盒子安装] 开始安装...");
|
|
5054
5034
|
await installer.install();
|
|
5055
|
-
debugLog("[
|
|
5035
|
+
debugLog("[盒子安装] 安装完成");
|
|
5056
5036
|
console.log(installer.getPrefixText() + boxen(
|
|
5057
5037
|
`${nodeEmoji.get("tada")} 插件初始化成功!`,
|
|
5058
5038
|
{
|
|
@@ -5066,7 +5046,7 @@ async function createBoxCommand(options) {
|
|
|
5066
5046
|
}
|
|
5067
5047
|
));
|
|
5068
5048
|
} catch (error) {
|
|
5069
|
-
debugLog(`[
|
|
5049
|
+
debugLog(`[盒子安装] 发生错误: ${error.message}`);
|
|
5070
5050
|
console.error(boxen(
|
|
5071
5051
|
`${chalk.yellow(error.message)}`,
|
|
5072
5052
|
{
|
|
@@ -5083,7 +5063,7 @@ async function createBoxCommand(options) {
|
|
|
5083
5063
|
}
|
|
5084
5064
|
}
|
|
5085
5065
|
function registerCommands(program2) {
|
|
5086
|
-
program2.command("box").description("盒子设备安装(无需登录)").option("-
|
|
5066
|
+
program2.command("box").description("盒子设备安装(无需登录)").option("-e, --env <env>", "环境 (test/prod)").option("--app-key <appKey>", "App Key").option("--app-secret <appSecret>", "App Secret").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--debug", "开启调试日志").action(createBoxCommand);
|
|
5087
5067
|
}
|
|
5088
5068
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
5089
5069
|
const __dirname$1 = dirname(__filename$1);
|
package/dist/index.js
CHANGED