Summary
Add a deploy-local.sh script and deploy:local npm script that rsyncs a successful build to ~/.openclaw/dist/ and updates the gateway LaunchAgent plist to run from there.
Problem
The launchd gateway plist points directly at ~/Developer/openclaw/dist/index.js. This couples the live gateway to the repo — any pnpm build immediately affects the running service, and a failed or in-progress build can crash the gateway mid-execution. The goal is to decouple them so the gateway runs a stable deployed build while development continues freely in the repo.
Acceptance criteria
Implementation plan
- Create
scripts/deploy-local.sh (build → symlinks → rsync → plist update → restart)
- Add
"name": "openclaw" to ~/.openclaw/package.json (done by script at runtime)
- Create
~/.openclaw/node_modules symlink → repo node_modules/ (done by script)
- Create
~/.openclaw/skills symlink → repo skills/ (done by script)
- Add
deploy:local and deploy:local:fast scripts to package.json
Files affected
scripts/deploy-local.sh (new)
package.json (modify — add deploy scripts)
~/.openclaw/package.json (runtime edit by script)
~/Library/LaunchAgents/ai.openclaw.gateway.plist (runtime edit by script)
Additional notes
Key constraint: dist/ is not self-contained — bundled JS still resolves npm packages via ancestor node_modules/ lookup, and resolveOpenClawPackageRootSync() needs a package.json with "name": "openclaw" in an ancestor dir. Both are solved by the symlink + package.json patch steps in the deploy script.
AI-assisted plan (Claude Code, Opus 4.6).
Summary
Add a
deploy-local.shscript anddeploy:localnpm script that rsyncs a successful build to~/.openclaw/dist/and updates the gateway LaunchAgent plist to run from there.Problem
The launchd gateway plist points directly at
~/Developer/openclaw/dist/index.js. This couples the live gateway to the repo — anypnpm buildimmediately affects the running service, and a failed or in-progress build can crash the gateway mid-execution. The goal is to decouple them so the gateway runs a stable deployed build while development continues freely in the repo.Acceptance criteria
pnpm deploy:localbuilds, tests, and deploys to~/.openclaw/dist/atomicallyOPENCLAW_DEPLOY_SKIP_TESTS=1 pnpm deploy:localskips tests for fast iteration~/.openclaw/dist/index.jsopenclaw gateway status --deeppasses after first deploypnpm buildin repo does NOT restart or affect the running gatewayERR_MODULE_NOT_FOUNDin gateway log)Implementation plan
scripts/deploy-local.sh(build → symlinks → rsync → plist update → restart)"name": "openclaw"to~/.openclaw/package.json(done by script at runtime)~/.openclaw/node_modulessymlink → reponode_modules/(done by script)~/.openclaw/skillssymlink → reposkills/(done by script)deploy:localanddeploy:local:fastscripts topackage.jsonFiles affected
scripts/deploy-local.sh(new)package.json(modify — add deploy scripts)~/.openclaw/package.json(runtime edit by script)~/Library/LaunchAgents/ai.openclaw.gateway.plist(runtime edit by script)Additional notes
Key constraint:
dist/is not self-contained — bundled JS still resolves npm packages via ancestornode_modules/lookup, andresolveOpenClawPackageRootSync()needs apackage.jsonwith"name": "openclaw"in an ancestor dir. Both are solved by the symlink + package.json patch steps in the deploy script.AI-assisted plan (Claude Code, Opus 4.6).