openclaw-weiyuan-init 1.0.112 → 1.0.115

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 CHANGED
@@ -58,6 +58,49 @@ 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 bundledSkillSourcePath(fileName) {
68
+ return path.join(__dirname, '..', 'workspace-weiyuan', 'weiyuan', 'src', fileName);
69
+ }
70
+
71
+ function hasRequiredSkillActions(manifest, schema) {
72
+ const manifestActions = Array.isArray(manifest && manifest.capabilities && manifest.capabilities.actions)
73
+ ? manifest.capabilities.actions.map((x) => String(x || '').trim()).filter(Boolean)
74
+ : [];
75
+ const schemaEnum = (((schema || {}).properties || {}).input || {}).oneOf;
76
+ const actionEnum = Array.isArray(schemaEnum)
77
+ ? (schemaEnum.find((item) => item && item.title === 'ActionInput') || {}).properties?.action?.enum
78
+ : [];
79
+ const schemaActions = Array.isArray(actionEnum) ? actionEnum.map((x) => String(x || '').trim()).filter(Boolean) : [];
80
+ return REQUIRED_SKILL_ACTIONS.every((action) => manifestActions.includes(action) && schemaActions.includes(action));
81
+ }
82
+
83
+ async function syncBundledSkillMetadata(weiyuanPath) {
84
+ const manifestPath = path.join(weiyuanPath, 'manifest.json');
85
+ const schemaPath = path.join(weiyuanPath, 'schema.json');
86
+ const bundledManifestPath = bundledSkillMetadataPath('manifest.json');
87
+ const bundledSchemaPath = bundledSkillMetadataPath('schema.json');
88
+ if (!await fs.pathExists(bundledManifestPath) || !await fs.pathExists(bundledSchemaPath)) return false;
89
+ const bundledManifest = await fs.readFile(bundledManifestPath, 'utf8');
90
+ const bundledSchema = await fs.readFile(bundledSchemaPath, 'utf8');
91
+ const currentManifest = await fs.readFile(manifestPath, 'utf8').catch(() => '');
92
+ const currentSchema = await fs.readFile(schemaPath, 'utf8').catch(() => '');
93
+ if (currentManifest === bundledManifest && currentSchema === bundledSchema) {
94
+ try {
95
+ if (hasRequiredSkillActions(JSON.parse(currentManifest), JSON.parse(currentSchema))) return false;
96
+ } catch (_) {
97
+ }
98
+ }
99
+ await fs.writeFile(manifestPath, bundledManifest, 'utf8');
100
+ await fs.writeFile(schemaPath, bundledSchema, 'utf8');
101
+ return true;
102
+ }
103
+
61
104
  const DEFAULT_FIXED_MESSAGES = {
62
105
  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
106
  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 +153,7 @@ function printInitAccountWelcome(initInfo) {
110
153
  const modeLabel = getBindModeLabel(initInfo);
111
154
  const account = String(initInfo.account || '').trim();
112
155
  const recovered = Boolean(initInfo.recovered);
156
+ const recoveryLabel = String(initInfo.recoveryLabel || '').trim() || '当前绑定身份';
113
157
  const contractText = String(initInfo.contractText || '').trim();
114
158
  const welcome = String(initInfo.welcome || '').trim();
115
159
  const ruleInjectionMessage = String(initInfo.ruleInjectionMessage || '').trim();
@@ -129,16 +173,22 @@ function printInitAccountWelcome(initInfo) {
129
173
  }
130
174
  }
131
175
  if (account) {
132
- console.log(chalk.cyan(recovered ? '\n【微元身份已恢复】' : '\n【已成功加入微元系统】'));
176
+ console.log(chalk.cyan(recovered ? '\n【微元身份已同步】' : '\n【已成功加入微元系统】'));
133
177
  console.log(chalk.white(`你的默认账号为:${account}`));
134
- console.log(chalk.white(recovered ? '请牢记这些内容;当前智能体已根据服务器绑定记录恢复到原微元账号。' : '请牢记该账号信息;当前账号中心已切换为验证码登录体系。'));
178
+ console.log(
179
+ chalk.white(
180
+ recovered
181
+ ? `请牢记这些内容;普通 init 已按服务器绑定记录同步当前工作区的${recoveryLabel}。`
182
+ : '请牢记该账号信息;当前账号中心已切换为验证码登录体系。'
183
+ )
184
+ );
135
185
  console.log(chalk.white('微元系统官方网站为:https://api.magon.com.cn/'));
136
186
  console.log(chalk.white('微元系统登录页面为:https://api.magon.com.cn/api/login'));
137
187
  console.log(chalk.white('微元系统绑定手机号页面为:https://api.magon.com.cn/api/account/bind-phone'));
138
188
  console.log(chalk.white('建议立即前往“绑定手机号”页面完成手机号绑定,后续即可通过登录页获取验证码登录,并可在登录后修改用户名和密码。'));
139
189
  } else if (recovered) {
140
- console.log(chalk.cyan('\n【微元身份已恢复】'));
141
- console.log(chalk.white('系统已根据服务器中的绑定记录,重新恢复当前智能体对应的身份文件。'));
190
+ console.log(chalk.cyan('\n【微元身份已同步】'));
191
+ console.log(chalk.white(`系统已根据服务器中的绑定记录,同步当前工作区的${recoveryLabel}身份文件。`));
142
192
  }
143
193
  if (contractText) {
144
194
  console.log(chalk.cyan(`\n【${getBehaviorContractTitle(initInfo)}】`));
@@ -185,7 +235,7 @@ function describeInitErrorMessage(error) {
185
235
  return '当前智能体没有绑定任何微元账号,请先使用官网固定加入命令,或执行“邀请加入微元”的专用命令完成首次接入';
186
236
  }
187
237
  if (msg.includes('invite_registration_required')) {
188
- return '普通 init 仅用于修复或恢复身份文件;首次注册请使用官网固定加入命令,或使用“邀请加入微元”复制出的专用命令';
238
+ return '普通 init 仅用于升级并同步当前绑定身份;首次接入请使用官网固定加入命令,或使用“邀请加入微元”复制出的专用命令';
189
239
  }
190
240
  if (msg.includes('agent_register_token_used') || msg.includes('agent_already_registered')) {
191
241
  return '该智能体已完成接入,不能再次使用邀请专用命令重复注册新账号;如需补全或找回微元系统文件,请改用普通 init 命令';
@@ -530,6 +580,12 @@ async function runJoin(weiyuanPath, identityPath, projectId, code, fromInit = fa
530
580
  if (lastError) throw lastError;
531
581
  }
532
582
 
583
+ async function refreshIdentityServerBase(identityPath, serverUrl) {
584
+ const identity = await fs.readJson(identityPath);
585
+ identity.serverBaseUrl = normalizeBusinessServerUrl(serverUrl);
586
+ await fs.writeJson(identityPath, identity, { spaces: 2 });
587
+ }
588
+
533
589
  async function readIdentityAccount(identityPath) {
534
590
  try {
535
591
  const identity = await fs.readJson(identityPath);
@@ -606,8 +662,10 @@ export const CAPABILITY_ACTION_ALLOWLIST = new Set<string>(Object.values(CAPABIL
606
662
  if (!await fs.pathExists(tsconfigPath)) {
607
663
  await fs.writeJson(tsconfigPath, DEFAULT_SKILL_TSCONFIG, { spaces: 2 });
608
664
  }
665
+ await syncBundledSkillMetadata(weiyuanPath);
609
666
  // Compatibility guard: some custom upgrade bundles miss capabilityActions.ts.
610
667
  // Auto-create fallback files so CLI can boot instead of crashing on module resolution.
668
+ const bundledCapabilityActionsPath = bundledSkillSourcePath('capabilityActions.ts');
611
669
  const capabilityCandidates = [
612
670
  path.join(weiyuanPath, 'src', 'capabilityActions.ts'),
613
671
  path.join(weiyuanPath, 'server', 'src', 'capabilityActions.ts')
@@ -615,7 +673,11 @@ export const CAPABILITY_ACTION_ALLOWLIST = new Set<string>(Object.values(CAPABIL
615
673
  for (const file of capabilityCandidates) {
616
674
  if (!await fs.pathExists(file)) {
617
675
  await fs.ensureDir(path.dirname(file));
618
- await fs.writeFile(file, capabilityCompatContent, 'utf8');
676
+ if (await fs.pathExists(bundledCapabilityActionsPath)) {
677
+ await fs.copy(bundledCapabilityActionsPath, file, { overwrite: true });
678
+ } else {
679
+ await fs.writeFile(file, capabilityCompatContent, 'utf8');
680
+ }
619
681
  }
620
682
  }
621
683
  await execFileAsync(NPM_BIN, ['--prefix', weiyuanPath, 'install'], cliExecOptions(weiyuanPath));
@@ -674,13 +736,20 @@ async function runInit(options) {
674
736
  let spinner = ora('检测到已接入微元系统,直接加入项目...').start();
675
737
  try {
676
738
  await runAcrossServerCandidates(serverCandidates, 'join_existing_workspace', async (candidate) => {
739
+ await refreshIdentityServerBase(identityPath, candidate);
740
+ try {
741
+ await runJoin(weiyuanPath, identityPath, options.project, options.code, false);
742
+ return;
743
+ } catch (error) {
744
+ const text = String((error && (error.stderr || error.stdout || error.message)) || '').toLowerCase();
745
+ const needsRepair = text.includes('identity_rebind_required') || text.includes('unknown_lobster') || text.includes('invalid_signature');
746
+ if (!needsRepair) throw error;
747
+ }
677
748
  const refreshed = await createIdentityFile(identityPath, candidate, workspacePath);
678
749
  if (!refreshed || !refreshed.created) {
679
750
  throw new Error(refreshed && refreshed.error ? refreshed.error : 'identity_refresh_failed');
680
751
  }
681
- const identity = await fs.readJson(identityPath);
682
- identity.serverBaseUrl = normalizeBusinessServerUrl(candidate);
683
- await fs.writeJson(identityPath, identity, { spaces: 2 });
752
+ await refreshIdentityServerBase(identityPath, candidate);
684
753
  await runJoin(weiyuanPath, identityPath, options.project, options.code, false);
685
754
  });
686
755
  await persistOpenClawRequiredFiles(weiyuanPath, null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-weiyuan-init",
3
- "version": "1.0.112",
3
+ "version": "1.0.115",
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,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,6 @@
1
+ {
2
+ "action": "task.list",
3
+ "identity": ".weiyuan.dev2",
4
+ "projectId": "prj_demo"
5
+ }
6
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "action": "risk.report",
3
+ "identity": ".weiyuan.dev2",
4
+ "projectId": "prj_demo",
5
+ "severity": "warn",
6
+ "summary": "3号库信号不稳"
7
+ }
8
+
@@ -0,0 +1,6 @@
1
+ {
2
+ "text": "我能做什么",
3
+ "identity": ".weiyuan.dev2",
4
+ "projectId": "prj_demo"
5
+ }
6
+
@@ -0,0 +1,144 @@
1
+ {
2
+ "name": "weiyuan-openclaw-skill",
3
+ "displayName": "微元协作 Skill",
4
+ "version": "0.3.772",
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.rename",
22
+ "project.delete",
23
+ "project.storage",
24
+ "project.storage_set",
25
+ "project.storage_remaining",
26
+ "project.quota",
27
+ "invite.generate",
28
+ "account.invite-join-template",
29
+ "member.add-web",
30
+ "member.remove",
31
+ "member.leave",
32
+ "member.profile.set",
33
+ "member.profile.edit",
34
+ "member.profile.global.set",
35
+ "member.profile.global.edit",
36
+ "doc.upload",
37
+ "doc.delete",
38
+ "task.list",
39
+ "task.list_all",
40
+ "task.create",
41
+ "task.rename",
42
+ "task.update",
43
+ "task.take",
44
+ "task.delete",
45
+ "task.submit",
46
+ "task.evolution_list",
47
+ "task.evolution_add",
48
+ "task.suggest",
49
+ "task.suggest_reject",
50
+ "task.suggest_withdraw",
51
+ "task.warnings",
52
+ "task.dependency_map",
53
+ "task.critical_path",
54
+ "task.recommend_assignees",
55
+ "task.ready",
56
+ "task.unblocked",
57
+ "task.unblocked_notify",
58
+ "task.blocking_impact",
59
+ "task.cascade_suggestions",
60
+ "task.confirm_attribution",
61
+ "status",
62
+ "status.all",
63
+ "health",
64
+ "todo.plan",
65
+ "todo.list",
66
+ "todo.today",
67
+ "todo.tomorrow",
68
+ "todo.calendar",
69
+ "todo.upsert",
70
+ "todo.complete",
71
+ "todo.delete",
72
+ "todo.regenerate",
73
+ "backup.create",
74
+ "backup.list",
75
+ "backup.stats",
76
+ "backup.health",
77
+ "store.migration_readiness",
78
+ "backup.restore",
79
+ "backup.verify",
80
+ "backup.restore_dry_run",
81
+ "backup.diff",
82
+ "backup.delete",
83
+ "backup.prune",
84
+ "backup.prune_plan",
85
+ "dashboard",
86
+ "dashboard.all",
87
+ "dashboard.web",
88
+ "panel.web",
89
+ "dashboard.password_set",
90
+ "dashboard.password_toggle",
91
+ "password.status",
92
+ "sync.stream",
93
+ "notify.inbox",
94
+ "sync.offline",
95
+ "sync.conflicts",
96
+ "sync.conflicts_summary",
97
+ "sync.resolve",
98
+ "sync.suggestions",
99
+ "sync.auto_resolve",
100
+ "sync.timeline",
101
+ "sync.reopen",
102
+ "team.status",
103
+ "team.workload",
104
+ "risk.report",
105
+ "risk.clusters",
106
+ "issue.report",
107
+ "issue.my",
108
+ "capsule.search",
109
+ "capsule.recommend",
110
+ "capsule.upgrade_hints",
111
+ "capsule.rollback",
112
+ "capsule.evolution_report",
113
+ "capsule.project_evolution",
114
+ "capsule.evolution_compare",
115
+ "context.use",
116
+ "context.clear",
117
+ "context.show",
118
+ "context.candidates",
119
+ "micro.exit",
120
+ "account.exit",
121
+ "official.site",
122
+ "upgrade.rules",
123
+ "onboard.invite_code",
124
+ "onboard.install_code"
125
+ ]
126
+ },
127
+ "examples": [
128
+ "./examples/action-task-list.json",
129
+ "./examples/text-what-can-i-do.json",
130
+ "./examples/risk-report.json"
131
+ ],
132
+ "output": {
133
+ "success": {
134
+ "ok": true,
135
+ "data": {}
136
+ },
137
+ "error": {
138
+ "ok": false,
139
+ "errorCode": "UNKNOWN_ACTION",
140
+ "message": "",
141
+ "rawError": ""
142
+ }
143
+ }
144
+ }