[PR #101] [MERGED] fix(hooks): add-to-path writes a POSIX root on Windows #125

Closed
opened 2026-10-15 20:53:37 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rehan-remade/universal-modder/pull/101
Author: @AltDoug
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @rehan-remade

Base: main ← Head: fix/hook-path-windows


📝 Commits (1)

  • 7ae20fb fix(hooks): add-to-path writes a POSIX root on Windows

📊 Changes

2 files changed (+20 additions, -0 deletions)

View changed files

📝 hooks/add-to-path.sh (+2 -0)
📝 tests/test_um.py (+18 -0)

📄 Description

On Windows, Claude Code passes ${CLAUDE_PLUGIN_ROOT} to the SessionStart hook as a drive path (C:/Users/.../universal-modder/0.2.0). hooks/add-to-path.sh writes it into CLAUDE_ENV_FILE as is:

export PATH="C:/Users/.../universal-modder/0.2.0/bin:$PATH"

Bash splits PATH on :, so that becomes two dead entries, C and /Users/.../bin. You can see them at the top of echo $PATH in every session. um still works only because Claude Code also adds the plugin's bin/ to PATH by itself.

Fix: when cygpath exists (Git Bash / MSYS), convert the root with cygpath -u first. Elsewhere nothing changes.

Tests: new test_path_hook_writes_a_posix_root (skipped where there's no cygpath; fails before, passes after on Windows); full suite 59 passed on Windows 11, Python 3.12. By hand: the hook given a C:/... root now writes export PATH="/.../bin:$PATH", and sourcing it makes um resolve.

Found and fixed with AI assistance (Claude Code); the repro and the fix were run by hand on Windows 11.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rehan-remade/universal-modder/pull/101 **Author:** [@AltDoug](https://github.com/AltDoug) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@rehan-remade](https://github.com/rehan-remade) **Base:** `main` ← **Head:** `fix/hook-path-windows` --- ### 📝 Commits (1) - [`7ae20fb`](https://github.com/rehan-remade/universal-modder/commit/7ae20fbb1d2011b8963d38c7121b6d1145298449) fix(hooks): add-to-path writes a POSIX root on Windows ### 📊 Changes **2 files changed** (+20 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `hooks/add-to-path.sh` (+2 -0) 📝 `tests/test_um.py` (+18 -0) </details> ### 📄 Description On Windows, Claude Code passes `${CLAUDE_PLUGIN_ROOT}` to the SessionStart hook as a drive path (`C:/Users/.../universal-modder/0.2.0`). `hooks/add-to-path.sh` writes it into `CLAUDE_ENV_FILE` as is: ``` export PATH="C:/Users/.../universal-modder/0.2.0/bin:$PATH" ``` Bash splits PATH on `:`, so that becomes two dead entries, `C` and `/Users/.../bin`. You can see them at the top of `echo $PATH` in every session. `um` still works only because Claude Code also adds the plugin's `bin/` to PATH by itself. Fix: when `cygpath` exists (Git Bash / MSYS), convert the root with `cygpath -u` first. Elsewhere nothing changes. Tests: new `test_path_hook_writes_a_posix_root` (skipped where there's no `cygpath`; fails before, passes after on Windows); full suite 59 passed on Windows 11, Python 3.12. By hand: the hook given a `C:/...` root now writes `export PATH="/.../bin:$PATH"`, and sourcing it makes `um` resolve. Found and fixed with AI assistance (Claude Code); the repro and the fix were run by hand on Windows 11. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 20:53:37 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rehan-remade/universal-modder#125
No description provided.