openclaw-weiyuan-init 1.0.111 → 1.0.112

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 (2) hide show
  1. package/lib/identity.js +36 -0
  2. package/package.json +1 -1
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.111",
3
+ "version": "1.0.112",
4
4
  "description": "OpenClaw Weiyuan Skill 一键初始化工具",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {