@workclaw/cli 1.0.1 → 1.0.16

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.
Files changed (42) hide show
  1. package/README.md +165 -119
  2. package/dist/index-RP7oF6iQ.js +5032 -0
  3. package/dist/index.js +1 -1
  4. package/package.json +7 -5
  5. package/dist/bin/cli.d.ts +0 -3
  6. package/dist/bin/cli.d.ts.map +0 -1
  7. package/dist/index-M9uYCvsL.js +0 -1175
  8. package/dist/index.d.ts +0 -1
  9. package/dist/init/index.d.ts +0 -6
  10. package/dist/init/index.d.ts.map +0 -1
  11. package/dist/init/src/init.d.ts +0 -39
  12. package/dist/init/src/init.d.ts.map +0 -1
  13. package/dist/init/src/installer/base-installer.d.ts +0 -36
  14. package/dist/init/src/installer/base-installer.d.ts.map +0 -1
  15. package/dist/init/src/installer/box-installer.d.ts +0 -39
  16. package/dist/init/src/installer/box-installer.d.ts.map +0 -1
  17. package/dist/init/src/installer/index.d.ts +0 -4
  18. package/dist/init/src/installer/index.d.ts.map +0 -1
  19. package/dist/init/src/installer/local-installer.d.ts +0 -27
  20. package/dist/init/src/installer/local-installer.d.ts.map +0 -1
  21. package/dist/init/src/types/index.d.ts +0 -36
  22. package/dist/init/src/types/index.d.ts.map +0 -1
  23. package/dist/lib/command/base-command.d.ts +0 -16
  24. package/dist/lib/command/base-command.d.ts.map +0 -1
  25. package/dist/lib/index.d.ts +0 -2
  26. package/dist/lib/index.d.ts.map +0 -1
  27. package/dist/utils/config-default.d.ts +0 -28
  28. package/dist/utils/config-default.d.ts.map +0 -1
  29. package/dist/utils/config.d.ts +0 -21
  30. package/dist/utils/config.d.ts.map +0 -1
  31. package/dist/utils/crypto.d.ts +0 -13
  32. package/dist/utils/crypto.d.ts.map +0 -1
  33. package/dist/utils/error.d.ts +0 -34
  34. package/dist/utils/error.d.ts.map +0 -1
  35. package/dist/utils/http.d.ts +0 -27
  36. package/dist/utils/http.d.ts.map +0 -1
  37. package/dist/utils/index.d.ts +0 -8
  38. package/dist/utils/index.d.ts.map +0 -1
  39. package/dist/utils/logger.d.ts +0 -16
  40. package/dist/utils/logger.d.ts.map +0 -1
  41. package/dist/utils/path.d.ts +0 -23
  42. package/dist/utils/path.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,119 +1,165 @@
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 init
25
- ```
26
-
27
- ### 命令行参数
28
-
29
- ```bash
30
- workclaw init --phone 13800138000 --user-pass mypassword
31
- ```
32
-
33
- ## 使用文档
34
-
35
- ### 命令
36
-
37
- ```bash
38
- # 初始化
39
- workclaw init [options]
40
-
41
- # 帮助
42
- workclaw --help
43
- ```
44
-
45
- ### 参数
46
-
47
- | 参数 | 必填 | 说明 |
48
- |------|------|------|
49
- | --phone | | 手机号码 |
50
- | --user-pass | | 用户密码 |
51
- | --scenario | | 安装场景 |
52
- | --env | ❌ | 环境 (test/prod) |
53
- | --base-url | ❌ | API 地址 |
54
- | --ws-url | ❌ | WebSocket 地址 |
55
- | --force | | 强制覆盖 |
56
-
57
- ## 安装场景
58
-
59
- | 场景 | 说明 |
60
- |------|------|
61
- | windows-local | Windows 本地安装 |
62
- | mac-local | macOS 本地安装 |
63
- | linux-local | Linux 本地安装 |
64
- | linux-box | Linux Box 环境安装 |
65
-
66
- ## 开发
67
-
68
- ### 项目结构
69
-
70
- ```
71
- packages/cli/
72
- ├── src/
73
- │ ├── bin/ # CLI 入口
74
- ├── lib/ # 核心库和基类
75
- │ ├── init/ # 初始化命令
76
- │ │ └── installer/ # 安装器
77
- │ └── utils/ # 工具函数
78
- ├── vite.config.ts
79
- └── README.md
80
- ```
81
-
82
- ### 构建
83
-
84
- ```bash
85
- npm run build # 构建
86
- ```
87
-
88
- ## 更新日志
89
-
90
- ### v2.0.0 (2026-04-08)
91
-
92
- - ✨ 新增 phone + userPass 认证方式
93
- - 🔒 新增 RSA 密码加密
94
- - 📝 新增完整请求日志
95
- - 🎨 优化交互式提示和进度显示
96
- - 🌐 支持 NPM 安装插件
97
- - 🔧 统一错误码管理
98
-
99
- ### v1.0.0
100
-
101
- - 🎉 初始版本
102
- - 支持 appKey + appSecret 认证
103
- - ✨ 支持多平台安装
104
-
105
- ## 许可证
106
-
107
- MIT License
108
-
109
- ## 联系方式
110
-
111
- - 项目主页: [GitHub]()
112
- - 问题反馈: [Issue Tracker]()
113
-
114
- ## 致谢
115
-
116
- - [commander](https://github.com/tj/commander.js) - 命令行解析
117
- - [chalk](https://github.com/chalk/chalk) - 彩色输出
118
- - [ora](https://github.com/sindresorhus/ora) - 加载动画
119
- - [axios](https://github.com/axios/axios) - HTTP 客户端
1
+ # WorkClaw CLI
2
+
3
+ WorkClaw CLI 是一个用于初始化和配置 WorkClaw 插件的命令行工具。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ # 使用 npm 安装
9
+ npm install -g @workclaw/cli
10
+
11
+ # 使用 npx 直接运行(无需安装)
12
+ npx @workclaw/cli local
13
+ ```
14
+
15
+ ## 使用
16
+
17
+ ### 命令
18
+
19
+ CLI 提供两个命令:
20
+
21
+ | 命令 | 说明 |
22
+ |------|------|
23
+ | `workclaw local` | 本地账户安装(需要登录) |
24
+ | `workclaw box` | 盒子设备安装(无需登录) |
25
+
26
+ ### 交互式初始化
27
+
28
+ ```bash
29
+ # 本地安装(需要手机号密码)
30
+ workclaw local
31
+ # 或使用 npx
32
+ npx @workclaw/cli local
33
+
34
+ # 盒子安装(需要 AppKey 和 AppSecret)
35
+ workclaw box
36
+ # 或使用 npx
37
+ npx @workclaw/cli box
38
+ ```
39
+
40
+ ### 命令行参数
41
+
42
+ #### local 命令参数
43
+
44
+ | 参数 | 缩写 | 说明 |
45
+ | ---------------- | -- | -------------- |
46
+ | --scenario | -s | 安装场景 |
47
+ | --env | -e | 环境 (test/prod) |
48
+ | --phone | 无 | 手机号码 |
49
+ | --user-pass | | 用户密码 |
50
+ | --plugin-version | | 插件版本号 |
51
+ | --debug | | 调试模式 |
52
+
53
+ #### box 命令参数
54
+
55
+ | 参数 | 缩写 | 说明 |
56
+ | ---------------- | -- | -------------- |
57
+ | --scenario | -s | 安装场景 |
58
+ | --env | -e | 环境 (test/prod) |
59
+ | --app-key | | App Key |
60
+ | --app-secret | 无 | App Secret |
61
+ | --plugin-version | 无 | 插件版本号 |
62
+ | --debug | | 调试模式 |
63
+
64
+ ### 安装场景
65
+
66
+ | 场景 | 说明 |
67
+ | ------------- | ------------ |
68
+ | windows-local | Windows 本地安装 |
69
+ | mac-local | macOS 本地安装 |
70
+ | linux-local | Linux 本地安装 |
71
+
72
+ ### 环境
73
+
74
+ | 环境 | 说明 |
75
+ | ---- | ---- |
76
+ | test | 测试环境 |
77
+ | prod | 正式环境 |
78
+
79
+ ## 示例
80
+
81
+ ### 本地安装
82
+
83
+ #### 交互式安装(推荐新手使用)
84
+
85
+ ```bash
86
+ # 全局安装后运行
87
+ workclaw local
88
+
89
+ # 或使用 npx 直接运行
90
+ npx @workclaw/cli local
91
+ ```
92
+
93
+ #### 仅指定手机号和密码
94
+
95
+ ```bash
96
+ workclaw local --phone 13800138000 --user-pass your_password
97
+ ```
98
+
99
+ #### 完整参数指定
100
+
101
+ ```bash
102
+ workclaw local --scenario windows-local --env test --phone 13800138000 --user-pass your_password
103
+ ```
104
+
105
+ #### 使用正式环境
106
+
107
+ ```bash
108
+ workclaw local --env prod --phone 13800138000 --user-pass your_password
109
+ ```
110
+
111
+ #### macOS 安装
112
+
113
+ ```bash
114
+ workclaw local --scenario mac-local --phone 13800138000 --user-pass your_password
115
+ ```
116
+
117
+ #### Linux 安装
118
+
119
+ ```bash
120
+ workclaw local --scenario linux-local --phone 13800138000 --user-pass your_password
121
+ ```
122
+
123
+ ### 盒子安装
124
+
125
+ 盒子安装适用于不需要用户登录的场景,直接使用 AppKey 和 AppSecret 进行安装:
126
+
127
+ ```bash
128
+ # 基本用法
129
+ workclaw box --app-key your_app_key --app-secret your_app_secret
130
+
131
+ # 指定环境
132
+ 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
+ ```
137
+
138
+ ### 指定插件版本
139
+
140
+ 可以使用 `--plugin-version` 参数安装指定版本的插件(默认安装最新版):
141
+
142
+ ```bash
143
+ # 安装指定版本
144
+ workclaw local --phone 13800138000 --user-pass your_password --plugin-version 1.0.0
145
+ workclaw box --app-key your_app_key --app-secret your_app_secret --plugin-version 1.0.0
146
+ ```
147
+
148
+ ### 调试模式
149
+
150
+ 当安装失败时,可以使用 `--debug` 参数查看详细日志:
151
+
152
+ ```bash
153
+ # 本地安装 + 调试模式
154
+ workclaw local --phone 13800138000 --user-pass your_password --debug
155
+
156
+ # 盒子安装 + 调试模式
157
+ workclaw box --app-key your_app_key --app-secret your_app_secret --debug
158
+
159
+ # 完整参数 + 调试模式
160
+ workclaw local --scenario windows-local --env test --phone 13800138000 --user-pass your_password --debug
161
+ ```
162
+
163
+ ## 许可证
164
+
165
+ MIT License