openclaw-sync-assistant 0.1.0 → 0.1.2

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/index.js +16 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -48,8 +48,13 @@ module.exports = {
48
48
  }
49
49
  }
50
50
 
51
- // 如果未配置,则在安装/首次加载时触发引导向导
52
- if (!hasConfigured) {
51
+ // 判断当前进程是否为 OpenClaw 的长期后台进程 (daemon),而不是执行一次性命令 (如 plugins list/update)
52
+ // 通常 daemon 进程会有特殊的标志或不会立即退出。由于 OpenClaw 的架构,可以通过进程参数判断
53
+ const isDaemon =
54
+ process.argv.includes("daemon") || process.argv.includes("start");
55
+
56
+ // 如果未配置,并且当前是 daemon 启动,则触发引导向导
57
+ if (!hasConfigured && isDaemon) {
53
58
  isWizardRunning = true;
54
59
  try {
55
60
  await module.exports.runSetupWizard(context);
@@ -148,7 +153,15 @@ module.exports = {
148
153
  } else if (syncMethod === "github") {
149
154
  githubRepo = await text({
150
155
  message: "请输入用于同步的 GitHub 仓库地址:",
151
- placeholder: "例如: https://github.com/... (直接回车可跳过)",
156
+ placeholder: "例如: https://github.com/user/repo.git (直接回车可跳过)",
157
+ validate(value) {
158
+ if (!value || value.trim() === "") return;
159
+ const githubRegex =
160
+ /^(https:\/\/github\.com\/|git@github\.com:)[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+(\.git)?$/;
161
+ if (!githubRegex.test(value.trim())) {
162
+ return "请输入有效的 GitHub 仓库地址,例如: https://github.com/user/repo.git";
163
+ }
164
+ },
152
165
  });
153
166
  if (typeof githubRepo === "symbol") return;
154
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-sync-assistant",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "An OpenClaw plugin for P2P file and data synchronization using Hyperswarm and Hyperdrive ecosystem.",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",