Skip to content

feat: add case-insensitive filesystem guard hook#8

Open
yurukusa wants to merge 1 commit intokaranb192:mainfrom
yurukusa:add-case-sensitive-guard
Open

feat: add case-insensitive filesystem guard hook#8
yurukusa wants to merge 1 commit intokaranb192:mainfrom
yurukusa:add-case-sensitive-guard

Conversation

@yurukusa
Copy link
Copy Markdown

  • Adds case-sensitive-guard.js — detects case-insensitive filesystems (exFAT, NTFS, HFS+) and blocks rm/mkdir collisions
  • Inspired by anthropics/claude-code#37875 where rm -rf content on exFAT destroyed data because Content and content resolved to the same path
  1. Extracts target path from mkdir/rm commands
  2. Creates a temp file to probe if the filesystem is case-insensitive
  3. Scans parent directory for case-variant entries
  4. Exits 2 (block) if collision detected
  • node -c syntax check passes
  • Follows existing hook patterns (stdin JSON, exit codes)
  • Manual test on case-insensitive filesystem
    🤖 Generated with Claude Code

Detects case-insensitive filesystems (exFAT, NTFS, HFS+) and blocks
rm/mkdir that would collide due to case folding.
Real incident: GitHub #37875 — on exFAT, "Content" and "content"
resolve to the same path. rm -rf on one destroys both.
The hook:
1. Extracts target path from mkdir/rm commands
2. Tests if filesystem is case-insensitive (temp file probe)
3. Scans directory for case-variant collisions
4. Blocks with exit 2 if collision found
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant