@workclaw/cli 1.0.30 → 1.0.31
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
CHANGED
|
@@ -1,119 +1,139 @@
|
|
|
1
|
-
# WorkClaw CLI
|
|
2
|
-
|
|
3
|
-
WorkClaw CLI 是一个用于初始化和配置 WorkClaw 插件的命令行工具。
|
|
4
|
-
|
|
5
|
-
## 特性
|
|
6
|
-
|
|
7
|
-
- 🚀 **快速初始化** - 一键安装 WorkClaw 插件
|
|
8
|
-
- 🔐 **安全认证** - RSA 加密密码,保护用户隐私
|
|
9
|
-
- 🌐 **多平台支持** - Windows, macOS, Linux
|
|
10
|
-
- 📊 **详细日志** - 完整的请求/响应日志
|
|
11
|
-
- 🎨 **友好界面** - 彩色输出和加载动画
|
|
12
|
-
|
|
13
|
-
## 安装
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install -g @workclaw/cli
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## 快速开始
|
|
20
|
-
|
|
21
|
-
###
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
workclaw
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
###
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
workclaw
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## 使用文档
|
|
34
|
-
|
|
35
|
-
### 命令
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
#
|
|
39
|
-
workclaw
|
|
40
|
-
|
|
41
|
-
#
|
|
42
|
-
workclaw
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
| --
|
|
53
|
-
| --
|
|
54
|
-
| --
|
|
55
|
-
| --
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
|
|
1
|
+
# WorkClaw CLI
|
|
2
|
+
|
|
3
|
+
WorkClaw CLI 是一个用于初始化和配置 WorkClaw 插件的命令行工具。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 🚀 **快速初始化** - 一键安装 WorkClaw 插件
|
|
8
|
+
- 🔐 **安全认证** - RSA 加密密码,保护用户隐私
|
|
9
|
+
- 🌐 **多平台支持** - Windows, macOS, Linux
|
|
10
|
+
- 📊 **详细日志** - 完整的请求/响应日志
|
|
11
|
+
- 🎨 **友好界面** - 彩色输出和加载动画
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @workclaw/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 快速开始
|
|
20
|
+
|
|
21
|
+
### 本地账户安装
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
workclaw local
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 盒子设备安装
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
workclaw box
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 使用文档
|
|
34
|
+
|
|
35
|
+
### 命令
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 本地账户安装
|
|
39
|
+
workclaw local [options]
|
|
40
|
+
|
|
41
|
+
# 盒子设备安装
|
|
42
|
+
workclaw box [options]
|
|
43
|
+
|
|
44
|
+
# 帮助
|
|
45
|
+
workclaw --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### local 命令参数
|
|
49
|
+
|
|
50
|
+
| 参数 | 必填 | 说明 |
|
|
51
|
+
| --------------- | -- | -------------- |
|
|
52
|
+
| --phone | ❌ | 手机号码 |
|
|
53
|
+
| --user-pass | ❌ | 用户密码 |
|
|
54
|
+
| --scenario | ❌ | 安装场景 |
|
|
55
|
+
| --env | ❌ | 环境 (test/prod) |
|
|
56
|
+
| --plugin-version | ❌ | 插件版本号(默认最新版) |
|
|
57
|
+
| --debug | ❌ | 开启调试日志 |
|
|
58
|
+
|
|
59
|
+
### box 命令参数
|
|
60
|
+
|
|
61
|
+
| 参数 | 必填 | 说明 |
|
|
62
|
+
| --------------- | -- | -------------- |
|
|
63
|
+
| --app-key | ❌ | App Key |
|
|
64
|
+
| --app-secret | ❌ | App Secret |
|
|
65
|
+
| --env | ❌ | 环境 (test/prod) |
|
|
66
|
+
| --plugin-version | ❌ | 插件版本号(默认最新版) |
|
|
67
|
+
| --debug | ❌ | 开启调试日志 |
|
|
68
|
+
|
|
69
|
+
## 安装场景
|
|
70
|
+
|
|
71
|
+
| 场景 | 说明 |
|
|
72
|
+
| ------------- | -------------- |
|
|
73
|
+
| windows-local | Windows 本地安装 |
|
|
74
|
+
| mac-local | macOS 本地安装 |
|
|
75
|
+
| linux-local | Linux 本地安装 |
|
|
76
|
+
| linux-box | Linux Box 环境安装 |
|
|
77
|
+
|
|
78
|
+
## 开发
|
|
79
|
+
|
|
80
|
+
### 项目结构
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
packages/cli/
|
|
84
|
+
├── src/
|
|
85
|
+
│ ├── bin/ # CLI 入口
|
|
86
|
+
│ ├── lib/ # 核心库和基类
|
|
87
|
+
│ ├── local/ # 本地账户命令
|
|
88
|
+
│ ├── box/ # 盒子设备命令
|
|
89
|
+
│ ├── command/ # 命令基类
|
|
90
|
+
│ ├── shared/ # 共享模块
|
|
91
|
+
│ └── utils/ # 工具函数
|
|
92
|
+
├── vite.config.ts
|
|
93
|
+
└── README.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 构建
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run build # 构建
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 更新日志
|
|
103
|
+
|
|
104
|
+
### v1.0.30 (2026-04-23)
|
|
105
|
+
|
|
106
|
+
- ✨ 新增 local 命令 - 本地账户安装(需要登录)
|
|
107
|
+
- ✨ 新增 box 命令 - 盒子设备安装(无需登录)
|
|
108
|
+
- 🔧 重构命令结构,分离 local 和 box 命令
|
|
109
|
+
|
|
110
|
+
### v2.0.0 (2026-04-08)
|
|
111
|
+
|
|
112
|
+
- ✨ 新增 phone + userPass 认证方式
|
|
113
|
+
- 🔒 新增 RSA 密码加密
|
|
114
|
+
- 📝 新增完整请求日志
|
|
115
|
+
- 🎨 优化交互式提示和进度显示
|
|
116
|
+
- 🌐 支持 NPM 安装插件
|
|
117
|
+
- 🔧 统一错误码管理
|
|
118
|
+
|
|
119
|
+
### v1.0.0
|
|
120
|
+
|
|
121
|
+
- 🎉 初始版本
|
|
122
|
+
- ✨ 支持 appKey + appSecret 认证
|
|
123
|
+
- ✨ 支持多平台安装
|
|
124
|
+
|
|
125
|
+
## 许可证
|
|
126
|
+
|
|
127
|
+
MIT License
|
|
128
|
+
|
|
129
|
+
## 联系方式
|
|
130
|
+
|
|
131
|
+
- 项目主页: [GitHub]()
|
|
132
|
+
- 问题反馈: [Issue Tracker]()
|
|
133
|
+
|
|
134
|
+
## 致谢
|
|
135
|
+
|
|
136
|
+
- [commander](https://github.com/tj/commander.js) - 命令行解析
|
|
137
|
+
- [chalk](https://github.com/chalk/chalk) - 彩色输出
|
|
138
|
+
- [ora](https://github.com/sindresorhus/ora) - 加载动画
|
|
139
|
+
- [axios](https://github.com/axios/axios) - HTTP 客户端
|
|
@@ -197,7 +197,7 @@ class BoxInstaller {
|
|
|
197
197
|
this.spinner.text = chalk.cyan("正在安装插件...");
|
|
198
198
|
try {
|
|
199
199
|
await execAsync$1(
|
|
200
|
-
`openclaw plugins install ${PLUGIN_PACKAGE_NAME$1} --dangerously-force-unsafe-install`,
|
|
200
|
+
`openclaw plugins install ${PLUGIN_PACKAGE_NAME$1} --dangerously-force-unsafe-install --pin`,
|
|
201
201
|
{ timeout: 12e4 }
|
|
202
202
|
);
|
|
203
203
|
debugLog("[安装插件] openclaw plugins install 执行成功");
|
|
@@ -4744,19 +4744,55 @@ class LocalInstaller {
|
|
|
4744
4744
|
debugLog("[安装插件] 创建扩展目录...");
|
|
4745
4745
|
await fs.mkdir(paths.extensions, { recursive: true });
|
|
4746
4746
|
debugLog(`[安装插件] 扩展目录: ${paths.extensions}`);
|
|
4747
|
-
debugLog("[安装插件]
|
|
4747
|
+
debugLog("[安装插件] 直接使用 pnpm 从 npm 安装...");
|
|
4748
4748
|
try {
|
|
4749
|
+
await fs.mkdir(paths.target, { recursive: true });
|
|
4750
|
+
const packageJson = {
|
|
4751
|
+
name: "temp-install",
|
|
4752
|
+
version: "1.0.0",
|
|
4753
|
+
private: true
|
|
4754
|
+
};
|
|
4755
|
+
await fs.writeFile(
|
|
4756
|
+
path.join(paths.target, "package.json"),
|
|
4757
|
+
JSON.stringify(packageJson, null, 2)
|
|
4758
|
+
);
|
|
4759
|
+
debugLog(`[安装插件] 执行 pnpm add ${PLUGIN_PACKAGE_NAME}`);
|
|
4749
4760
|
await execAsync(
|
|
4750
|
-
`
|
|
4751
|
-
{ timeout: 12e4 }
|
|
4761
|
+
`pnpm add ${PLUGIN_PACKAGE_NAME}`,
|
|
4762
|
+
{ cwd: paths.target, timeout: 12e4 }
|
|
4752
4763
|
);
|
|
4753
|
-
|
|
4764
|
+
const nodeModulesPath = path.join(paths.target, "node_modules", PLUGIN_PACKAGE_NAME);
|
|
4765
|
+
const files = await fs.readdir(nodeModulesPath);
|
|
4766
|
+
for (const file of files) {
|
|
4767
|
+
const srcPath = path.join(nodeModulesPath, file);
|
|
4768
|
+
const destPath = path.join(paths.target, file);
|
|
4769
|
+
await fs.rename(srcPath, destPath);
|
|
4770
|
+
}
|
|
4771
|
+
await fs.rm(path.join(paths.target, "node_modules"), { recursive: true, force: true });
|
|
4772
|
+
await fs.unlink(path.join(paths.target, "package.json"));
|
|
4773
|
+
if (await fs.access(path.join(paths.target, "pnpm-lock.yaml")).then(() => true).catch(() => false)) {
|
|
4774
|
+
await fs.unlink(path.join(paths.target, "pnpm-lock.yaml"));
|
|
4775
|
+
}
|
|
4776
|
+
debugLog("[安装插件] pnpm 安装完成");
|
|
4754
4777
|
this.prefixText += chalk.green(` ✓ 插件安装完成
|
|
4755
4778
|
`);
|
|
4756
4779
|
} catch (error) {
|
|
4757
4780
|
const errorMsg = error.message || "未知错误";
|
|
4758
4781
|
debugLog(`[安装插件] 安装失败: ${errorMsg}`);
|
|
4759
|
-
|
|
4782
|
+
debugLog("[安装插件] 尝试使用 openclaw 安装...");
|
|
4783
|
+
try {
|
|
4784
|
+
await execAsync(
|
|
4785
|
+
`openclaw plugins install ${PLUGIN_PACKAGE_NAME} --dangerously-force-unsafe-install`,
|
|
4786
|
+
{ timeout: 12e4 }
|
|
4787
|
+
);
|
|
4788
|
+
debugLog("[安装插件] openclaw plugins install 执行成功");
|
|
4789
|
+
this.prefixText += chalk.green(` ✓ 插件安装完成
|
|
4790
|
+
`);
|
|
4791
|
+
} catch (fallbackError) {
|
|
4792
|
+
const fallbackErrorMsg = fallbackError.message || "未知错误";
|
|
4793
|
+
debugLog(`[安装插件] openclaw 安装也失败: ${fallbackErrorMsg}`);
|
|
4794
|
+
throw new AppError2(ERROR_CODES.NPM_INSTALL_FAILED, `插件安装失败: ${fallbackErrorMsg}`);
|
|
4795
|
+
}
|
|
4760
4796
|
}
|
|
4761
4797
|
}
|
|
4762
4798
|
async doUpdateConfig(paths, boundConfig, env) {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/local/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAsD/E,qBAAa,cAAc;IAIb,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,UAAU,CAAa;gBAEX,MAAM,EAAE,oBAAoB;IAIhD,cAAc,IAAI,IAAI;IAYhB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAoC9B,aAAa,IAAI,MAAM;YAIT,OAAO;YAoBP,kBAAkB;YAalB,eAAe;YAmBf,iBAAiB;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/local/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAsD/E,qBAAa,cAAc;IAIb,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,UAAU,CAAa;gBAEX,MAAM,EAAE,oBAAoB;IAIhD,cAAc,IAAI,IAAI;IAYhB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAoC9B,aAAa,IAAI,MAAM;YAIT,OAAO;YAoBP,kBAAkB;YAalB,eAAe;YAmBf,iBAAiB;YA2EjB,cAAc;CA+M7B"}
|