@silicaclaw/cli 1.0.0-beta.19 → 1.0.0-beta.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silicaclaw/cli",
3
- "version": "1.0.0-beta.19",
3
+ "version": "1.0.0-beta.20",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawnSync } from "node:child_process";
4
- import { accessSync, constants, existsSync, readFileSync } from "node:fs";
4
+ import { accessSync, constants, cpSync, existsSync, readFileSync } from "node:fs";
5
5
  import { dirname, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
@@ -138,8 +138,60 @@ function getGatewayStatus() {
138
138
  }
139
139
  }
140
140
 
141
+ function isManagedAppDir(appDir) {
142
+ if (!appDir || !existsSync(resolve(appDir, "package.json"))) return false;
143
+ try {
144
+ const pkg = JSON.parse(readFileSync(resolve(appDir, "package.json"), "utf8"));
145
+ const name = String(pkg?.name || "");
146
+ return name === "@silicaclaw/cli" || name === "silicaclaw";
147
+ } catch {
148
+ return false;
149
+ }
150
+ }
151
+
152
+ function syncCurrentPackageToAppDir(appDir) {
153
+ if (!appDir || resolve(appDir) === ROOT_DIR) return false;
154
+ if (!isManagedAppDir(appDir)) return false;
155
+
156
+ const entries = [
157
+ "apps/local-console",
158
+ "apps/public-explorer",
159
+ "packages/core",
160
+ "packages/network",
161
+ "packages/storage",
162
+ "scripts",
163
+ "README.md",
164
+ "INSTALL.md",
165
+ "CHANGELOG.md",
166
+ "ARCHITECTURE.md",
167
+ "ROADMAP.md",
168
+ "SOCIAL_MD_SPEC.md",
169
+ "DEMO_GUIDE.md",
170
+ "RELEASE_NOTES_v1.0.md",
171
+ "social.md.example",
172
+ "openclaw.social.md.example",
173
+ "VERSION",
174
+ "package.json",
175
+ "package-lock.json",
176
+ ];
177
+
178
+ for (const rel of entries) {
179
+ const src = resolve(ROOT_DIR, rel);
180
+ if (!existsSync(src)) continue;
181
+ const dst = resolve(appDir, rel);
182
+ cpSync(src, dst, { recursive: true, force: true });
183
+ }
184
+ return true;
185
+ }
186
+
141
187
  function restartGatewayIfRunning() {
142
188
  const status = getGatewayStatus();
189
+ const appDir = status?.app_dir ? String(status.app_dir) : "";
190
+ const synced = syncCurrentPackageToAppDir(appDir);
191
+ if (synced) {
192
+ console.log(`Synced runtime files to app_dir: ${appDir}`);
193
+ }
194
+
143
195
  const localRunning = Boolean(status?.local_console?.running);
144
196
  const signalingRunning = Boolean(status?.signaling?.running);
145
197
  if (!localRunning && !signalingRunning) {