fix(merge): portable Node-based merge-driver prepare hook (cross-shell Windows/POSIX)#7
Conversation
Replace the guarded POSIX prepare hook with a Node script (scripts/prepare-merge-driver.mjs) so npm install/ci wire pm-cli's field-aware merge drivers identically on POSIX shells and Windows cmd.exe. The guarded POSIX 'if command -v pm; then pm merge install; fi' form cannot be parsed by Windows cmd.exe (Greptile P1 + CodeRabbit on the xydx wave), so install failed at prepare on native Windows; the bare form broke POSIX --omit=dev. The Node guard resolves pm presence via a PATH scan (PATHEXT-aware, never executes pm): absent -> silent skip; present -> 'pm merge install' fail-loud (a broken CLI surfaces non-zero). Fleet standard, tracked in companion pm-cli-website-5cx1; validated real-data on canary pm-beads PR #40. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review Fleet-standard portable prepare-hook rollout (companion pm-cli-website-5cx1). Script is byte-identical to the canary pm-beads#40, which passed full CI + CodeRabbit + Sourcery review — replaces the guarded POSIX |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 11 minutes. |
Address Greptile findings on the fan-out wave — make the PATH-presence scan match shell command resolution: - reject non-executable candidates (directories / non-exec files) via statSync().isFile() + accessSync(X_OK) on POSIX, so a stray `pm` dir or data file no longer makes `execSync` fail the whole install (P2 "Existence Is Not Executability"); - treat an empty POSIX PATH entry as the current directory instead of dropping it (P1 "Empty PATH Entry Gets Dropped"); - strip surrounding double quotes from Windows PATH entries before join() (P2 "Quoted PATH Entry Skips CLI"). Re-validated real-data: present->wire; absent->skip; broken pm->fail-loud; pm-dir/non-exec-pm on PATH->skip (no fail-loud); empty-entry+pm-in-cwd->runs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed a PATH-resolution hardening commit (reject non-executable candidates, treat empty POSIX PATH entry as CWD, strip Windows quoted entries) addressing the Greptile findings from the fan-out wave. Re-review please: @coderabbitai review |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Rate Limit Exceeded
|
Portable Node-based merge-driver prepare hook (cross-shell)
Replaces the guarded POSIX prepare hook with a Node script so
npm install/npm ciwire pm-cli's field-aware Git merge drivers identically on POSIX shellsand Windows
cmd.exe. Fleet-standard rollout (all 18 repos).Why
On the
xydxmerge-driver harmonization wave two bots independently flagged theguarded POSIX form
if command -v pm >/dev/null 2>&1; then pm merge install; fi:Greptile (P1) — Windows
cmd.exe(npm's default script shell) cannot parseif/fi, sonpm install/npm cifails atprepareon native Windows evenwhen
pmis present; CodeRabbit — recommended a portable Node-based check.The bare form conversely breaks POSIX
--omit=dev. Only a Node guard is correcton all platforms (npm invokes
node <file>the same way on both shells).Change
scripts/prepare-merge-driver.mjs— resolvespmpresence by scanningPATH (PATHEXT-aware on Windows), never executing pm: absent → silent skip
(production /
--omit=dev), present →pm merge installfail-loud (a brokenor incompatible CLI surfaces a non-zero exit, not a silent skip).
package.json—prepare→node scripts/prepare-merge-driver.mjs.README.md— merge-driver note harmonized to the portable Node form.Script intentionally not in
package.jsonfiles:prepareonly runs from a fullcheckout (local-dev / git-install / publish), never for npm-registry consumers.
Validation (real-data)
present + tracker → exit 0 (drivers wired); absent (PATH stripped) → exit 0
(skip); present + broken pm → exit 1 (fail-loud);
sh -c→ identical. The scriptis byte-identical to the canary pm-beads#40,
which passed full CI + CodeRabbit + Sourcery review.
Tracking
pm-cli-website-5cx1(fleet-wide 18-repo portable-hook rollout)🤖 Generated with Claude Code
Summary by cubic
Replaced the POSIX-only prepare hook with a portable
nodescript sonpm install/npm ciconsistently wirepm-climerge drivers on POSIX and Windowscmd.exe. Hardened PATH detection (PATHEXT-aware, handles quoted entries and empty POSIX components, ignores non-executable files) and cleanly skips on production/--omit=dev; satisfies Linear pm-cli-website-5cx1.scripts/prepare-merge-driver.mjs: scansPATH(PATHEXT-aware) without executingpm; treats empty POSIX entries as.and strips quotes on Windows; rejects dirs/non-exec files; runspm merge installif found (fail-loud), otherwise no-op.package.jsonpreparetonode scripts/prepare-merge-driver.mjsand aligned README notes.Written for commit 614e0b2. Summary will update on new commits.