tolingcode 2026.3.816 → 2026.3.818

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 (3) hide show
  1. package/README.md +180 -33
  2. package/bin/tolingcode.js +195 -16
  3. package/package.json +7 -4
package/README.md CHANGED
@@ -5,66 +5,158 @@
5
5
  <img src="https://raw.githubusercontent.com/tolingcode/tolingcode/main/docs/banner.png" alt="TolingCode banner">
6
6
  </p>
7
7
 
8
-
9
8
  ![npm](https://img.shields.io/npm/v/tolingcode)
10
9
  ![downloads](https://img.shields.io/npm/dm/tolingcode)
11
10
  ![license](https://img.shields.io/badge/license-MIT-green)
12
11
 
13
12
  # TolingCode CLI
14
13
 
15
- **跨境电商私人 AI 助手** - 在个人设备上运行的本地化 AI 自动化工具 , tolingcode Skills完全兼容openclaw。
14
+ **跨境电商私人 AI 助手** - 基于 OpenClaw 的本地化 AI 自动化工具
16
15
 
17
- 为跨境卖家提供订单履约、库存管理、产品刊登、广告管理、数据分析等核心业务能力。
16
+ TolingCode Skills 完全兼容 OpenClaw,为跨境卖家提供订单履约、库存管理、产品刊登、广告管理、数据分析等核心业务能力。
18
17
 
19
18
  ---
20
19
 
21
- ## 安装
20
+ ## 快速开始
21
+
22
+ ### 1. 安装 TolingCode
22
23
 
23
24
  ```bash
24
25
  # 安装最新版本
25
26
  npm install -g tolingcode@latest
27
+ ```
28
+
29
+ ### 2. 安装 OpenClaw
30
+
31
+ ```bash
32
+ # 通过 tolingcode 安装 OpenClaw(推荐)
33
+ tolingcode install openclaw
26
34
 
27
35
  # 安装指定版本
28
- npm install -g tolingcode@2026.03.09
36
+ tolingcode install openclaw -v 2026.3.7
37
+
38
+ # 强制重新安装
39
+ tolingcode install openclaw --force
40
+ ```
41
+
42
+ ### 3. 启动 OpenClaw Gateway
43
+
44
+ ```bash
45
+ openclaw gateway start
29
46
  ```
30
47
 
31
- **当前版本**: 2026.03.09
48
+ ### 4. 安装技能
49
+
50
+ ```bash
51
+ # 安装大健云仓技能(跨境电商 B2B)
52
+ tolingcode install skills gigacloud-warehouse
53
+
54
+ # 安装订单履约管理技能
55
+ tolingcode install skills order-fulfillment
56
+
57
+ # 安装远程 Linux 运维技能
58
+ tolingcode install skills hbj-ai-shell
59
+ ```
32
60
 
33
61
  ---
34
62
 
35
- ## 使用
63
+ ## 跨平台支持
64
+
65
+ ✅ **完全支持**: Windows / Linux / macOS
66
+
67
+ ### 路径说明
36
68
 
37
- ### 安装技能 (Skill)
69
+ | 系统 | OpenClaw 工作目录 | 全局应用目录 |
70
+ |------|------------------|-------------|
71
+ | **Windows** | `C:\Users\<用户名>\.openclaw\workspace` | `%APPDATA%\tolingcode\apps` |
72
+ | **Linux** | `/home/<用户名>/.openclaw/workspace` | `~/.local/tolingcode/apps` |
73
+ | **macOS** | `/Users/<用户名>/.openclaw/workspace` | `~/.local/tolingcode/apps` |
74
+
75
+ ### 自定义工作目录
38
76
 
39
77
  ```bash
40
- # 安装技能
41
- tolingcode install skills weather
78
+ # 通过环境变量自定义 OpenClaw 工作目录
79
+ # Windows
80
+ set OPENCLAW_WORKSPACE=D:\my-workspace
42
81
 
43
- # 安装指定版本
44
- tolingcode install skills weather -v 2026.03.08
82
+ # Linux/Mac
83
+ export OPENCLAW_WORKSPACE=/path/to/my-workspace
84
+
85
+ # 然后安装技能
86
+ tolingcode install skills gigacloud-warehouse
45
87
  ```
46
88
 
47
- ### 安装应用 (App)
89
+ ### 系统要求
90
+
91
+ - **Node.js**: >= 16.0.0
92
+ - **npm**: >= 7.0.0
93
+ - **OpenClaw**: 自动安装(通过 `tolingcode install openclaw`)
94
+
95
+ ---
96
+
97
+ ## 命令参考
98
+
99
+ ### 安装命令
48
100
 
49
101
  ```bash
50
- # 安装到当前目录
51
- tolingcode install apps myapp
102
+ # 安装 OpenClaw
103
+ tolingcode install openclaw
104
+
105
+ # 安装技能
106
+ tolingcode install skills <skill-name>
52
107
 
53
- # 全局安装
54
- tolingcode install apps myapp -g
108
+ # 安装应用
109
+ tolingcode install apps <app-name>
110
+
111
+ # 指定版本安装
112
+ tolingcode install skills <skill-name> -v 2026.3.8
113
+
114
+ # 全局安装应用
115
+ tolingcode install apps <app-name> -g
116
+
117
+ # 强制重新安装 OpenClaw
118
+ tolingcode install openclaw --force
55
119
  ```
56
120
 
57
121
  ### 查看和搜索
58
122
 
59
123
  ```bash
60
- # 列出所有包
124
+ # 列出所有可用包
61
125
  tolingcode list
62
126
 
63
127
  # 只列出技能
64
128
  tolingcode list skills
65
129
 
130
+ # 只列出应用
131
+ tolingcode list apps
132
+
66
133
  # 搜索技能
67
- tolingcode search weather
134
+ tolingcode search 电商
135
+ tolingcode search gigacloud
136
+ tolingcode search order
137
+ ```
138
+
139
+ ### 发布技能(开发者)
140
+
141
+ ```bash
142
+ tolingcode publish ./my-skill \
143
+ --type skills \
144
+ --name my-skill \
145
+ --version 2026.3.9
146
+ ```
147
+
148
+ ### 其他命令
149
+
150
+ ```bash
151
+ # 查看使用示例
152
+ tolingcode examples
153
+
154
+ # 查看版本
155
+ tolingcode --version
156
+
157
+ # 查看帮助
158
+ tolingcode --help
159
+ tolingcode install --help
68
160
  ```
69
161
 
70
162
  ---
@@ -99,30 +191,52 @@ tolingcode search weather
99
191
 
100
192
  ---
101
193
 
102
- ## 发布技能 (开发者)
194
+ ## 支持平台
103
195
 
104
- ```bash
105
- tolingcode publish ./my-skill \
106
- --type skills \
107
- --name my-skill \
108
- --version 2026.03.09
109
- ```
196
+ **电商平台**: Amazon、eBay、AliExpress、Wish、Shopee、Lazada、Mercado Libre、Etsy、Wayfair、TikTok Shop 等
110
197
 
111
- ### 版本规范
198
+ **独立站**: Shopify、WooCommerce、Magento、BigCommerce
199
+
200
+ **零售平台**: Walmart、Target、Costco、Best Buy 等
112
201
 
113
- 使用日期版本号:`YYYY.MM.DD`
202
+ **海外仓**: 支持 100+ 海外仓系统 (中通国际、Walmart WFS、马士基、RMS 红鼠等)
114
203
 
115
204
  ---
116
205
 
117
- ## 支持平台
206
+ ## 版本规范
118
207
 
119
- **电商平台**: Amazon、eBay、AliExpress、Wish、Shopee、Lazada、Mercado Libre、Etsy、Wayfair、TikTok Shop 等
208
+ 使用日期版本号:`YYYY.M.D`(无前导零)
120
209
 
121
- **独立站**: Shopify、WooCommerce、Magento、BigCommerce
210
+ 示例:
211
+ - ✅ `2026.3.9`
212
+ - ❌ `2026.03.09`
122
213
 
123
- **零售平台**: Walmart、Target、Costco、Best Buy 等
214
+ ---
124
215
 
125
- **海外仓**: 支持 100+ 海外仓系统 (中通国际、Walmart WFS、马士基、RMS 红鼠等)
216
+ ## 私有 Registry
217
+
218
+ TolingCode 支持从私有 Registry 安装技能:
219
+
220
+ ```bash
221
+ # 设置私有 Registry 地址
222
+ set TOLINGCODE_REGISTRY=http://your-registry.com/api/registry
223
+
224
+ # 安装技能
225
+ tolingcode install skills your-skill
226
+ ```
227
+
228
+ ### 部署私有 Registry
229
+
230
+ 参考 `server/registry.js` 部署自己的技能注册中心。
231
+
232
+ ---
233
+
234
+ ## 环境变量
235
+
236
+ | 变量 | 默认值 | 说明 |
237
+ |------|--------|------|
238
+ | `TOLINGCODE_REGISTRY` | `https://toling.me/api/registry` | Registry 服务器地址 |
239
+ | `OPENCLAW_WORKSPACE` | `~/.openclaw/workspace` | OpenClaw 工作目录 |
126
240
 
127
241
  ---
128
242
 
@@ -130,9 +244,42 @@ tolingcode publish ./my-skill \
130
244
 
131
245
  - **Registry**: https://toling.me
132
246
  - **GitHub**: https://github.com/tolingcode/tolingcode
247
+ - **OpenClaw**: https://github.com/openclaw/openclaw
248
+ - **OpenClaw 文档**: https://docs.openclaw.ai
133
249
  - **问题反馈**: GitHub Issues
134
250
 
135
251
  ---
136
252
 
253
+ ## 开发
254
+
255
+ ```bash
256
+ # 克隆仓库
257
+ git clone https://github.com/tolingcode/tolingcode.git
258
+ cd tolingcode
259
+
260
+ # 安装依赖
261
+ npm install
262
+
263
+ # 本地测试
264
+ npm link
265
+
266
+ # 运行命令
267
+ tolingcode --help
268
+ ```
269
+
270
+ ---
271
+
272
+ ## 更新日志
273
+
274
+ ### 2026.3.21
275
+
276
+ - ✨ 新增:支持通过 `tolingcode install openclaw` 安装/更新 OpenClaw
277
+ - ✨ 新增:支持 `--force` 参数强制重装 OpenClaw
278
+ - ✨ 新增:支持 `-v` 参数指定 OpenClaw 版本
279
+ - 🎨 改进:统一命令入口,所有安装通过 `tolingcode` 管理
280
+ - 📝 改进:完善帮助信息和文档
281
+
282
+ ---
283
+
137
284
  **作者**: 韩宝军 (TolingCode)
138
285
  **License**: MIT
package/bin/tolingcode.js CHANGED
@@ -16,18 +16,152 @@ const REGISTRY_URL = process.env.TOLINGCODE_REGISTRY || 'https://toling.me/api/r
16
16
 
17
17
  program
18
18
  .name('tolingcode')
19
- .description('TolingCode CLI - Install skills and apps from toling.me')
20
- .version(pkg.version);
19
+ .description(chalk.hex('#0de900')('TolingCode CLI - 鲸汇跨境电商 AI 助手技能管理工具'))
20
+ .version(pkg.version, '-v, --version', chalk.hex('#FFFFFF')('显示版本号'))
21
+ .addHelpText('after', `
22
+ ${chalk.hex('#0de900').bold('快速开始:')}
23
+ ${chalk.hex('#ff6319')('# 安装 OpenClaw')}
24
+ ${chalk.hex('#0de900')('$ tolingcode install openclaw')} ${chalk.white('# 安装/更新 OpenClaw')}
25
+ ${chalk.hex('#0de900')('$ tolingcode install openclaw -v 2026.3.7')} ${chalk.white('# 安装指定版本')}
26
+
27
+ ${chalk.hex('#ff6319')('# 安装技能')}
28
+ ${chalk.hex('#0de900')('$ tolingcode install skills gigacloud-warehouse')} ${chalk.white('# 大健云仓(跨境电商 B2B)')}
29
+ ${chalk.hex('#0de900')('$ tolingcode install skills order-fulfillment')} ${chalk.white('# 订单履约管理')}
30
+ ${chalk.hex('#0de900')('$ tolingcode install skills hbj-ai-shell')} ${chalk.white('# 远程 Linux 运维')}
31
+
32
+ ${chalk.hex('#ff6319')('# 列出技能')}
33
+ ${chalk.hex('#0de900')('$ tolingcode list skills')}
34
+
35
+ ${chalk.hex('#ff6319')('# 搜索技能')}
36
+ ${chalk.hex('#0de900')('$ tolingcode search 电商')}
37
+ ${chalk.hex('#0de900')('$ tolingcode search gigacloud')}
38
+
39
+ ${chalk.hex('#ff6319')('# 查看更多示例')}
40
+ ${chalk.hex('#0de900')('$ tolingcode examples')}
41
+ `);
21
42
 
22
- // install command
43
+ // Override help output colors - all orange
44
+ const originalHelpInformation = program.helpInformation.bind(program);
45
+ program.helpInformation = function() {
46
+ const help = originalHelpInformation();
47
+ return help
48
+ .replace(/^(Options:)/gm, chalk.hex('#0de900').bold('$1'))
49
+ .replace(/^(Commands:)/gm, chalk.hex('#0de900').bold('$1'))
50
+ .replace(/^ (-v, --version)/gm, chalk.hex('#0de900')('$1'))
51
+ .replace(/^ (-h, --help)/gm, chalk.hex('#0de900')('$1'))
52
+ .replace(/^ (install)/gm, chalk.hex('#0de900')('$1'))
53
+ .replace(/^ (list)/gm, chalk.hex('#0de900')('$1'))
54
+ .replace(/^ (search)/gm, chalk.hex('#0de900')('$1'))
55
+ .replace(/^ (publish)/gm, chalk.hex('#0de900')('$1'))
56
+ .replace(/^ (examples)/gm, chalk.hex('#0de900')('$1'))
57
+ .replace(/^ (help)/gm, chalk.hex('#0de900')('$1'));
58
+ };
59
+
60
+ /**
61
+ * 安装/更新 OpenClaw
62
+ */
63
+ async function installOpenClaw(name, version, force) {
64
+ const versionStr = version === 'latest' ? 'latest' : version;
65
+
66
+ console.log(chalk.blue(`\n📦 准备安装 OpenClaw@${versionStr}...\n`));
67
+
68
+ // 检查当前版本
69
+ let currentVersion = null;
70
+ try {
71
+ currentVersion = execSync('openclaw --version', { encoding: 'utf-8' }).trim();
72
+ console.log(chalk.gray(` 当前版本:${currentVersion}`));
73
+ } catch (e) {
74
+ console.log(chalk.gray(` 当前版本:未安装`));
75
+ }
76
+
77
+ // 获取最新版本
78
+ let latestVersion = null;
79
+ try {
80
+ latestVersion = execSync('npm view openclaw version', { encoding: 'utf-8' }).trim();
81
+ console.log(chalk.gray(` 最新版本:${latestVersion}\n`));
82
+ } catch (e) {
83
+ // 忽略
84
+ }
85
+
86
+ // 检查是否需要更新
87
+ if (!force && currentVersion && latestVersion && currentVersion === latestVersion) {
88
+ console.log(chalk.green(`\n✅ 已是最新版本:${currentVersion}`));
89
+ console.log(chalk.gray(` 如需强制重装,使用 --force 参数\n`));
90
+ return;
91
+ }
92
+
93
+ // 开始安装
94
+ const installVersion = version === 'latest' ? '' : `@${version}`;
95
+ const spinner = ora(`安装 openclaw${installVersion}...`).start();
96
+
97
+ try {
98
+ execSync(`npm install -g openclaw${installVersion}`, {
99
+ encoding: 'utf-8',
100
+ stdio: 'pipe'
101
+ });
102
+
103
+ spinner.stop();
104
+ console.log(chalk.green('\n✅ 安装完成!\n'));
105
+
106
+ // 验证安装
107
+ const newVersion = execSync('openclaw --version', { encoding: 'utf-8' }).trim();
108
+ console.log(chalk.green(`📦 已安装版本:${newVersion}\n`));
109
+
110
+ // 检查 Gateway 状态
111
+ console.log(chalk.gray('🔍 检查 Gateway 状态...'));
112
+ try {
113
+ const status = execSync('openclaw gateway status', { encoding: 'utf-8' });
114
+ if (status.includes('Listening')) {
115
+ console.log(chalk.green('✅ Gateway 运行正常\n'));
116
+ } else {
117
+ console.log(chalk.yellow('⚠️ Gateway 未运行\n'));
118
+ console.log(chalk.gray(' 启动命令:openclaw gateway start\n'));
119
+ }
120
+ } catch (e) {
121
+ console.log(chalk.yellow('⚠️ Gateway 未运行\n'));
122
+ console.log(chalk.gray(' 启动命令:openclaw gateway start\n'));
123
+ }
124
+
125
+ console.log(chalk.cyan('💡 常用命令:'));
126
+ console.log(chalk.gray(' openclaw --version 查看版本'));
127
+ console.log(chalk.gray(' openclaw gateway start 启动 Gateway'));
128
+ console.log(chalk.gray(' tolingcode list skills 查看可用技能\n'));
129
+
130
+ } catch (e) {
131
+ spinner.stop();
132
+ console.log(chalk.red(`\n❌ 安装失败:${e.message}\n`));
133
+ console.log(chalk.gray('请检查:'));
134
+ console.log(chalk.gray(' 1. 网络连接是否正常'));
135
+ console.log(chalk.gray(' 2. npm 是否已安装'));
136
+ console.log(chalk.gray(' 3. 是否有管理员权限\n'));
137
+ process.exit(1);
138
+ }
139
+ }
140
+
141
+ // install command - support both "install openclaw" and "install type name"
23
142
  program
24
- .command('install <type> <name>')
25
- .description('Install a skill or app')
26
- .option('-v, --version <version>', 'Specify version (e.g., 2026.02.26 or latest)')
27
- .option('-g, --global', 'Install globally (for apps)')
143
+ .command('install <type> [name]')
144
+ .description('安装技能、应用或 OpenClaw 本身')
145
+ .option('-v, --version <version>', '指定版本 (默认:latest)')
146
+ .option('-g, --global', '全局安装 ( apps)')
147
+ .option('--force', '强制重新安装 (仅 openclaw)')
28
148
  .action(async (type, name, options) => {
29
149
  const version = options.version || 'latest';
30
150
 
151
+ // 特殊处理:安装 OpenClaw 本身
152
+ if (type === 'openclaw' || name === 'openclaw') {
153
+ await installOpenClaw('openclaw', version, options.force || false);
154
+ return;
155
+ }
156
+
157
+ // 需要 type 和 name
158
+ if (!name) {
159
+ console.log(chalk.red('\n✗ 错误:缺少参数 name'));
160
+ console.log(chalk.gray(' 用法:tolingcode install <type> <name>\n'));
161
+ program.outputHelp();
162
+ process.exit(1);
163
+ }
164
+
31
165
  console.log(chalk.blue(`\n🔍 Searching for ${type}: ${name}@${version}...`));
32
166
 
33
167
  try {
@@ -43,14 +177,21 @@ program
43
177
  console.log(chalk.gray(` Description: ${pkg.description}`));
44
178
  console.log(chalk.gray(` Download URL: ${pkg.downloadUrl}`));
45
179
 
46
- // Determine install path
180
+ // Determine install path (cross-platform)
47
181
  let installPath;
48
182
  if (type === 'skills') {
49
- const workspace = process.env.OPENCLAW_WORKSPACE || path.join(process.env.HOME || process.env.USERPROFILE, '.openclaw', 'workspace');
183
+ // OpenClaw workspace path (cross-platform)
184
+ const homeDir = process.env.HOME || process.env.USERPROFILE || require('os').homedir();
185
+ const workspace = process.env.OPENCLAW_WORKSPACE || path.join(homeDir, '.openclaw', 'workspace');
50
186
  installPath = path.join(workspace, 'skills');
187
+ console.log(chalk.gray(` 安装路径:${installPath}`));
51
188
  } else if (type === 'apps') {
52
189
  if (options.global) {
53
- installPath = path.join(process.env.APPDATA || path.join(process.env.HOME || '', '.local'), 'tolingcode', 'apps');
190
+ const homeDir = process.env.HOME || process.env.USERPROFILE || require('os').homedir();
191
+ // Cross-platform: Windows uses APPDATA, Linux/Mac uses ~/.local
192
+ installPath = process.env.APPDATA
193
+ ? path.join(process.env.APPDATA, 'tolingcode', 'apps') // Windows
194
+ : path.join(homeDir, '.local', 'tolingcode', 'apps'); // Linux/Mac
54
195
  } else {
55
196
  installPath = path.join(process.cwd(), 'tolingcode-apps');
56
197
  }
@@ -114,7 +255,7 @@ program
114
255
  // list command - list available skills/apps
115
256
  program
116
257
  .command('list [type]')
117
- .description('List available skills or apps')
258
+ .description('列出可用的技能或应用 (skills | apps | all)')
118
259
  .action(async (type) => {
119
260
  console.log(chalk.blue('\n📦 Available packages:\n'));
120
261
 
@@ -160,7 +301,7 @@ program
160
301
  // search command
161
302
  program
162
303
  .command('search <query>')
163
- .description('Search for skills or apps')
304
+ .description('搜索技能或应用')
164
305
  .action(async (query) => {
165
306
  console.log(chalk.blue(`\n🔍 Searching for: ${query}\n`));
166
307
 
@@ -189,10 +330,10 @@ program
189
330
  // publish command - for publishing skills/apps to registry
190
331
  program
191
332
  .command('publish <path>')
192
- .description('Publish a skill or app to the registry')
193
- .option('--type <type>', 'Package type (skills or apps)', 'skills')
194
- .option('--name <name>', 'Package name')
195
- .option('--version <version>', 'Package version')
333
+ .description('发布技能或应用到 registry')
334
+ .option('--type <type>', '包类型 (skills apps)', 'skills')
335
+ .option('--name <name>', '包名称')
336
+ .option('--version <version>', '包版本号')
196
337
  .action(async (pkgPath, options) => {
197
338
  const absPath = path.resolve(pkgPath);
198
339
 
@@ -228,4 +369,42 @@ program
228
369
  console.log(chalk.gray(' See: docs/PUBLISH.md for details'));
229
370
  });
230
371
 
372
+ // examples command
373
+ program
374
+ .command('examples')
375
+ .description('显示使用示例')
376
+ .action(() => {
377
+ console.log(`
378
+ ${chalk.bold('常用命令示例:')}
379
+
380
+ ${chalk.green('1. 安装技能')}
381
+ $ tolingcode install skills gigacloud-warehouse
382
+ $ tolingcode install skills order-fulfillment
383
+ $ tolingcode install skills weather -v 2026.3.8
384
+
385
+ ${chalk.green('2. 列出技能')}
386
+ $ tolingcode list skills
387
+ $ tolingcode list apps
388
+ $ tolingcode list
389
+
390
+ ${chalk.green('3. 搜索技能')}
391
+ $ tolingcode search 电商
392
+ $ tolingcode search gigacloud
393
+ $ tolingcode search order
394
+
395
+ ${chalk.green('4. 发布技能')}
396
+ $ tolingcode publish ./skills/gigacloud-warehouse --type skills --name gigacloud-warehouse --version 2026.3.8
397
+
398
+ ${chalk.green('5. 查看帮助')}
399
+ $ tolingcode --help
400
+ $ tolingcode install --help
401
+ $ tolingcode search --help
402
+
403
+ ${chalk.green('6. 查看版本')}
404
+ $ tolingcode -v
405
+ $ tolingcode --version
406
+ `);
407
+ });
408
+
231
409
  program.parse();
410
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tolingcode",
3
- "version": "2026.03.816",
4
- "description": "TolingCode CLI - Install skills and apps from toling.me",
3
+ "version": "2026.3.818",
4
+ "description": "TolingCode CLI - 跨境电商 AI 助手技能管理工具 (基于 OpenClaw)",
5
5
  "main": "bin/tolingcode.js",
6
6
  "files": [
7
7
  "bin",
@@ -21,10 +21,13 @@
21
21
  "author": "TolingCode",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "commander": "^11.0.0",
24
+ "axios": "^1.6.0",
25
25
  "chalk": "^4.1.2",
26
+ "commander": "^11.0.0",
27
+ "cors": "^2.8.6",
28
+ "express": "^5.2.1",
29
+ "multer": "^2.1.1",
26
30
  "ora": "^5.4.1",
27
- "axios": "^1.6.0",
28
31
  "tar": "^6.2.0"
29
32
  },
30
33
  "engines": {