Skip to content

[Improvement]: Deploy local builds to ~/.openclaw/ to decouple gateway from repo #12

@Arry8

Description

@Arry8

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

  • pnpm deploy:local builds, tests, and deploys to ~/.openclaw/dist/ atomically
  • OPENCLAW_DEPLOY_SKIP_TESTS=1 pnpm deploy:local skips tests for fast iteration
  • Gateway plist updated to point at ~/.openclaw/dist/index.js
  • openclaw gateway status --deep passes after first deploy
  • Subsequent pnpm build in repo does NOT restart or affect the running gateway
  • Module resolution works (no ERR_MODULE_NOT_FOUND in gateway log)

Implementation plan

  1. Create scripts/deploy-local.sh (build → symlinks → rsync → plist update → restart)
  2. Add "name": "openclaw" to ~/.openclaw/package.json (done by script at runtime)
  3. Create ~/.openclaw/node_modules symlink → repo node_modules/ (done by script)
  4. Create ~/.openclaw/skills symlink → repo skills/ (done by script)
  5. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions