openclaw-weiyuan-init 1.0.0 → 1.0.5
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 +35 -8
- package/bin/cli.js +7 -2
- package/lib/commands.js +66 -13
- package/lib/downloader.js +31 -1
- package/package.json +9 -11
- package/lib/package.json +0 -49
- package/templates/.weiyuan.template +0 -10
- package/workspace-weiyuan/.weiyuan +0 -10
- package/workspace-weiyuan/weiyuan/README.md +0 -159
- package/workspace-weiyuan/weiyuan/examples/action-task-list.json +0 -6
- package/workspace-weiyuan/weiyuan/examples/risk-report.json +0 -8
- package/workspace-weiyuan/weiyuan/examples/text-what-can-i-do.json +0 -6
- package/workspace-weiyuan/weiyuan/manifest.json +0 -45
- package/workspace-weiyuan/weiyuan/schema.json +0 -104
- package/workspace-weiyuan/weiyuan/src/cli.ts +0 -453
- package/workspace-weiyuan/weiyuan/src/cliMain.ts +0 -7
- package/workspace-weiyuan/weiyuan/src/crypto.ts +0 -14
- package/workspace-weiyuan/weiyuan/src/http.ts +0 -45
- package/workspace-weiyuan/weiyuan/src/signing.ts +0 -38
- package/workspace-weiyuan/weiyuan/src/skillAdapter.ts +0 -173
- package/workspace-weiyuan/weiyuan/src/types.ts +0 -10
- package/workspace-weiyuan/weiyuan/src/weiyuanFile.ts +0 -25
package/README.md
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
|
-
# @weiyuan/openclaw-weiyuan-init
|
|
2
|
-
|
|
3
|
-
OpenClaw Weiyuan Skill 一键初始化工具
|
|
4
|
-
|
|
5
|
-
## 一键部署
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npx -y @weiyuan/openclaw-weiyuan-init@latest init
|
|
1
|
+
# @weiyuan/openclaw-weiyuan-init
|
|
2
|
+
|
|
3
|
+
OpenClaw Weiyuan Skill 一键初始化工具
|
|
4
|
+
|
|
5
|
+
## 一键部署
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @weiyuan/openclaw-weiyuan-init@latest init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 版本化 zip 自动识别
|
|
12
|
+
|
|
13
|
+
- 默认读取 `<upgradeBaseUrl>/LATEST_SKILL_VERSION.txt`
|
|
14
|
+
- 自动下载 `weiyuan-openclaw-skill-v<version>.zip`
|
|
15
|
+
- 当 zip 文件名随版本变化时无需改命令
|
|
16
|
+
|
|
17
|
+
## 常用参数
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx -y @weiyuan/openclaw-weiyuan-init@latest init --upgrade <upgradeBaseUrl> --server <serverUrl>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
邀请码一键入组(推荐):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx -y @weiyuan/openclaw-weiyuan-init@latest init --invite <inviteToken>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`inviteToken` 包含 `server/upgrade/project/code`,会自动完成安装与入组。
|
|
30
|
+
|
|
31
|
+
如需指定固定 zip,可覆盖自动识别:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx -y @weiyuan/openclaw-weiyuan-init@latest init --download <zipUrl> --server <serverUrl>
|
|
35
|
+
```
|
package/bin/cli.js
CHANGED
|
@@ -14,7 +14,11 @@ program
|
|
|
14
14
|
.description('初始化 weiyuan skill')
|
|
15
15
|
.option('-w, --workspace <path>', '指定工作目录', 'workspace-weiyuan')
|
|
16
16
|
.option('-s, --server <url>', '指定服务器地址', 'http://121.43.119.190:8787')
|
|
17
|
-
.option('-
|
|
17
|
+
.option('-u, --upgrade <url>', '指定升级源地址(含 LATEST_SKILL_VERSION.txt)', 'http://121.43.119.190:8788')
|
|
18
|
+
.option('-d, --download <url>', '指定下载地址(可覆盖自动版本解析)')
|
|
19
|
+
.option('-i, --invite <token>', '邀请码令牌(包含 server/upgrade/project/code)')
|
|
20
|
+
.option('-p, --project <id>', '邀请加入的项目 ID')
|
|
21
|
+
.option('-c, --code <code>', '邀请口令')
|
|
18
22
|
.option('-f, --force', '强制覆盖已有文件')
|
|
19
23
|
.action(async (options) => {
|
|
20
24
|
try {
|
|
@@ -42,6 +46,7 @@ program
|
|
|
42
46
|
.command('status')
|
|
43
47
|
.description('查看 weiyuan 状态')
|
|
44
48
|
.option('-w, --workspace <path>', '指定工作目录', 'workspace-weiyuan')
|
|
49
|
+
.option('-s, --server <url>', '指定服务器地址', 'http://121.43.119.190:8787')
|
|
45
50
|
.action(async (options) => {
|
|
46
51
|
try {
|
|
47
52
|
await runStatus(options);
|
|
@@ -51,4 +56,4 @@ program
|
|
|
51
56
|
}
|
|
52
57
|
});
|
|
53
58
|
|
|
54
|
-
program.parse();
|
|
59
|
+
program.parse();
|
package/lib/commands.js
CHANGED
|
@@ -2,26 +2,59 @@ const chalk = require('chalk');
|
|
|
2
2
|
const ora = require('ora');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const fs = require('fs-extra');
|
|
5
|
-
const {
|
|
5
|
+
const { execFile } = require('child_process');
|
|
6
|
+
const { promisify } = require('util');
|
|
7
|
+
const { downloadFile, resolvePackageSource } = require('./downloader');
|
|
6
8
|
const { extractZip } = require('./extractor');
|
|
7
9
|
const { createIdentityFile } = require('./identity');
|
|
8
10
|
const { checkServer, initSkill } = require('./server');
|
|
9
11
|
const { printBanner, printSummary, listDirectory } = require('./utils');
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
10
13
|
|
|
11
14
|
const DEFAULT_CONFIG = {
|
|
12
15
|
workspaceName: 'workspace-weiyuan',
|
|
13
|
-
|
|
16
|
+
upgradeBaseUrl: 'http://121.43.119.190:8788',
|
|
17
|
+
downloadUrl: '',
|
|
14
18
|
serverUrl: 'http://121.43.119.190:8787',
|
|
15
|
-
zipFilename: 'weiyuan-openclaw-skill-v0.1.1.zip',
|
|
16
19
|
identityFile: '.weiyuan'
|
|
17
20
|
};
|
|
21
|
+
|
|
22
|
+
function decodeInviteToken(token) {
|
|
23
|
+
if (!token || typeof token !== 'string') return null;
|
|
24
|
+
try {
|
|
25
|
+
const normalized = token.replace(/-/g, '+').replace(/_/g, '/');
|
|
26
|
+
const pad = normalized.length % 4 === 0 ? '' : '='.repeat(4 - (normalized.length % 4));
|
|
27
|
+
const raw = Buffer.from(normalized + pad, 'base64').toString('utf8');
|
|
28
|
+
const parsed = JSON.parse(raw);
|
|
29
|
+
if (!parsed || parsed.v !== 1) return null;
|
|
30
|
+
if (!parsed.api || !parsed.upgrade || !parsed.projectId || !parsed.code) return null;
|
|
31
|
+
return parsed;
|
|
32
|
+
} catch (_) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function runJoin(weiyuanPath, identityPath, projectId, code) {
|
|
38
|
+
await execFileAsync('npm', ['--prefix', weiyuanPath, 'run', 'weiyuan', '--', 'join', '--identity', identityPath, '--project', projectId, '--code', code], {
|
|
39
|
+
cwd: weiyuanPath
|
|
40
|
+
});
|
|
41
|
+
}
|
|
18
42
|
|
|
19
43
|
async function runInit(options) {
|
|
20
44
|
printBanner();
|
|
45
|
+
|
|
46
|
+
const invite = decodeInviteToken(options.invite);
|
|
47
|
+
if (invite) {
|
|
48
|
+
options.server = options.server || invite.api;
|
|
49
|
+
options.upgrade = options.upgrade || invite.upgrade;
|
|
50
|
+
options.project = options.project || invite.projectId;
|
|
51
|
+
options.code = options.code || invite.code;
|
|
52
|
+
}
|
|
21
53
|
|
|
22
54
|
const workspacePath = path.join(process.cwd(), options.workspace);
|
|
23
55
|
const weiyuanPath = path.join(workspacePath, 'weiyuan');
|
|
24
|
-
const
|
|
56
|
+
const upgradeBaseUrl = options.upgrade || DEFAULT_CONFIG.upgradeBaseUrl;
|
|
57
|
+
const requestedDownloadUrl = options.download || DEFAULT_CONFIG.downloadUrl;
|
|
25
58
|
const serverUrl = options.server || DEFAULT_CONFIG.serverUrl;
|
|
26
59
|
const force = options.force || false;
|
|
27
60
|
|
|
@@ -52,14 +85,22 @@ async function runInit(options) {
|
|
|
52
85
|
}
|
|
53
86
|
|
|
54
87
|
// 3. 下载文件
|
|
55
|
-
spinner = ora('
|
|
56
|
-
const
|
|
57
|
-
|
|
88
|
+
spinner = ora('解析下载包...').start();
|
|
89
|
+
const source = await resolvePackageSource({
|
|
90
|
+
downloadUrl: requestedDownloadUrl,
|
|
91
|
+
upgradeBaseUrl,
|
|
92
|
+
spinner
|
|
93
|
+
});
|
|
94
|
+
spinner.succeed(`下载源: ${source.downloadUrl}`);
|
|
95
|
+
|
|
96
|
+
spinner = ora('下载 weiyuan skill...').start();
|
|
97
|
+
const zipPath = path.join(weiyuanPath, source.zipFilename);
|
|
98
|
+
const downloadSuccess = await downloadFile(source.downloadUrl, zipPath, spinner);
|
|
58
99
|
if (!downloadSuccess) {
|
|
59
100
|
spinner.fail('下载失败');
|
|
60
101
|
throw new Error('下载失败');
|
|
61
102
|
}
|
|
62
|
-
spinner.succeed(
|
|
103
|
+
spinner.succeed(`下载完成: ${source.zipFilename}`);
|
|
63
104
|
|
|
64
105
|
// 4. 解压
|
|
65
106
|
spinner = ora('解压文件...').start();
|
|
@@ -101,9 +142,20 @@ async function runInit(options) {
|
|
|
101
142
|
} else {
|
|
102
143
|
spinner.warn('初始化端点不存在,请手动调用');
|
|
103
144
|
}
|
|
145
|
+
|
|
146
|
+
if (options.project && options.code) {
|
|
147
|
+
spinner = ora('自动加入微元项目...').start();
|
|
148
|
+
try {
|
|
149
|
+
await runJoin(weiyuanPath, identityPath, options.project, options.code);
|
|
150
|
+
spinner.succeed(`已加入项目: ${options.project}`);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
spinner.fail(`自动入组失败: ${error.message}`);
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
104
156
|
|
|
105
157
|
// 打印总结
|
|
106
|
-
printSummary(workspacePath, serverUrl, downloadUrl);
|
|
158
|
+
printSummary(workspacePath, serverUrl, source.downloadUrl);
|
|
107
159
|
}
|
|
108
160
|
|
|
109
161
|
async function runClean(options) {
|
|
@@ -159,14 +211,15 @@ async function runStatus(options) {
|
|
|
159
211
|
}
|
|
160
212
|
|
|
161
213
|
// 检查服务器
|
|
162
|
-
const
|
|
214
|
+
const serverUrl = options.server || DEFAULT_CONFIG.serverUrl;
|
|
215
|
+
const serverOk = await checkServer(serverUrl);
|
|
163
216
|
if (serverOk) {
|
|
164
|
-
console.log(chalk.green(`✅ 服务器: ${
|
|
217
|
+
console.log(chalk.green(`✅ 服务器: ${serverUrl}`));
|
|
165
218
|
} else {
|
|
166
|
-
console.log(chalk.red(`❌ 服务器不可达: ${
|
|
219
|
+
console.log(chalk.red(`❌ 服务器不可达: ${serverUrl}`));
|
|
167
220
|
}
|
|
168
221
|
|
|
169
222
|
console.log('');
|
|
170
223
|
}
|
|
171
224
|
|
|
172
|
-
module.exports = { runInit, runClean, runStatus, DEFAULT_CONFIG };
|
|
225
|
+
module.exports = { runInit, runClean, runStatus, DEFAULT_CONFIG };
|
package/lib/downloader.js
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
|
|
4
|
+
function trimSlash(url) {
|
|
5
|
+
return String(url || '').replace(/\/+$/, '');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function toZipFilename(downloadUrl) {
|
|
9
|
+
const clean = String(downloadUrl || '').split('?')[0].split('#')[0];
|
|
10
|
+
const parts = clean.split('/');
|
|
11
|
+
return parts[parts.length - 1] || 'weiyuan-openclaw-skill.zip';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function resolvePackageSource({ downloadUrl, upgradeBaseUrl, spinner = null }) {
|
|
15
|
+
if (downloadUrl) {
|
|
16
|
+
return { downloadUrl, zipFilename: toZipFilename(downloadUrl), version: null, from: 'download_url' };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const base = trimSlash(upgradeBaseUrl);
|
|
20
|
+
const latestUrl = `${base}/LATEST_SKILL_VERSION.txt`;
|
|
21
|
+
const latestResp = await axios.get(latestUrl, { timeout: 10000 });
|
|
22
|
+
const version = String(latestResp.data || '').trim();
|
|
23
|
+
if (!version) {
|
|
24
|
+
throw new Error('empty_latest_version');
|
|
25
|
+
}
|
|
26
|
+
const zipFilename = `weiyuan-openclaw-skill-v${version}.zip`;
|
|
27
|
+
const resolvedDownloadUrl = `${base}/${zipFilename}`;
|
|
28
|
+
if (spinner) {
|
|
29
|
+
spinner.text = `已解析最新版本: v${version}`;
|
|
30
|
+
}
|
|
31
|
+
return { downloadUrl: resolvedDownloadUrl, zipFilename, version, from: 'latest_version' };
|
|
32
|
+
}
|
|
33
|
+
|
|
4
34
|
async function downloadFile(url, outputPath, spinner = null) {
|
|
5
35
|
try {
|
|
6
36
|
const response = await axios({
|
|
@@ -40,4 +70,4 @@ async function downloadFile(url, outputPath, spinner = null) {
|
|
|
40
70
|
}
|
|
41
71
|
}
|
|
42
72
|
|
|
43
|
-
module.exports = { downloadFile };
|
|
73
|
+
module.exports = { downloadFile, resolvePackageSource };
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-weiyuan-init",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "OpenClaw Weiyuan Skill 一键初始化工具",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"openclaw-weiyuan-init": "
|
|
7
|
+
"openclaw-weiyuan-init": "bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"start": "node bin/cli.js init"
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
"start": "node bin/cli.js init"
|
|
12
11
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"lib/",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"axios": "^1.6.0",
|
|
18
19
|
"adm-zip": "^0.5.10",
|
|
@@ -21,10 +22,7 @@
|
|
|
21
22
|
"fs-extra": "^11.1.1",
|
|
22
23
|
"ora": "^5.4.1"
|
|
23
24
|
},
|
|
24
|
-
"engines": {
|
|
25
|
-
"node": ">=14.0.0"
|
|
26
|
-
},
|
|
27
25
|
"publishConfig": {
|
|
28
26
|
"access": "public"
|
|
29
27
|
}
|
|
30
|
-
}
|
|
28
|
+
}
|
package/lib/package.json
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@weiyuan/openclaw-weiyuan-init",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "OpenClaw Weiyuan Skill 一键初始化工具 - 自动下载、解压、配置身份文件",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"openclaw-weiyuan-init": "./bin/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"start": "node bin/cli.js init",
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"openclaw",
|
|
15
|
-
"weiyuan",
|
|
16
|
-
"skill",
|
|
17
|
-
"init",
|
|
18
|
-
"cli",
|
|
19
|
-
"one-click",
|
|
20
|
-
"deploy"
|
|
21
|
-
],
|
|
22
|
-
"author": "Weiyuan",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"repository": {
|
|
25
|
-
"type": "git",
|
|
26
|
-
"url": "https://github.com/weiyuan/openclaw-weiyuan-init.git"
|
|
27
|
-
},
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=14.0.0"
|
|
30
|
-
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"axios": "^1.6.0",
|
|
33
|
-
"adm-zip": "^0.5.10",
|
|
34
|
-
"chalk": "^4.1.2",
|
|
35
|
-
"commander": "^11.1.0",
|
|
36
|
-
"fs-extra": "^11.1.1",
|
|
37
|
-
"ora": "^5.4.1"
|
|
38
|
-
},
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"files": [
|
|
43
|
-
"bin/",
|
|
44
|
-
"lib/",
|
|
45
|
-
"templates/",
|
|
46
|
-
"index.js",
|
|
47
|
-
"README.md"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "1.0",
|
|
3
|
-
"device_id": "ZHAOTY",
|
|
4
|
-
"device_name": "ZHAOTY",
|
|
5
|
-
"created_at": "2026-03-28T14:27:13.667Z",
|
|
6
|
-
"server_url": "http://121.43.119.190:8787",
|
|
7
|
-
"workspace": "C:\\pythonProject1\\openclaw-weiyuan-init\\workspace-weiyuan",
|
|
8
|
-
"skill_path": "C:\\pythonProject1\\openclaw-weiyuan-init\\workspace-weiyuan/weiyuan",
|
|
9
|
-
"note": "请根据实际情况修改此文件"
|
|
10
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
# 龙虾端 weiyuan CLI(MVP)
|
|
2
|
-
|
|
3
|
-
本目录提供一个最小可用的龙虾端 CLI,用于与微元云服务进行签名通信(Ed25519)。
|
|
4
|
-
|
|
5
|
-
## 快速开始
|
|
6
|
-
|
|
7
|
-
前置:微元云服务已启动(默认 `http://127.0.0.1:8787`)。
|
|
8
|
-
|
|
9
|
-
初始化身份(生成本地 `.weiyuan`):
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm run weiyuan -- init --server http://127.0.0.1:8787 --out .weiyuan
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
创建项目(DNA 原文在本地输入,云端只存 dnaHash):
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run weiyuan -- create --name "Demo" --goal "MVP" --dna "稳当第一"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
生成邀请口令(发起人执行):
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm run weiyuan -- invite --project <projectId> --role member
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
加入项目(成员执行):
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm run weiyuan -- join --project <projectId> --code <inviteCode>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
成员列表:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm run weiyuan -- member list --project <projectId>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
任务流转:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm run weiyuan -- task create --project <projectId> --title "工具清点" --desc "检查工具"
|
|
43
|
-
npm run weiyuan -- task list --project <projectId>
|
|
44
|
-
npm run weiyuan -- task take --project <projectId> --task <taskId>
|
|
45
|
-
npm run weiyuan -- task submit --project <projectId> --task <taskId> --hash <contentHash> --type text/markdown
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
状态体检与事件同步:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm run weiyuan -- status --project <projectId>
|
|
52
|
-
npm run weiyuan -- sync --project <projectId>
|
|
53
|
-
npm run weiyuan -- sync --project <projectId> --follow --interval 2000
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
风险上报与查询:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm run weiyuan -- risk report --project <projectId> --severity warn --summary "3号库信号不稳"
|
|
60
|
-
npm run weiyuan -- risk list --project <projectId>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
进化胶囊:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npm run weiyuan -- capsule publish --name "Skill_Pump_Repair_V1" --kind industry --file ./capsule.bin --version v1 --dnaTags 维修,稳当第一
|
|
67
|
-
npm run weiyuan -- capsule search --query 维修
|
|
68
|
-
npm run weiyuan -- capsule pull --id <capsuleId> --out ./downloaded-capsule.bin
|
|
69
|
-
npm run weiyuan -- capsule report --id <capsuleId> --success true
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## 身份文件
|
|
73
|
-
|
|
74
|
-
默认身份文件:当前目录的 `.weiyuan`(JSON)。
|
|
75
|
-
|
|
76
|
-
## 说明
|
|
77
|
-
|
|
78
|
-
- 这是 MVP 级 CLI:聚焦可跑通闭环与协议对齐;后续可升级为 OpenClaw skill 形态。
|
|
79
|
-
- 协议与鉴权细则见:[server/PROTOCOL.md](file:///c:/Users/10123/Documents/trae_projects/sky/server/PROTOCOL.md)
|
|
80
|
-
|
|
81
|
-
## OpenClaw Skill 适配入口(MVP)
|
|
82
|
-
|
|
83
|
-
适配器命令:`npm run weiyuan:skill`
|
|
84
|
-
|
|
85
|
-
输入为 JSON(stdin),支持两种模式:
|
|
86
|
-
|
|
87
|
-
1) `action` 模式(结构化)
|
|
88
|
-
2) `text` 模式(口语意图映射)
|
|
89
|
-
|
|
90
|
-
输入/输出 schema 见:`client/skill/schema.json`
|
|
91
|
-
|
|
92
|
-
示例(action):
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
'{"action":"task.list","identity":".weiyuan.dev2","projectId":"prj_xxx"}' | npm run weiyuan:skill
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
示例(text):
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
'{"text":"我能做什么","identity":".weiyuan.dev2","projectId":"prj_xxx"}' | npm run weiyuan:skill
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
输出格式:
|
|
105
|
-
|
|
106
|
-
- 成功:`{"ok": true, "data": ...}`
|
|
107
|
-
- 失败:`{"ok": false, "errorCode": "...", "message": "...", "rawError": "..."}`
|
|
108
|
-
|
|
109
|
-
## 生成 Skill 包
|
|
110
|
-
|
|
111
|
-
构建命令:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
npm run weiyuan:skill:build
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
输出目录:`dist/skill-package`
|
|
118
|
-
|
|
119
|
-
该目录包含:
|
|
120
|
-
|
|
121
|
-
- `manifest.json`
|
|
122
|
-
- `schema.json`
|
|
123
|
-
- `examples/*.json`
|
|
124
|
-
- 适配器与 CLI 源码(用于 OpenClaw 侧加载或二次封装)
|
|
125
|
-
|
|
126
|
-
## 版本与发布
|
|
127
|
-
|
|
128
|
-
版本递增(patch/minor/major):
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
npm run weiyuan:skill:version -- patch
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
发布前校验门(manifest/schema/examples/adapter 契约):
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
npm run weiyuan:skill:validate
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
一键发布(构建 + zip + 发布说明):
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
npm run weiyuan:skill:release
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
说明:`weiyuan:skill:release` 会先执行校验门,未通过则阻断发布。
|
|
147
|
-
|
|
148
|
-
发布产物:
|
|
149
|
-
|
|
150
|
-
- `dist/releases/weiyuan-openclaw-skill-v<version>.zip`
|
|
151
|
-
- `dist/releases/RELEASE_NOTES_<version>.md`
|
|
152
|
-
|
|
153
|
-
## CI 工作流
|
|
154
|
-
|
|
155
|
-
- `skill-ci`:push/PR 自动执行 `weiyuan:skill:validate` 与 `weiyuan:skill:build`
|
|
156
|
-
- `skill-release`:手动触发,支持 patch/minor/major 递增后自动执行:
|
|
157
|
-
- 版本递增并提交 `manifest.json`
|
|
158
|
-
- 创建并推送 git tag(`v<version>`)
|
|
159
|
-
- 生成 GitHub Release 并上传 zip/release notes
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "weiyuan-openclaw-skill",
|
|
3
|
-
"displayName": "微元协作 Skill",
|
|
4
|
-
"version": "0.1.1",
|
|
5
|
-
"description": "通过结构化 action 或自然语言 text 调用微元云服务。",
|
|
6
|
-
"entry": {
|
|
7
|
-
"type": "command",
|
|
8
|
-
"command": "npm run weiyuan:skill"
|
|
9
|
-
},
|
|
10
|
-
"ioSchema": "./schema.json",
|
|
11
|
-
"capabilities": {
|
|
12
|
-
"modes": [
|
|
13
|
-
"action",
|
|
14
|
-
"text"
|
|
15
|
-
],
|
|
16
|
-
"actions": [
|
|
17
|
-
"init",
|
|
18
|
-
"create",
|
|
19
|
-
"join",
|
|
20
|
-
"task.list",
|
|
21
|
-
"task.take",
|
|
22
|
-
"task.submit",
|
|
23
|
-
"status",
|
|
24
|
-
"risk.report",
|
|
25
|
-
"capsule.search"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"examples": [
|
|
29
|
-
"./examples/action-task-list.json",
|
|
30
|
-
"./examples/text-what-can-i-do.json",
|
|
31
|
-
"./examples/risk-report.json"
|
|
32
|
-
],
|
|
33
|
-
"output": {
|
|
34
|
-
"success": {
|
|
35
|
-
"ok": true,
|
|
36
|
-
"data": {}
|
|
37
|
-
},
|
|
38
|
-
"error": {
|
|
39
|
-
"ok": false,
|
|
40
|
-
"errorCode": "UNKNOWN_ACTION",
|
|
41
|
-
"message": "",
|
|
42
|
-
"rawError": ""
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|