@@ -58,37 +58,43 @@ do_start() {
5858}
5959
6060do_sync_plugin () {
61- local REMOTE_USER=" mini.local"
62- local REMOTE_DIR=" ~/Projects/botsChat/packages/plugin"
63-
64- info " Syncing plugin to mini.local…"
61+ # ── IMPORTANT ──────────────────────────────────────────────────
62+ # Development repo and production plugin MUST be kept separate:
63+ # Dev repo: mini:~/Projects/botschat-app/botsChat/packages/plugin/
64+ # Production: mini:~/.openclaw/extensions/botschat/
65+ # NEVER edit files directly in ~/.openclaw/extensions/botschat/.
66+ # Always: edit dev repo → build → deploy artifacts to extensions.
67+ # ────────────────────────────────────────────────────────────────
68+ local REMOTE=" mini.local"
69+ local DEV_DIR=" ~/Projects/botschat-app/botsChat/packages/plugin"
70+ local EXT_DIR=" ~/.openclaw/extensions/botschat"
71+
72+ info " Syncing plugin source to mini.local dev repo…"
6573 rsync -avz --exclude node_modules --exclude .git --exclude dist --exclude .wrangler \
66- packages/plugin/ " $REMOTE_USER : $REMOTE_DIR /"
67- ok " Plugin files synced"
74+ packages/plugin/ " $REMOTE : $DEV_DIR /"
75+ ok " Plugin source synced → $DEV_DIR "
6876
69- info " Building plugin, deploying to extensions, restarting gateway on mini.local …"
70- ssh " $REMOTE_USER " ' export PATH="/opt/homebrew/bin:$PATH"
71- cd ~/Projects/botsChat/packages/plugin
77+ info " Building plugin in dev repo , deploying to extensions, restarting gateway…"
78+ ssh " $REMOTE " " export PATH=\ " /opt/homebrew/bin:\ $ PATH\ "
79+ cd $DEV_DIR
7280npm run build
73- EXT_DIR=~/.openclaw/extensions/botschat
74- rsync -av --delete dist/ "$EXT_DIR/dist/"
75- rsync -av bin/ "$EXT_DIR/bin/" 2>/dev/null || true
76- cp -f package.json openclaw.plugin.json "$EXT_DIR/" 2>/dev/null || true
77- echo "--- Deployed to $EXT_DIR ---"
78- pkill -9 -f openclaw-gateway 2>/dev/null || true
79- sleep 3
80- nohup openclaw gateway run --bind loopback --port 18789 --force > /tmp/openclaw-gateway.log 2>&1 &
81- echo "Gateway restarted (PID=$!)"'
82- ok " Plugin synced, deployed to extensions, gateway restarted"
81+ echo '--- Deploying built artifacts to $EXT_DIR ---'
82+ rsync -av --delete dist/ $EXT_DIR /dist/
83+ rsync -av bin/ $EXT_DIR /bin/ 2>/dev/null || true
84+ cp -f package.json openclaw.plugin.json $EXT_DIR / 2>/dev/null || true
85+ echo '--- Restarting gateway via launchctl ---'
86+ launchctl kickstart -k gui/\$ (id -u)/ai.openclaw.gateway
87+ echo 'Gateway restarted'"
88+ ok " Plugin deployed to extensions, gateway restarted"
8389
8490 sleep 4
8591 info " Checking connection…"
86- ssh " $REMOTE_USER " ' tail -5 /tmp/ openclaw- gateway.log | grep -i "authenticated\|error\|Task scan"'
92+ ssh " $REMOTE " ' tail -10 ~/. openclaw/logs/ gateway.log | grep -i "authenticated\|error\|Task scan\|botschat "'
8793}
8894
8995do_logs () {
9096 info " Tailing gateway logs on mini.local…"
91- ssh mini.local ' tail -f /tmp/ openclaw- gateway.log'
97+ ssh mini.local ' tail -f ~/. openclaw/logs/ gateway.log'
9298}
9399
94100# ── Main ─────────────────────────────────────────────────────────────
0 commit comments