pub fn write(project_root: &Path, content: &str) -> Result<()>
Write the lock atomically; a no-op when the content is unchanged.