Skip to content

Commit d2020ab

Browse files
committed
feat!: Release v5.0.0 with clean parameter API and intelligent defaults
BREAKING CHANGES: - Renamed -Recursive to -DisableRecursion for cleaner API design - Renamed -EnableTagSorting to -DisableTagSorting for consistent naming - Recursive mode and tag temporal sorting now enabled by default API Improvements: - Clean switch parameter design following PowerShell best practices - Intuitive defaults requiring zero configuration for optimal behavior - Consistent naming conventions for all disable flags - No more confusing switch parameters with $true defaults User Experience Enhancements: - Zero configuration: .\LsiGitCheckout.ps1 provides optimal behavior - Intelligent defaults: recursive processing and tag sorting out-of-the-box - Better parameter documentation with clear purposes and defaults - Simplified mental model for new users Migration Guide: - OLD: .\LsiGitCheckout.ps1 -Recursive -EnableTagSorting - NEW: .\LsiGitCheckout.ps1 (default behavior) - OLD: .\LsiGitCheckout.ps1 -Recursive:$false -EnableTagSorting:$false - NEW: .\LsiGitCheckout.ps1 -DisableRecursion -DisableTagSorting Backward Compatibility: - All JSON configuration files work without modification - Functionality remains identical with improved parameter usability - Clear migration path documented in README and changelog Documentation Updates: - Updated README.md with new parameter examples and migration guide - Enhanced changelog with comprehensive v5.0.0 breaking changes documentation - Updated all code examples to reflect new API design - Added migration section for v4.x to v5.0 upgrade path Technical Implementation: - Converted switch logic to use script-level variables for cleaner code - Updated all internal references to use new parameter names - Enhanced logging to reflect default behavior status - Maintained all existing functionality while improving API design Benefits: - Cleaner PowerShell API following established conventions - Reduced cognitive load for new users (no parameters needed) - Better alignment with PowerShell community standards - Improved documentation clarity and examples
1 parent 4da62fa commit d2020ab

File tree

3 files changed

+143
-76
lines changed

3 files changed

+143
-76
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ All notable changes to LsiGitCheckout will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.0.0] - 2025-01-17
9+
10+
### Breaking Changes
11+
- **BREAKING**: Renamed `-Recursive` parameter to `-DisableRecursion` for cleaner API design
12+
- **BREAKING**: Renamed `-EnableTagSorting` parameter to `-DisableTagSorting` for consistent naming conventions
13+
- **BREAKING**: Recursive mode and tag temporal sorting are now enabled by default (no parameters needed for optimal behavior)
14+
15+
### Added
16+
- Clean parameter API following PowerShell switch parameter best practices
17+
- Intuitive default behavior requiring zero configuration for most use cases
18+
- Consistent naming conventions for all disable flags
19+
20+
### Changed
21+
- Switch parameters now use proper naming conventions (disable flags instead of enable flags with defaults)
22+
- Default behavior provides intelligent recursive processing and tag sorting out-of-the-box
23+
- Enhanced user experience with no required parameters for optimal functionality
24+
25+
### Migration
26+
- **Old**: `.\LsiGitCheckout.ps1 -Recursive -EnableTagSorting`**New**: `.\LsiGitCheckout.ps1` (default)
27+
- **Old**: `.\LsiGitCheckout.ps1 -Recursive:$false -EnableTagSorting:$false`**New**: `.\LsiGitCheckout.ps1 -DisableRecursion -DisableTagSorting`
28+
- All JSON configuration files work without modification
29+
- Functionality remains identical with improved parameter usability
30+
831
## [4.2.0] - 2025-01-17
932

1033
### Added

