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
//! Upgrade application module for applying dependency upgrades.
//!
//! **What**: Provides functionality to apply selected dependency upgrades to package.json
//! files with filtering, formatting preservation, and dry-run support.
//!
//! **How**: This module implements the logic to read package.json files, apply version
//! updates based on selection criteria, preserve JSON formatting, and write changes back
//! to disk. It supports both dry-run preview and actual file modification, with proper
//! error handling and detailed result reporting.
//!
//! **Why**: To enable safe, controlled application of dependency upgrades with fine-grained
//! filtering, ensuring package.json files remain properly formatted and changes are
//! transparent and reversible.
//!
//! # Module Structure
//!
//! - `applier`: Core logic for applying upgrades to package.json files
//! - `selection`: Selection criteria for filtering which upgrades to apply
//! - `result`: Result types containing applied upgrade details and statistics
//!
//! # Examples
//!
//! ```rust,ignore
//! use sublime_pkg_tools::upgrade::{
//! apply_upgrades, UpgradeSelection, detect_upgrades, DetectionOptions
//! };
//! use sublime_standard_tools::filesystem::FileSystemManager;
//! use std::path::PathBuf;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let fs = FileSystemManager::new();
//! let workspace_root = PathBuf::from(".");
//!
//! // Detect available upgrades
//! let options = DetectionOptions::all();
//! let available = detect_upgrades(&workspace_root, options, &fs).await?;
//!
//! // Preview patch upgrades only (dry-run)
//! let selection = UpgradeSelection::patch_only();
//! let preview = apply_upgrades(available.packages, selection.clone(), true, &fs).await?;
//! println!("Would upgrade {} dependencies", preview.applied.len());
//!
//! // Apply the upgrades for real
//! let result = apply_upgrades(available.packages, selection, false, &fs).await?;
//! println!("Upgraded {} dependencies in {} packages",
//! result.dependencies_upgraded(),
//! result.packages_modified());
//! # Ok(())
//! # }
//! ```
pub
pub
// Re-export public API
pub use apply_upgrades;
pub use apply_with_changeset;
pub use ;
pub use UpgradeSelection;