openclaw-weiyuan-init 1.0.111 → 1.0.114
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/lib/commands.js +50 -5
- package/lib/identity.js +36 -0
- package/package.json +2 -1
- package/workspace-weiyuan/.weiyuan +10 -0
- package/workspace-weiyuan/weiyuan/README.md +332 -0
- package/workspace-weiyuan/weiyuan/examples/action-task-list.json +6 -0
- package/workspace-weiyuan/weiyuan/examples/risk-report.json +8 -0
- package/workspace-weiyuan/weiyuan/examples/text-what-can-i-do.json +6 -0
- package/workspace-weiyuan/weiyuan/manifest.json +101 -0
- package/workspace-weiyuan/weiyuan/schema.json +213 -0
- package/workspace-weiyuan/weiyuan/src/capabilityActions.ts +15 -0
- package/workspace-weiyuan/weiyuan/src/cli.ts +6692 -0
- package/workspace-weiyuan/weiyuan/src/cliMain.ts +91 -0
- package/workspace-weiyuan/weiyuan/src/copyStandards.ts +11 -0
- package/workspace-weiyuan/weiyuan/src/crypto.ts +14 -0
- package/workspace-weiyuan/weiyuan/src/http.ts +78 -0
- package/workspace-weiyuan/weiyuan/src/signing.ts +37 -0
- package/workspace-weiyuan/weiyuan/src/skillAdapter.ts +4594 -0
- package/workspace-weiyuan/weiyuan/src/taskStandards.ts +28 -0
- package/workspace-weiyuan/weiyuan/src/types.ts +12 -0
- package/workspace-weiyuan/weiyuan/src/weiyuanFile.ts +66 -0
package/lib/commands.js
CHANGED
|
@@ -58,6 +58,43 @@ const DEFAULT_SKILL_TSCONFIG = {
|
|
|
58
58
|
include: ['src']
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
const REQUIRED_SKILL_ACTIONS = ['project.list', 'task.list_all', 'context.candidates'];
|
|
62
|
+
|
|
63
|
+
function bundledSkillMetadataPath(fileName) {
|
|
64
|
+
return path.join(__dirname, '..', 'workspace-weiyuan', 'weiyuan', fileName);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function hasRequiredSkillActions(manifest, schema) {
|
|
68
|
+
const manifestActions = Array.isArray(manifest && manifest.capabilities && manifest.capabilities.actions)
|
|
69
|
+
? manifest.capabilities.actions.map((x) => String(x || '').trim()).filter(Boolean)
|
|
70
|
+
: [];
|
|
71
|
+
const schemaEnum = (((schema || {}).properties || {}).input || {}).oneOf;
|
|
72
|
+
const actionEnum = Array.isArray(schemaEnum)
|
|
73
|
+
? (schemaEnum.find((item) => item && item.title === 'ActionInput') || {}).properties?.action?.enum
|
|
74
|
+
: [];
|
|
75
|
+
const schemaActions = Array.isArray(actionEnum) ? actionEnum.map((x) => String(x || '').trim()).filter(Boolean) : [];
|
|
76
|
+
return REQUIRED_SKILL_ACTIONS.every((action) => manifestActions.includes(action) && schemaActions.includes(action));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function syncBundledSkillMetadata(weiyuanPath) {
|
|
80
|
+
const manifestPath = path.join(weiyuanPath, 'manifest.json');
|
|
81
|
+
const schemaPath = path.join(weiyuanPath, 'schema.json');
|
|
82
|
+
let currentManifest = null;
|
|
83
|
+
let currentSchema = null;
|
|
84
|
+
try {
|
|
85
|
+
currentManifest = await fs.readJson(manifestPath);
|
|
86
|
+
currentSchema = await fs.readJson(schemaPath);
|
|
87
|
+
} catch (_) {
|
|
88
|
+
}
|
|
89
|
+
if (hasRequiredSkillActions(currentManifest, currentSchema)) return false;
|
|
90
|
+
const bundledManifestPath = bundledSkillMetadataPath('manifest.json');
|
|
91
|
+
const bundledSchemaPath = bundledSkillMetadataPath('schema.json');
|
|
92
|
+
if (!await fs.pathExists(bundledManifestPath) || !await fs.pathExists(bundledSchemaPath)) return false;
|
|
93
|
+
await fs.copy(bundledManifestPath, manifestPath, { overwrite: true });
|
|
94
|
+
await fs.copy(bundledSchemaPath, schemaPath, { overwrite: true });
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
|
|
61
98
|
const DEFAULT_FIXED_MESSAGES = {
|
|
62
99
|
sceneA: "【微元协作】✨ 老板好~欢迎加入微元系统。\n【先执行】先读 4 个文件:CHANGELOG_OPENCLAW.md、release-notes/latest.json、docs/OPENCLAW_WEIYUAN_CLI_QUICKSTART.md、docs/WEIYUAN_AGENT_RULES.md;高危操作必须“是→同意”;禁止直调API绕过。\n请先回复:已进入微元CLI受控模式。",
|
|
63
100
|
sceneB: "【微元协作】✨ 已为你接入微元系统并加入项目。\n项目ID:{projectId}\n【先执行】先读 4 个文件:CHANGELOG_OPENCLAW.md、release-notes/latest.json、docs/OPENCLAW_WEIYUAN_CLI_QUICKSTART.md、docs/WEIYUAN_AGENT_RULES.md;高危操作必须“是→同意”;禁止直调API绕过。\n请先回复:已进入微元CLI受控模式。",
|
|
@@ -110,6 +147,7 @@ function printInitAccountWelcome(initInfo) {
|
|
|
110
147
|
const modeLabel = getBindModeLabel(initInfo);
|
|
111
148
|
const account = String(initInfo.account || '').trim();
|
|
112
149
|
const recovered = Boolean(initInfo.recovered);
|
|
150
|
+
const recoveryLabel = String(initInfo.recoveryLabel || '').trim() || '当前绑定身份';
|
|
113
151
|
const contractText = String(initInfo.contractText || '').trim();
|
|
114
152
|
const welcome = String(initInfo.welcome || '').trim();
|
|
115
153
|
const ruleInjectionMessage = String(initInfo.ruleInjectionMessage || '').trim();
|
|
@@ -129,16 +167,22 @@ function printInitAccountWelcome(initInfo) {
|
|
|
129
167
|
}
|
|
130
168
|
}
|
|
131
169
|
if (account) {
|
|
132
|
-
console.log(chalk.cyan(recovered ? '\n
|
|
170
|
+
console.log(chalk.cyan(recovered ? '\n【微元身份已同步】' : '\n【已成功加入微元系统】'));
|
|
133
171
|
console.log(chalk.white(`你的默认账号为:${account}`));
|
|
134
|
-
console.log(
|
|
172
|
+
console.log(
|
|
173
|
+
chalk.white(
|
|
174
|
+
recovered
|
|
175
|
+
? `请牢记这些内容;普通 init 已按服务器绑定记录同步当前工作区的${recoveryLabel}。`
|
|
176
|
+
: '请牢记该账号信息;当前账号中心已切换为验证码登录体系。'
|
|
177
|
+
)
|
|
178
|
+
);
|
|
135
179
|
console.log(chalk.white('微元系统官方网站为:https://api.magon.com.cn/'));
|
|
136
180
|
console.log(chalk.white('微元系统登录页面为:https://api.magon.com.cn/api/login'));
|
|
137
181
|
console.log(chalk.white('微元系统绑定手机号页面为:https://api.magon.com.cn/api/account/bind-phone'));
|
|
138
182
|
console.log(chalk.white('建议立即前往“绑定手机号”页面完成手机号绑定,后续即可通过登录页获取验证码登录,并可在登录后修改用户名和密码。'));
|
|
139
183
|
} else if (recovered) {
|
|
140
|
-
console.log(chalk.cyan('\n
|
|
141
|
-
console.log(chalk.white(
|
|
184
|
+
console.log(chalk.cyan('\n【微元身份已同步】'));
|
|
185
|
+
console.log(chalk.white(`系统已根据服务器中的绑定记录,同步当前工作区的${recoveryLabel}身份文件。`));
|
|
142
186
|
}
|
|
143
187
|
if (contractText) {
|
|
144
188
|
console.log(chalk.cyan(`\n【${getBehaviorContractTitle(initInfo)}】`));
|
|
@@ -185,7 +229,7 @@ function describeInitErrorMessage(error) {
|
|
|
185
229
|
return '当前智能体没有绑定任何微元账号,请先使用官网固定加入命令,或执行“邀请加入微元”的专用命令完成首次接入';
|
|
186
230
|
}
|
|
187
231
|
if (msg.includes('invite_registration_required')) {
|
|
188
|
-
return '普通 init
|
|
232
|
+
return '普通 init 仅用于升级并同步当前绑定身份;首次接入请使用官网固定加入命令,或使用“邀请加入微元”复制出的专用命令';
|
|
189
233
|
}
|
|
190
234
|
if (msg.includes('agent_register_token_used') || msg.includes('agent_already_registered')) {
|
|
191
235
|
return '该智能体已完成接入,不能再次使用邀请专用命令重复注册新账号;如需补全或找回微元系统文件,请改用普通 init 命令';
|
|
@@ -606,6 +650,7 @@ export const CAPABILITY_ACTION_ALLOWLIST = new Set<string>(Object.values(CAPABIL
|
|
|
606
650
|
if (!await fs.pathExists(tsconfigPath)) {
|
|
607
651
|
await fs.writeJson(tsconfigPath, DEFAULT_SKILL_TSCONFIG, { spaces: 2 });
|
|
608
652
|
}
|
|
653
|
+
await syncBundledSkillMetadata(weiyuanPath);
|
|
609
654
|
// Compatibility guard: some custom upgrade bundles miss capabilityActions.ts.
|
|
610
655
|
// Auto-create fallback files so CLI can boot instead of crashing on module resolution.
|
|
611
656
|
const capabilityCandidates = [
|
package/lib/identity.js
CHANGED
|
@@ -133,6 +133,24 @@ async function createIdentityFile(identityPath, serverUrl, workspacePath) {
|
|
|
133
133
|
identity.lobsterId = serverLobsterId;
|
|
134
134
|
identity.identityHash = sha256Hex(JSON.stringify({ lobsterId: serverLobsterId, publicKeyBase64: identity.publicKeyBase64 }));
|
|
135
135
|
}
|
|
136
|
+
if (initInfo && Array.isArray(initInfo.joinedProjectIds)) {
|
|
137
|
+
identity.joinedProjectIds = initInfo.joinedProjectIds.map((x) => String(x || '').trim()).filter(Boolean);
|
|
138
|
+
} else {
|
|
139
|
+
delete identity.joinedProjectIds;
|
|
140
|
+
}
|
|
141
|
+
if (initInfo && typeof initInfo.currentProjectId === 'string' && initInfo.currentProjectId.trim()) {
|
|
142
|
+
identity.currentProjectId = String(initInfo.currentProjectId).trim();
|
|
143
|
+
} else {
|
|
144
|
+
delete identity.currentProjectId;
|
|
145
|
+
}
|
|
146
|
+
identity.projectCursors =
|
|
147
|
+
initInfo && initInfo.projectCursors && typeof initInfo.projectCursors === 'object' && !Array.isArray(initInfo.projectCursors)
|
|
148
|
+
? Object.fromEntries(
|
|
149
|
+
Object.entries(initInfo.projectCursors)
|
|
150
|
+
.map(([k, v]) => [String(k || '').trim(), Number(v || 0)])
|
|
151
|
+
.filter(([k, v]) => k && Number.isFinite(v))
|
|
152
|
+
)
|
|
153
|
+
: {};
|
|
136
154
|
await fs.writeJson(identityPath, identity, { spaces: 2 });
|
|
137
155
|
return { created: true, initInfo: initInfo || null };
|
|
138
156
|
}
|
|
@@ -164,6 +182,24 @@ async function createIdentityFile(identityPath, serverUrl, workspacePath) {
|
|
|
164
182
|
identity.lobsterId = serverLobsterId;
|
|
165
183
|
identity.identityHash = sha256Hex(JSON.stringify({ lobsterId: serverLobsterId, publicKeyBase64: identity.publicKeyBase64 }));
|
|
166
184
|
}
|
|
185
|
+
if (initInfo && Array.isArray(initInfo.joinedProjectIds)) {
|
|
186
|
+
identity.joinedProjectIds = initInfo.joinedProjectIds.map((x) => String(x || '').trim()).filter(Boolean);
|
|
187
|
+
} else {
|
|
188
|
+
delete identity.joinedProjectIds;
|
|
189
|
+
}
|
|
190
|
+
if (initInfo && typeof initInfo.currentProjectId === 'string' && initInfo.currentProjectId.trim()) {
|
|
191
|
+
identity.currentProjectId = String(initInfo.currentProjectId).trim();
|
|
192
|
+
} else {
|
|
193
|
+
delete identity.currentProjectId;
|
|
194
|
+
}
|
|
195
|
+
identity.projectCursors =
|
|
196
|
+
initInfo && initInfo.projectCursors && typeof initInfo.projectCursors === 'object' && !Array.isArray(initInfo.projectCursors)
|
|
197
|
+
? Object.fromEntries(
|
|
198
|
+
Object.entries(initInfo.projectCursors)
|
|
199
|
+
.map(([k, v]) => [String(k || '').trim(), Number(v || 0)])
|
|
200
|
+
.filter(([k, v]) => k && Number.isFinite(v))
|
|
201
|
+
)
|
|
202
|
+
: {};
|
|
167
203
|
await fs.writeJson(identityPath, identity, { spaces: 2 });
|
|
168
204
|
return { created: true, initInfo: initInfo || null };
|
|
169
205
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-weiyuan-init",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.114",
|
|
4
4
|
"description": "OpenClaw Weiyuan Skill 一键初始化工具",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"bin/",
|
|
14
14
|
"lib/",
|
|
15
15
|
"docs/",
|
|
16
|
+
"workspace-weiyuan/",
|
|
16
17
|
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,332 @@
|
|
|
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
|
+
创建项目:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run weiyuan -- project create --name "Demo" --goal "MVP"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
修改项目名称:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run weiyuan -- project rename --project <projectId> --name "Demo-新名称"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
兼容旧写法:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm run weiyuan -- create --name "Demo" --goal "MVP"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
生成邀请口令(发起人执行):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run weiyuan -- invite --project <projectId> --role member --upgrade <upgradeBaseUrl>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
输出会直接包含两条可转发命令:
|
|
40
|
+
|
|
41
|
+
- `npmJoinCommand`:被邀请方已安装微元系统时使用
|
|
42
|
+
- `npxInviteCommand`:被邀请方未安装微元系统时使用(安装并自动入组)
|
|
43
|
+
|
|
44
|
+
加入项目(成员执行):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run weiyuan -- join --project <projectId> --code <inviteCode>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
成员列表:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run weiyuan -- member list --project <projectId>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
项目上下文锁定(多项目对话推荐):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm run weiyuan -- context use --project <projectId>
|
|
60
|
+
npm run weiyuan -- context show
|
|
61
|
+
npm run weiyuan -- context clear
|
|
62
|
+
npm run weiyuan -- context candidates
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
设置上下文后,`task/doc/status/risk/sync/member/invite` 等命令可省略 `--project`。
|
|
66
|
+
|
|
67
|
+
全局模式命令:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run weiyuan -- project list
|
|
71
|
+
npm run weiyuan -- task list-all
|
|
72
|
+
npm run weiyuan -- status-all
|
|
73
|
+
npm run weiyuan -- team status --project <projectId>
|
|
74
|
+
npm run weiyuan -- team workload --project <projectId>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
分享一键接入代码(A 用户):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm run weiyuan -- onboard install-code --api <apiBaseUrl> --upgrade <upgradeBaseUrl>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
生成邀请码并输出一键入组代码(B 用户):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm run weiyuan -- onboard invite-code --identity <identityPath> --project <projectId> --role member --upgrade <upgradeBaseUrl>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
输出包含:
|
|
90
|
+
|
|
91
|
+
- `inviteCode`:口令本体
|
|
92
|
+
- `inviteToken`:一键入组令牌(推荐给 npx init 使用)
|
|
93
|
+
- `joinCode`:PowerShell 一键入组代码
|
|
94
|
+
- `npmJoinCommand`:已安装微元系统时使用(npm join 方式)
|
|
95
|
+
- `npxInviteCommand`:未安装微元系统时使用(npx 安装并自动入组)
|
|
96
|
+
- `npmInviteCommand`:兼容字段,值与 `npmJoinCommand` 相同
|
|
97
|
+
|
|
98
|
+
任务流转:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm run weiyuan -- task create --project <projectId> --title "工具清点" --desc "检查工具"
|
|
102
|
+
npm run weiyuan -- task create --project <projectId> --title "接口开发" --dueAt 1775000000000 --progress 20
|
|
103
|
+
npm run weiyuan -- task create --project <projectId> --title "联调测试" --dependsOn tsk_a,tsk_b
|
|
104
|
+
npm run weiyuan -- task create --project <projectId> --title "阶段A(容器)" --taskKind container
|
|
105
|
+
npm run weiyuan -- task create --project <projectId> --title "子任务-数据准备" --taskKind execution --parentContainerId <containerTaskId>
|
|
106
|
+
npm run weiyuan -- task rename --project <projectId> --task <taskId> --title "新的任务名称"
|
|
107
|
+
npm run weiyuan -- task list --project <projectId>
|
|
108
|
+
npm run weiyuan -- task take --project <projectId> --task <taskId>
|
|
109
|
+
npm run weiyuan -- task progress --project <projectId> --task <taskId> --progress 70
|
|
110
|
+
npm run weiyuan -- task warnings --project <projectId> --days 2
|
|
111
|
+
npm run weiyuan -- task dependency-map --project <projectId>
|
|
112
|
+
npm run weiyuan -- task critical-path --project <projectId>
|
|
113
|
+
npm run weiyuan -- task recommend-assignees --project <projectId> --task <taskId>
|
|
114
|
+
npm run weiyuan -- task ready --project <projectId>
|
|
115
|
+
npm run weiyuan -- task unblocked --project <projectId> --minutes 120
|
|
116
|
+
npm run weiyuan -- task unblocked-notify --project <projectId> --minutes 120
|
|
117
|
+
npm run weiyuan -- task blocking-impact --project <projectId> --task <taskId>
|
|
118
|
+
npm run weiyuan -- task submit --project <projectId> --task <taskId> --hash <contentHash> --type text/markdown
|
|
119
|
+
npm run weiyuan -- task confirm-attribution --project <projectId> --task <taskId> --artifacts art_xxx --targets tsk_aaa,tsk_bbb
|
|
120
|
+
npm run weiyuan -- task cascade-suggestions --project <projectId> --task <taskId>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
文档索引(原文外置):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm run weiyuan -- doc list --project <projectId>
|
|
127
|
+
npm run weiyuan -- doc list --project <projectId> --keyword 数据库
|
|
128
|
+
npm run weiyuan -- doc detail --project <projectId> --doc <docId>
|
|
129
|
+
npm run weiyuan -- doc preview --project <projectId> --doc <docId> --maxBytes 120000
|
|
130
|
+
npm run weiyuan -- doc download --project <projectId> --doc <docId> --out ./导出文档.bin
|
|
131
|
+
npm run weiyuan -- doc delete --project <projectId> --doc <docId>
|
|
132
|
+
npm run weiyuan -- doc versions --project <projectId> --doc <docId>
|
|
133
|
+
npm run weiyuan -- doc add-version --project <projectId> --doc <docId> --version v1.1 --file ./API接口文档-v1.1.pdf --storageType local
|
|
134
|
+
npm run weiyuan -- doc diff --project <projectId> --doc <docId> --from v1.0 --to v1.1
|
|
135
|
+
npm run weiyuan -- doc rollback --project <projectId> --doc <docId> --version v1.0
|
|
136
|
+
npm run weiyuan -- doc share --project <projectId> --doc <docId> --mode temporary_link --hours 24
|
|
137
|
+
npm run weiyuan -- doc permissions --project <projectId> --doc <docId> --read lob_xxx,lob_yyy --edit lob_xxx --delete lob_xxx
|
|
138
|
+
npm run weiyuan -- doc link-tasks --project <projectId> --doc <docId> --tasks tsk_xxx,tsk_yyy --mode merge
|
|
139
|
+
npm run weiyuan -- doc by-task --project <projectId> --task <taskId>
|
|
140
|
+
npm run weiyuan -- doc sync-status --project <projectId>
|
|
141
|
+
npm run weiyuan -- doc sync-status --project <projectId> --status warn,error
|
|
142
|
+
npm run weiyuan -- doc sync-issues --project <projectId>
|
|
143
|
+
npm run weiyuan -- doc sync-check --project <projectId>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
说明:
|
|
147
|
+
|
|
148
|
+
- 文件上传不再通过 CLI 执行,请直接在项目看板中点击上传按钮。
|
|
149
|
+
- 文件删除保留 CLI 能力,智能体 CLI 与小精灵 CLI 都支持删除文件。
|
|
150
|
+
|
|
151
|
+
Todo 行动清单:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm run weiyuan -- todo plan
|
|
155
|
+
npm run weiyuan -- todo today
|
|
156
|
+
npm run weiyuan -- todo tomorrow
|
|
157
|
+
npm run weiyuan -- todo calendar
|
|
158
|
+
npm run weiyuan -- todo upsert --actionText "明天下午开会" --when "tomorrow 15:00" --bucket tomorrow
|
|
159
|
+
npm run weiyuan -- todo complete --itemId <todoItemId>
|
|
160
|
+
npm run weiyuan -- todo delete --itemId <todoItemId>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
状态体检与事件同步:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm run weiyuan -- status --project <projectId>
|
|
167
|
+
npm run weiyuan -- dashboard --project <projectId>
|
|
168
|
+
npm run weiyuan -- status-all
|
|
169
|
+
npm run weiyuan -- dashboard-all
|
|
170
|
+
npm run weiyuan -- health
|
|
171
|
+
npm run weiyuan -- backup-create
|
|
172
|
+
npm run weiyuan -- backup-list --limit 20
|
|
173
|
+
npm run weiyuan -- backup-stats
|
|
174
|
+
npm run weiyuan -- backup-health --limit 50
|
|
175
|
+
npm run weiyuan -- store-migration-readiness
|
|
176
|
+
npm run weiyuan -- backup-restore --id <backupId>
|
|
177
|
+
npm run weiyuan -- backup-verify --id <backupId>
|
|
178
|
+
npm run weiyuan -- backup-restore-dry-run --id <backupId>
|
|
179
|
+
npm run weiyuan -- backup-diff --id <backupId>
|
|
180
|
+
npm run weiyuan -- backup-delete --id <backupId>
|
|
181
|
+
npm run weiyuan -- backup-prune-plan --keep 20 --maxBytes 104857600
|
|
182
|
+
npm run weiyuan -- backup-prune --keep 20
|
|
183
|
+
npm run weiyuan -- sync --project <projectId>
|
|
184
|
+
npm run weiyuan -- sync --project <projectId> --follow --interval 2000
|
|
185
|
+
npm run weiyuan -- sync-offline --project <projectId> --ops ./offline-ops.json --device mobile-a
|
|
186
|
+
npm run weiyuan -- sync-conflicts --project <projectId> --limit 50
|
|
187
|
+
npm run weiyuan -- sync-conflicts-summary --project <projectId>
|
|
188
|
+
npm run weiyuan -- sync-timeline --project <projectId> --limit 100
|
|
189
|
+
npm run weiyuan -- sync-suggestions --project <projectId> --event <eventId>
|
|
190
|
+
npm run weiyuan -- sync-resolve --project <projectId> --event <eventId> --strategy accept_server
|
|
191
|
+
npm run weiyuan -- sync-auto-resolve --project <projectId> --limit 20
|
|
192
|
+
npm run weiyuan -- sync-reopen --project <projectId> --event <eventId>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
风险上报与查询:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npm run weiyuan -- risk report --project <projectId> --severity warn --summary "3号库信号不稳"
|
|
199
|
+
npm run weiyuan -- risk list --project <projectId>
|
|
200
|
+
npm run weiyuan -- risk clusters --project <projectId>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`risk report` 返回会包含相似风险建议(similarRisks),用于去重与复用历史方案。
|
|
204
|
+
|
|
205
|
+
进化胶囊:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npm run weiyuan -- capsule publish --name "Skill_Pump_Repair_V1" --kind industry --file ./capsule.bin --version v1 --dnaTags 维修,稳当第一
|
|
209
|
+
npm run weiyuan -- capsule search --query 维修
|
|
210
|
+
npm run weiyuan -- capsule recommend --project <projectId> --query 文档
|
|
211
|
+
npm run weiyuan -- capsule upgrade-hints --id <capsuleId>
|
|
212
|
+
npm run weiyuan -- capsule evolution-report --id <capsuleId>
|
|
213
|
+
npm run weiyuan -- capsule project-evolution --project <projectId>
|
|
214
|
+
npm run weiyuan -- capsule evolution-compare --id <capsuleId> --target <targetCapsuleId>
|
|
215
|
+
npm run weiyuan -- capsule rollback --id <capsuleId> --target <targetCapsuleId>
|
|
216
|
+
npm run weiyuan -- capsule pull --id <capsuleId> --out ./downloaded-capsule.bin
|
|
217
|
+
npm run weiyuan -- capsule report --id <capsuleId> --success true
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 身份文件
|
|
221
|
+
|
|
222
|
+
默认身份文件:当前目录的 `.weiyuan`(JSON)。
|
|
223
|
+
|
|
224
|
+
## 说明
|
|
225
|
+
|
|
226
|
+
- 这是 MVP 级 CLI:聚焦可跑通闭环与协议对齐;后续可升级为 OpenClaw skill 形态。
|
|
227
|
+
- 协议与鉴权细则见:[server/PROTOCOL.md](file:///c:/Users/10123/Documents/trae_projects/sky/server/PROTOCOL.md)
|
|
228
|
+
|
|
229
|
+
## OpenClaw Skill 适配入口(MVP)
|
|
230
|
+
|
|
231
|
+
适配器命令:`npm run weiyuan:skill`
|
|
232
|
+
|
|
233
|
+
输入为 JSON(stdin),支持两种模式:
|
|
234
|
+
|
|
235
|
+
1) `action` 模式(结构化)
|
|
236
|
+
2) `text` 模式(口语意图映射)
|
|
237
|
+
|
|
238
|
+
输入/输出 schema 见:`client/skill/schema.json`
|
|
239
|
+
|
|
240
|
+
示例(action):
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
'{"action":"task.list","identity":".weiyuan.dev2","projectId":"prj_xxx"}' | npm run weiyuan:skill
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
示例(text):
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
'{"text":"我能做什么","identity":".weiyuan.dev2","projectId":"prj_xxx"}' | npm run weiyuan:skill
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
输出格式:
|
|
253
|
+
|
|
254
|
+
- 成功:`{"ok": true, "data": ...}`
|
|
255
|
+
- 失败:`{"ok": false, "errorCode": "...", "message": "...", "rawError": "..."}`
|
|
256
|
+
|
|
257
|
+
## 生成 Skill 包
|
|
258
|
+
|
|
259
|
+
构建命令:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
npm run weiyuan:skill:build
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
输出目录:`dist/skill-package`
|
|
266
|
+
|
|
267
|
+
该目录包含:
|
|
268
|
+
|
|
269
|
+
- `manifest.json`
|
|
270
|
+
- `schema.json`
|
|
271
|
+
- `examples/*.json`
|
|
272
|
+
- 适配器与 CLI 源码(用于 OpenClaw 侧加载或二次封装)
|
|
273
|
+
|
|
274
|
+
## 版本与发布
|
|
275
|
+
|
|
276
|
+
版本递增(patch/minor/major):
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npm run weiyuan:skill:version -- patch
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
发布前校验门(manifest/schema/examples/adapter 契约):
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
npm run weiyuan:skill:validate
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
一键发布(构建 + zip + 发布说明):
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
npm run weiyuan:skill:release
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
说明:`weiyuan:skill:release` 会先执行校验门,未通过则阻断发布。
|
|
295
|
+
|
|
296
|
+
发布产物:
|
|
297
|
+
|
|
298
|
+
- `dist/releases/weiyuan-openclaw-skill-v<version>.zip`
|
|
299
|
+
- `dist/releases/RELEASE_NOTES_<version>.md`
|
|
300
|
+
|
|
301
|
+
## 自动升级启动脚本(OpenClaw)
|
|
302
|
+
|
|
303
|
+
Skill 包中附带 `run-weiyuan-skill.ps1`,用于每次执行前自动检查并拉取最新 Skill 版本。
|
|
304
|
+
需要设置以下环境变量:
|
|
305
|
+
|
|
306
|
+
- `WEIYUAN_UPGRADE_BASE_URL`:版本与 zip 下载地址
|
|
307
|
+
- `WEIYUAN_API_BASE_URL`:微元 API 地址
|
|
308
|
+
- `WEIYUAN_SKILL_ROOT`:Skill 解压目录
|
|
309
|
+
- `WEIYUAN_IDENTITY_PATH`:身份文件路径
|
|
310
|
+
|
|
311
|
+
更新策略(可选):
|
|
312
|
+
|
|
313
|
+
- `WEIYUAN_AUTO_UPDATE_MODE`:`always`(默认)/ `prompt` / `never`
|
|
314
|
+
- `WEIYUAN_AUTO_UPDATE_CONSENT`:非交互环境下是否允许更新(`yes/true/1/accept`)
|
|
315
|
+
- `WEIYUAN_UPDATE_CHECK_INTERVAL_HOURS`:检查间隔小时数(默认 `24`)
|
|
316
|
+
- `WEIYUAN_FORCE_UPDATE_CHECK`:强制本次检查(`yes/true/1/on`)
|
|
317
|
+
- `WEIYUAN_UPDATE_LOG_DIR`:更新日志目录(默认 `<skillRoot>/logs`)
|
|
318
|
+
|
|
319
|
+
行为说明:
|
|
320
|
+
|
|
321
|
+
- 脚本按检查间隔定时检查,未到窗口会直接跳过网络请求
|
|
322
|
+
- 检测到新版本时,默认静默更新,不打断用户
|
|
323
|
+
- 更新失败会自动回退到上一版本,避免用户侧不可用
|
|
324
|
+
- 每次检查与更新结果都会写入日志和状态文件(`.update-state.json`)
|
|
325
|
+
|
|
326
|
+
## CI 工作流
|
|
327
|
+
|
|
328
|
+
- `skill-ci`:push/PR 自动执行 `weiyuan:skill:validate` 与 `weiyuan:skill:build`
|
|
329
|
+
- `skill-release`:手动触发,支持 patch/minor/major 递增后自动执行:
|
|
330
|
+
- 版本递增并提交 `manifest.json`
|
|
331
|
+
- 创建并推送 git tag(`v<version>`)
|
|
332
|
+
- 生成 GitHub Release 并上传 zip/release notes
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "weiyuan-openclaw-skill",
|
|
3
|
+
"displayName": "微元协作 Skill",
|
|
4
|
+
"version": "0.3.771",
|
|
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
|
+
"project.list",
|
|
21
|
+
"project.delete",
|
|
22
|
+
"project.storage",
|
|
23
|
+
"project.storage_set",
|
|
24
|
+
"project.storage_remaining",
|
|
25
|
+
"doc.upload",
|
|
26
|
+
"doc.delete",
|
|
27
|
+
"task.list",
|
|
28
|
+
"task.list_all",
|
|
29
|
+
"task.create",
|
|
30
|
+
"task.take",
|
|
31
|
+
"task.delete",
|
|
32
|
+
"task.submit",
|
|
33
|
+
"task.warnings",
|
|
34
|
+
"task.dependency_map",
|
|
35
|
+
"task.critical_path",
|
|
36
|
+
"task.recommend_assignees",
|
|
37
|
+
"task.ready",
|
|
38
|
+
"task.unblocked",
|
|
39
|
+
"task.unblocked_notify",
|
|
40
|
+
"task.blocking_impact",
|
|
41
|
+
"task.cascade_suggestions",
|
|
42
|
+
"task.confirm_attribution",
|
|
43
|
+
"status",
|
|
44
|
+
"status.all",
|
|
45
|
+
"health",
|
|
46
|
+
"backup.create",
|
|
47
|
+
"backup.list",
|
|
48
|
+
"backup.stats",
|
|
49
|
+
"backup.health",
|
|
50
|
+
"store.migration_readiness",
|
|
51
|
+
"backup.restore",
|
|
52
|
+
"backup.verify",
|
|
53
|
+
"backup.restore_dry_run",
|
|
54
|
+
"backup.diff",
|
|
55
|
+
"backup.delete",
|
|
56
|
+
"backup.prune",
|
|
57
|
+
"backup.prune_plan",
|
|
58
|
+
"dashboard",
|
|
59
|
+
"dashboard.all",
|
|
60
|
+
"sync.conflicts",
|
|
61
|
+
"sync.conflicts_summary",
|
|
62
|
+
"sync.resolve",
|
|
63
|
+
"sync.suggestions",
|
|
64
|
+
"sync.auto_resolve",
|
|
65
|
+
"sync.timeline",
|
|
66
|
+
"sync.reopen",
|
|
67
|
+
"team.status",
|
|
68
|
+
"team.workload",
|
|
69
|
+
"risk.report",
|
|
70
|
+
"risk.clusters",
|
|
71
|
+
"capsule.search",
|
|
72
|
+
"capsule.recommend",
|
|
73
|
+
"capsule.upgrade_hints",
|
|
74
|
+
"capsule.rollback",
|
|
75
|
+
"capsule.evolution_report",
|
|
76
|
+
"capsule.project_evolution",
|
|
77
|
+
"capsule.evolution_compare",
|
|
78
|
+
"context.use",
|
|
79
|
+
"context.clear",
|
|
80
|
+
"context.show",
|
|
81
|
+
"context.candidates"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"examples": [
|
|
85
|
+
"./examples/action-task-list.json",
|
|
86
|
+
"./examples/text-what-can-i-do.json",
|
|
87
|
+
"./examples/risk-report.json"
|
|
88
|
+
],
|
|
89
|
+
"output": {
|
|
90
|
+
"success": {
|
|
91
|
+
"ok": true,
|
|
92
|
+
"data": {}
|
|
93
|
+
},
|
|
94
|
+
"error": {
|
|
95
|
+
"ok": false,
|
|
96
|
+
"errorCode": "UNKNOWN_ACTION",
|
|
97
|
+
"message": "",
|
|
98
|
+
"rawError": ""
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|