1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! File system utilities for cross-platform file operations
//!
//! This module provides safe, atomic file operations designed to work consistently
//! across Windows, macOS, and Linux. All functions handle platform-specific
//! differences such as path lengths, permissions, and separators.
//!
//! # Key Features
//!
//! - **Atomic operations**: Files are written atomically to prevent corruption
//! - **Cross-platform**: Handles Windows long paths, Unix permissions, and path separators
//! - **Parallel operations**: Async versions for processing multiple files concurrently
//! - **Safety**: Path traversal prevention and safe path handling
//! - **Checksum validation**: SHA-256 checksums for data integrity
//!
//! # Examples
//!
//! ```rust,no_run
//! use agpm_cli::utils::fs::{ensure_dir, safe_write, calculate_checksum};
//! use std::path::Path;
//!
//! # fn example() -> anyhow::Result<()> {
//! // Create directory structure
//! ensure_dir(Path::new("output/agents"))?;
//!
//! // Write file atomically
//! safe_write(Path::new("output/config.toml"), "[sources]")?;
//!
//! // Verify file integrity
//! let checksum = calculate_checksum(Path::new("output/config.toml"))?;
//! println!("File checksum: {}", checksum);
//! # Ok(())
//! # }
//! ```
//!
//! # Platform Considerations
//!
//! ## Windows
//! - Supports long paths (>260 characters) using UNC prefixes
//! - Handles case-insensitive file systems
//! - Manages file permissions and attributes correctly
//!
//! ## Unix/Linux
//! - Preserves file permissions during copy operations
//! - Handles case-sensitive file systems
//! - Supports symbolic links appropriately
//!
//! ## macOS
//! - Handles HFS+ case-insensitive by default
//! - Supports extended attributes
//! - Works with case-sensitive APFS volumes
// Module declarations
// Re-export commonly used items from each module
// Directory operations
pub use ;
// Atomic write operations
pub use ;
// Path utilities
pub use ;
// File discovery
pub use find_files;
// Temporary directories
pub use TempDir;
// Metadata operations
pub use ;
// Parallel operations
pub use ;
// Format-specific I/O
pub use ;