LsiGitCheckout.ps1

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
1010
SSH credentials are managed through a separate git_credentials.json file.
1111
12-
With the -Recursive option, it can discover and process nested dependencies.
12+
With the -DisableRecursion option, it processes only the main dependency file.
1313
14-
With the -EnableTagSorting option, it fetches tag dates from repositories and uses
15-
them to properly sort API Compatible Tags temporally, removing manual ordering requirements.
14+
With the -DisableTagSorting option, it requires manual temporal ordering in "API Compatible Tags".
1615
.PARAMETER InputFile
1716
Path to the JSON configuration file. Defaults to 'dependencies.json' in the script directory.
1817
.PARAMETER CredentialsFile
@@ -23,27 +22,33 @@
2322
Enables debug logging to a timestamped log file.
2423
.PARAMETER Verbose
2524
Increases verbosity of output messages.
26-
.PARAMETER Recursive
27-
Enables recursive dependency discovery and processing. Enabled by default.
25+
.PARAMETER DisableRecursion
26+
Disables recursive dependency discovery and processing. By default, recursive mode is enabled.
2827
.PARAMETER MaxDepth
2928
Maximum recursion depth for dependency discovery. Defaults to 5.
3029
.PARAMETER ApiCompatibility
3130
Default API compatibility mode when not specified in dependencies. Can be 'Strict' or 'Permissive'. Defaults to 'Permissive'.
32-
.PARAMETER EnableTagSorting
33-
Enables automatic tag temporal sorting using git tag dates. This removes the requirement for manual temporal ordering in "API Compatible Tags" and provides intelligent tag selection. Enabled by default.
31+
.PARAMETER DisableTagSorting
32+
Disables automatic tag temporal sorting. By default, intelligent tag temporal sorting using git tag dates is enabled, removing the requirement for manual temporal ordering in "API Compatible Tags".
3433
.EXAMPLE
3534
.\LsiGitCheckout.ps1
3635
.\LsiGitCheckout.ps1 -InputFile "C:\configs\myrepos.json" -CredentialsFile "C:\configs\my_credentials.json"
37-
.\LsiGitCheckout.ps1 -Recursive -MaxDepth 10
38-
.\LsiGitCheckout.ps1 -InputFile "repos.json" -EnableDebug -Recursive -ApiCompatibility Strict
39-
.\LsiGitCheckout.ps1 -Recursive -EnableTagSorting -Verbose
36+
.\LsiGitCheckout.ps1 -DisableRecursion -MaxDepth 10
37+
.\LsiGitCheckout.ps1 -InputFile "repos.json" -EnableDebug -ApiCompatibility Strict
38+
.\LsiGitCheckout.ps1 -DisableTagSorting -Verbose
4039
.NOTES
41-
Version: 4.2.0
40+
Version: 5.0.0
4241
Last Modified: 2025-01-17
4342
4443
This script uses PuTTY/plink for SSH authentication. SSH keys must be in PuTTY format (.ppk).
4544
Use PuTTYgen to convert OpenSSH keys to PuTTY format if needed.
4645
46+
Changes in 5.0.0:
47+
- BREAKING: Changed -Recursive to -DisableRecursion (recursive mode enabled by default)
48+
- BREAKING: Changed -EnableTagSorting to -DisableTagSorting (tag sorting enabled by default)
49+
- Cleaner API with proper switch parameter naming conventions
50+
- Recursive processing and intelligent tag sorting enabled by default
51+
4752
Changes in 4.2.0:
4853
- Made -Recursive and -EnableTagSorting default (enabled by default)
4954
- Optimized tag sorting to only run when needed during API compatibility resolution
@@ -121,7 +126,7 @@ param(
121126
[switch]$EnableDebug,
122127

123128
[Parameter()]
124-
[switch]$Recursive = $true,
129+
[switch]$DisableRecursion,
125130

126131
[Parameter()]
127132
[int]$MaxDepth = 5,
@@ -131,11 +136,11 @@ param(
131136
[string]$ApiCompatibility = 'Permissive',
132137

133138
[Parameter()]
134-
[switch]$EnableTagSorting = $true
139+
[switch]$DisableTagSorting
135140
)
136141

137142
# Script configuration
138-
$script:Version = "4.2.0"
143+
$script:Version = "5.0.0"
139144
$script:ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
140145
$script:ErrorFile = Join-Path $ScriptPath "LsiGitCheckout_Errors.txt"
141146
$script:DebugLogFile = Join-Path $ScriptPath ("debug_log_{0}.txt" -f (Get-Date -Format "yyyyMMddHHmm"))
@@ -147,7 +152,8 @@ $script:RepositoryDictionary = @{}
147152
$script:CurrentDepth = 0
148153
$script:ProcessedDependencyFiles = @()
149154
$script:DefaultApiCompatibility = $ApiCompatibility
150-
$script:EnableTagSorting = $EnableTagSorting
155+
$script:RecursiveMode = -not $DisableRecursion
156+
$script:EnableTagSorting = -not $DisableTagSorting
151157

152158
# Initialize error file
153159
if (Test-Path $script:ErrorFile) {
@@ -1059,7 +1065,7 @@ function Invoke-GitCheckout {
10591065
$wasNewClone = $false
10601066

10611067
# Check if we should skip this repository (already checked out with compatible API)
1062-
if ($Recursive) {
1068+
if ($script:RecursiveMode) {
10631069
$checkoutResult = Update-RepositoryDictionary -Repository $Repository -DependencyFilePath $DependencyFilePath
10641070
if ($checkoutResult -eq $true) {
10651071
Write-Log "Skipping repository '$repoUrl' - already checked out with compatible API" -Level Info
@@ -1309,7 +1315,7 @@ function Invoke-GitCheckout {
13091315

13101316
# Fetch tag dates only if tag sorting is enabled and this is recursive mode
13111317
# This optimization only fetches tag dates when they might be needed for conflict resolution
1312-
if ($script:EnableTagSorting -and $Recursive) {
1318+
if ($script:EnableTagSorting -and $script:RecursiveMode) {
13131319
Write-Log "Tag sorting enabled, fetching tag dates for repository: $repoUrl" -Level Info
13141320
$tagDates = Get-GitTagDates -RepoPath $absoluteBasePath
13151321

@@ -1433,7 +1439,7 @@ function Invoke-GitCheckout {
14331439
Pop-Location
14341440

14351441
# Mark repository as checked out in dictionary
1436-
if ($Recursive -and $script:RepositoryDictionary.ContainsKey($repoUrl)) {
1442+
if ($script:RecursiveMode -and $script:RepositoryDictionary.ContainsKey($repoUrl)) {
14371443
$script:RepositoryDictionary[$repoUrl].AlreadyCheckedOut = $true
14381444
$script:RepositoryDictionary[$repoUrl].CheckoutFailed = $false
14391445
}
@@ -1457,7 +1463,7 @@ function Invoke-GitCheckout {
14571463
}
14581464

14591465
# Mark repository as failed in dictionary
1460-
if ($Recursive -and $script:RepositoryDictionary.ContainsKey($repoUrl)) {
1466+
if ($script:RecursiveMode -and $script:RepositoryDictionary.ContainsKey($repoUrl)) {
14611467
$script:RepositoryDictionary[$repoUrl].CheckoutFailed = $true
14621468
}
14631469

@@ -1526,7 +1532,7 @@ function Process-DependencyFile {
15261532
$checkoutSucceeded = $false
15271533

15281534
# Track if this repository exists before processing
1529-
if ($Recursive) {
1535+
if ($script:RecursiveMode) {
15301536
$repoUrl = $repo.'Repository URL'
15311537
$wasNewCheckout = -not $script:RepositoryDictionary.ContainsKey($repoUrl)
15321538

@@ -1543,7 +1549,7 @@ function Process-DependencyFile {
15431549
$checkoutSucceeded = $true
15441550

15451551
# Add to checked out repos list for recursive processing
1546-
if ($Recursive -and $Depth -lt $MaxDepth -and $checkoutSucceeded) {
1552+
if ($script:RecursiveMode -and $Depth -lt $MaxDepth -and $checkoutSucceeded) {
15471553
# Only process if this was a new checkout or required a tag update
15481554
if ($wasNewCheckout) {
15491555
$repoInfo = $script:RepositoryDictionary[$repo.'Repository URL']
@@ -1671,7 +1677,7 @@ Successful: $($script:SuccessCount)
16711677
Failed: $($script:FailureCount)
16721678
"@
16731679

1674-
if ($Recursive) {
1680+
if ($script:RecursiveMode) {
16751681
$summary += "`nRecursive Mode: Enabled"
16761682
$summary += "`nMax Depth: $MaxDepth"
16771683
$summary += "`nDefault API Compatibility: $($script:DefaultApiCompatibility)"
@@ -1727,7 +1733,7 @@ try {
17271733
Write-Log "Manual temporal ordering required for API Compatible Tags" -Level Info
17281734
}
17291735

1730-
if ($Recursive) {
1736+
if ($script:RecursiveMode) {
17311737
Write-Log "Recursive mode: ENABLED (default) with max depth: $MaxDepth" -Level Info
17321738
} else {
17331739
Write-Log "Recursive mode: DISABLED" -Level Info
@@ -1790,7 +1796,7 @@ try {
17901796
$checkedOutRepos = Process-DependencyFile -DependencyFilePath $InputFile -Depth 0
17911797

17921798
# If recursive mode is enabled, process nested dependencies
1793-
if ($Recursive -and $checkedOutRepos.Count -gt 0) {
1799+
if ($script:RecursiveMode -and $checkedOutRepos.Count -gt 0) {
17941800
Process-RecursiveDependencies -CheckedOutRepos $checkedOutRepos -DependencyFileName $dependencyFileName -CurrentDepth 1
17951801
}
17961802

0 commit comments

Comments
 (0)