pi-windows-path-guard
v1.0.1
Published
Prevents Windows-native Pi file tools from silently writing to mangled paths when agents reuse Git Bash/MSYS paths like /c/Users/...
Downloads
43
Maintainers
Readme
pi-windows-path-guard
A tiny Pi extension for Windows users.
Problem
Pi may use Git Bash for shell commands. Git Bash reports paths as /c/Users/.... If an agent passes that path into Windows-native file tools (read, write, edit), Node.js can resolve it to C:\c\Users\... instead of C:\Users\....
This creates a false-success trap: the agent reports "Successfully wrote X bytes", but the file lands in a phantom tree that Windows applications cannot find.
Behavior
This extension guards Pi file tool calls before execution:
| Path format | Action |
|-------------|--------|
| /c/Users/... | Normalizes to C:\Users\... |
| /mnt/c/Users/... | Blocks in Windows-native mode |
| C:\c\Users\... | Blocks as a known mangled trap |
| C:\mnt\c\Users\... | Blocks as a known mangled trap |
| C:\Users\... | Allows native Windows paths |
| \\wsl.localhost\... | Allows intentional UNC access |
| \\wsl.localhost\Ubuntu-24.04\... | Allows WSL UNC paths |
Install
pi install npm:pi-windows-path-guardOr load directly for testing:
pi -e ./src/index.tsWhy
This prevents false-success writes where:
- Agent sees bash pwd as
/c/Users/DESKTOP/workspaces - Agent uses that path for write/read/edit
- File lands at
C:\c\Users\DESKTOP\workspaces\... - VLC, PowerShell, and Windows apps cannot find the file
Proof
Before (without extension):
write /c/Users/Me/workspace/file.txt "content"
→ write tool: "Successfully wrote 7 bytes"
→ actual location: C:\c\Users\Me\workspace\file.txt
→ PowerShell Test-Path C:\Users\Me\workspace\file.txt: FalseAfter (with extension):
write /c/Users/Me/workspace/file.txt "content"
→ extension normalizes to C:\Users\Me\workspace\file.txt
→ write tool: "Successfully wrote 7 bytes"
→ actual location: C:\Users\Me\workspace\file.txt
→ PowerShell Test-Path C:\Users\Me\workspace\file.txt: TrueBlocked paths:
write /mnt/c/Users/Me/workspace/wsl.txt
→ Blocked: "Blocked Windows path dialect trap: /mnt/c/... Use native Windows path C:\Users\..."
write C:\c\Users\Me\workspace\bad.txt
→ Blocked: "Blocked Windows path dialect trap: C:\c\... Use native Windows path C:\Users\..."Guarded Tools
readwriteeditgrepfindls
Security Note
This extension intercepts all file tool calls on Windows and may block or mutate paths. Review the source before installing third-party Pi packages.
Source: GitHub
License
MIT
