# Changelog

All notable changes to this project will be documented in this file.

## [1.2.1] - 2026-06-12

### Fixed
- **Memory Optimization**: Refactored the `Overwriter` to reuse a single heap-allocated buffer across all write passes, reducing memory fragmentation and allocation overhead during multi-pass shredding.
- **Robust Signal Handling**: Improved the `Ctrl+C` handler to allow for an immediate forced exit on a second interruption event, providing users with more control during long-running operations.

## [1.2.0] - 2026-06-12

### Added
- **True Streaming Parallelism**: Re-engineered the recursive traversal engine to use `par_bridge`, allowing the tool to process files as they are discovered. This ensures a constant, ultra-low RAM footprint regardless of the number of files (e.g., millions of files).
- **Aggressive OS Cache Bypassing**: Implemented platform-specific hints to bypass OS filesystem caches more aggressively.
  - **Linux**: Utilizes `posix_fadvise` with `POSIX_FADV_DONTNEED` to minimize cache pollution.
  - **macOS**: Utilizes `F_NOCACHE` to disable kernel-level caching for targeted files.
- **Dual-Pass Progress Accuracy**: Implemented a lightweight initial walk to count files for precise progress bar initialization without loading paths into memory.

### Changed
- Refactored `Shredder` engine to be fully stream-based for industrial-grade performance.
- Improved cross-platform reliability for hardware-level data commitment.

## [1.1.1] - 2026-06-11

### Fixed
- **Visual Race Condition**: Resolved an issue where the progress bar would occasionally display incomplete counts (e.g., 95/100) before being finalized.
- **Progress Synchronization**: Added explicit finalization calls to ensure the UI reaches 100% before clearing.

## [1.1.0] - 2026-06-10


### Added
- **Modern UI Refactor**: Completely overhauled the terminal output to match the `rustc` / `cargo` aesthetic.
- **Styled Labels**: Introduced bold, color-coded labels (e.g., `Shredding`, `Finished`, `Error`) for better readability.
- **Enhanced Progress Reporting**: Refined `indicatif` templates for a cleaner, more professional look.
- **New Dependency**: Integrated `console` crate for robust, cross-platform terminal styling.

### Changed
- Standardized all console output through a centralized `UI` styling engine.
- Replaced manual ANSI escape codes with a type-safe styling API.

## [1.0.1] - 2026-06-09

### Fixed
- **Filename Collision Retry**: Added retry logic to `obfuscate_filename` to handle extremely rare cases where a randomly generated filename might already exist.
- **Improved SSD TRIM Error Handling**: Now explicitly captures and reports I/O errors during hardware-level block deallocation on Linux.
- **Accurate Progress Reporting**: Fixed a bug where the progress bar count included excluded files, ensuring a precise file count during recursive operations.
- **High-Frequency Cancellation**: Added a cancellation check inside the byte-level comparison loop for better responsiveness during verification passes.

## [1.0.0] - 2026-06-08

### Added
- **Arch User Repository (AUR)**: Officially published to the AUR. Arch Linux users can now install the utility via `yay -S sys-shred`.
- **Official crates.io Release**: `sys-shred` is now officially available on crates.io and can be installed globally via `cargo install sys-shred`.
- **Production Stable**: Achieved v1.0.0 milestone. The tool is now considered production-ready with zero known bugs, zero compiler warnings, and full test coverage.
- **Symlink & Hardlink Safety**: Added safety checks to prevent accidental data destruction when targeting symbolic links. Only the link itself is removed.
- **Interactive Prompts**: Added a confirmation prompt before executing destructive actions. Can be bypassed using the new `--force` or `-f` flag.
- **Memory Efficiency**: Re-engineered the recursive traversal engine to use stream-based iterators (`par_bridge` compatible logic) instead of loading all paths into memory, allowing the tool to safely shred millions of files without RAM bloat.

## [0.4.0] - 2026-06-07

### Added
- **Professional Audit Logging**: Introduced a high-integrity forensic reporting system. Users can now generate detailed session reports using `--audit-log <PATH>`.
- **SSD TRIM/Discard Support**: Added `--trim` flag to send hardware-level deallocation commands (Linux/Windows), significantly improving anti-forensic reliability on Flash-based media.
- **Flexible Log Formats**: Support for both human-readable `Text` and machine-readable `JSON` audit logs via the `--audit-format` flag.
- **Detailed Event Tracking**: Reports capture per-file results including timestamps, methods used, and specific error messages for failed operations.

### Changed
- Refactored core orchestration to collect and summarize destruction events across parallel threads.

## [0.3.1] - 2026-06-07

### Added
- **Graceful Interruption**: Implemented signal handling (Ctrl+C) via `ctrlc` crate. The tool now catches interruption signals and cancels ongoing operations safely without leaving the terminal in an inconsistent state.
- **Cancellation-Aware Engine**: Refactored the core shredding engine and overwriting loops to respond immediately to cancellation signals, ensuring data destruction stops as soon as requested.

### Changed
- Improved robustness of the parallel traversal engine during high-load "chaos" scenarios.

## [0.3.0] - 2026-06-07

### Added
- **Multi-threaded Destruction**: Integrated `rayon` for parallel file shredding, significantly improving performance on multi-core systems.
- **Industry Standard Algorithms**: Added support for Zero-fill, US DoD 5220.22-M, and Gutmann (35-pass) erasure methods.
- **Dry-Run Mode**: Introduced `--dry-run` to simulate destruction sequences without modifying the filesystem.
- **Read-back Verification**: Added `--verify` flag to ensure hardware-level data persistence by reading back and comparing written buffers.
- **Glob Exclusions**: Added `--exclude` support for skipping specific files or directories using pattern matching.

### Changed
- Refactored UI to provide a cleaner aggregate progress view for parallel operations.
- Updated core engine to be thread-safe.
- Overhauled project documentation (README.md) to reflect new v0.3.0 capabilities and forensic standards.

## [0.2.1] - 2026-06-06

### Fixed
- Hardened recursive traversal: Now explicitly handles and reports filesystem errors (e.g., permission issues).
- Zero-panic UI: Implemented safe fallback for terminal progress styles.
- Removed unused imports to ensure clean compilation.

### Added
- Automated dependency management via GitHub Dependabot.
- Strict documentation enforcement with `#![deny(missing_docs)]`.

## [0.2.0] - 2026-06-06

### Added
- Recursive Directory Shredding: Securely destroy entire directory trees using the `-r` or `--recursive` flag.
- Integrated `walkdir` for robust filesystem traversal.
- Enhanced core engine to handle bottom-up directory removal after content destruction.

### Changed
- Updated CLI schema to support both file and directory targets.
- Refactored `Shredder` API to accommodate recursive operations.

## [0.1.0] - 2026-06-06

### Added
- Initial release of sys-shred: a professional secure file erasure utility.
- Modular core engine for cryptographic overwriting and hardware synchronization.
- Metadata obfuscation, filename randomization, and secure unlinking logic.
- Cross-platform installation infrastructure (`scripts/install.sh` and `scripts/install.ps1`).
- Professional CLI interface with interactive progress reporting.
- Formal Security Policy (`SECURITY.md`) and project hygiene configuration (`.editorconfig`).
- Comprehensive technical documentation and integration test suite.
- Continuous Integration workflow via GitHub Actions.
