claudewheel v0.20.1 /claudewheel.fsutil
Edit
On this page

Atomic file writes that preserve or enforce target permissions.

#claudewheel.fsutil

#claudewheel.fsutil

Atomic file writes that preserve or enforce target permissions.

#write_text_atomic

python
def write_text_atomic(path: Path, text: str) -> None

Atomic tmp+rename text write that preserves the target's file mode.

The rename replaces the target inode, so without a chmod any pre-existing restrictive mode on the target would be silently reset to the umask default on every update. Fresh targets (no existing file to stat) keep the umask default.

#write_json_atomic

python
def write_json_atomic(path: Path, data) -> None

Atomic JSON write (indent=2, trailing newline), preserving file mode.

#write_json_atomic_secret

python
def write_json_atomic_secret(path: Path, data) -> None

Atomic JSON write for secret-holding files: target is always 0600.

The tmp file is created 0600 from the start (never umask-readable, even transiently) and chmod'd to exactly 0600 before the rename in case the umask stripped owner bits at creation.