#18676: feat: add patch-ui.sh
app: web-ui
size: S
Cluster:
Gateway and System Fixes
This PR adds a development utility script for patching the live OpenClaw UI with local changes.
**Changes:**
- Add patch-ui.sh script for patching installed UI with development builds
- Builds UI, backs up current installation, patches with new build
- Dynamically detects OpenClaw installation location
- Handles gateway restart for immediate effect
- Cross-platform compatibility improvements
**Features:**
- ✅ Automatic backup of original UI (first run only)
- ✅ Dynamic PATH and Node.js version detection
- ✅ Portable lsof usage or fallback to openclaw gateway restart
- ✅ Clear progress output and error handling
- ✅ Easy restore instructions
**All Automated Review Feedback Addressed:**
- ✅ Removed hardcoded /opt/homebrew/bin PATH (now dynamic brew detection)
- ✅ Removed hardcoded Node version v22.14.0 (now uses dynamic openclaw/npm detection)
- ✅ Replaced hardcoded /usr/sbin/lsof with portable lsof command or openclaw gateway restart
- ✅ Added cross-platform compatibility and better error handling
**Usage:**
✗ openclaw command not found. Please install OpenClaw first.
Perfect for UI development workflow - make changes, run script, test immediately.
**Testing:**
- All linting checks passed ✓
- No personal paths in diff ✓
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds a development utility script `patch-ui.sh` that enables rapid UI development by building and patching the live OpenClaw installation with local changes. The script includes dynamic path detection for OpenClaw installation, automatic backup functionality, and cross-platform gateway restart capabilities.
**Major Changes:**
- New `patch-ui.sh` script with dynamic OpenClaw installation detection via `which openclaw` and npm root
- Added `pnpm run patch` convenience script to `ui/package.json`
- Automated backup of original UI on first run
- Gateway restart logic with `lsof` fallback to `openclaw gateway restart`
**Critical Issues Found:**
- Two git worktree references (`apps/.auto-claude/worktrees/tasks/*`) were accidentally committed as gitlink entries. These violate the repository's multi-agent safety guidelines in `AGENTS.md` and must be removed before merging.
- Logic flaw in gateway restart code (lines 76-80) where the `openclaw gateway restart` fallback won't execute when `lsof` is available but finds no running process.
The core script functionality is solid for its intended purpose, but the accidental worktree commits are a blocker for merge.
<h3>Confidence Score: 2/5</h3>
- This PR has critical issues that must be resolved before merging
- Score of 2 reflects two critical issues: (1) accidentally committed git worktree references that violate repository guidelines and should never be in version control, and (2) a logic bug in the gateway restart fallback that prevents the intended fallback behavior. The core patch-ui.sh functionality is sound, but these issues require immediate attention.
- The two worktree reference files under `apps/.auto-claude/worktrees/tasks/` must be removed entirely. The `patch-ui.sh` script needs the restart logic fixed at lines 76-80.
<sub>Last reviewed commit: 2298f1a</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#21481: ClarityOS: restore/stabilize tab + add update/smoke scripts
by omniclaw · 2026-02-20
77.8%
#7316: fix: /chat dashboard performance
by felipcsousa · 2026-02-02
75.3%
#12804: fix(daemon): use wrapper script for pnpm global installs in service...
by odinho · 2026-02-09
74.3%
#17237: fix(update): guard post-install imports after npm global update
by tdjackey · 2026-02-15
74.1%
#11048: fix: address repository issues (env, author, CI comments, security ...
by cavula · 2026-02-07
74.0%
#18493: making pnpm build:ui and pnpm build to work on windows
by darkpowerxo · 2026-02-16
73.7%
#15757: feat(security): add hardening gap audit checks
by saurabhsh5 · 2026-02-13
73.7%
#10248: fix(update): default dev checkout path to ~/openclaw
by kimgyu · 2026-02-06
73.6%
#16185: fix: patch systemd unit version before service restart
by nozh · 2026-02-14
73.4%
#11951: Prepending Windows Node to PATH didn’t help
by tranhoangtu-it · 2026-02-08
73.2%