sr-search-replace 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,144 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Search and Replace (sr) utility will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [6.0.0] - 2024-01-12
9
+
10
+ ### Added
11
+
12
+ #### Core Features
13
+ - **Session-based rollback system**: Complete restoration of all files modified in a session
14
+ - Unique session IDs with nanosecond precision
15
+ - Full metadata tracking including original command, search/replace strings
16
+ - One-command rollback: `sr --rollback`
17
+ - Specific session restoration: `sr --rollback=sr.backup.20240112_143022`
18
+ - Backup listing with session information: `sr --rollback-list`
19
+
20
+ #### Binary File Detection
21
+ - **Multi-layer binary file detection algorithm**:
22
+ - Layer 1: Fast grep heuristic on first N bytes (configurable)
23
+ - Layer 2: File utility MIME type analysis (if available)
24
+ - Layer 3: Fallback detection with safety-first approach
25
+ - Three detection methods: `multi_layer` (default), `file_only`, `grep_only`
26
+ - Configurable binary check size: `--binary-check-size=N`
27
+ - Explicit `--binary` flag required for binary file processing
28
+ - Safe defaults prevent accidental corruption
29
+
30
+ #### Session Management
31
+ - Session metadata tracking and persistent storage
32
+ - Modified file list tracking per session
33
+ - Session archive structure with metadata files
34
+ - Session-specific backup directories with unique identifiers
35
+ - Backup retention management: `--max-backups=N`
36
+ - Interactive rollback confirmation with timeout
37
+
38
+ #### Enhanced Logging & Reporting
39
+ - Detailed debug mode with execution traces
40
+ - Verbose mode with progress reporting
41
+ - Color-coded console output for better readability
42
+ - Comprehensive statistics display
43
+ - Session information in summary report
44
+ - Rollback debugging with multi-method file discovery
45
+
46
+ ### Changed
47
+
48
+ #### Architecture
49
+ - Improved file processing pipeline with multiple discovery modes
50
+ - Better handling of large file sets with progress reporting
51
+ - More robust error handling and recovery mechanisms
52
+ - Enhanced backup directory structure with metadata tracking
53
+
54
+ #### Performance
55
+ - Optimized binary detection for faster file scanning
56
+ - Efficient session metadata management
57
+ - Better handling of large backup sets
58
+ - Improved rollback performance with parallelization support
59
+
60
+ #### User Experience
61
+ - More intuitive command-line argument parsing
62
+ - Better help and usage messages
63
+ - Clearer error messages with actionable guidance
64
+ - Session ID format now includes nanosecond precision
65
+ - Improved confirmation prompts with timeout
66
+
67
+ ### Fixed
68
+
69
+ - Resolved file list encoding issues in rollback operations
70
+ - Fixed permission preservation in edge cases
71
+ - Corrected whitespace handling in file paths
72
+ - Improved BSD sed compatibility
73
+ - Better handling of special characters in replacement strings
74
+ - Fixed array initialization in bash 4.0
75
+
76
+ ### Security
77
+
78
+ - Added path validation to prevent directory traversal attacks
79
+ - Implemented control character filtering in file lists
80
+ - Added dangerous pattern detection (../,/proc/*,/sys/*,/dev/*)
81
+ - Enhanced permission handling for backup directories
82
+ - Safer temporary file creation with proper cleanup
83
+
84
+ ### Documentation
85
+
86
+ - Comprehensive README with examples and best practices
87
+ - Detailed option reference with all parameters
88
+ - Environment variable documentation
89
+ - Troubleshooting guide with common issues
90
+ - Performance characteristics and benchmarks
91
+ - Advanced usage scenarios
92
+
93
+ ## [5.x.x] - Previous Versions
94
+
95
+ Previous releases focused on basic search and replace functionality with initial backup support.
96
+ Those versions did not include the advanced rollback system and multi-layer binary detection
97
+ features present in version 6.0.0.
98
+
99
+ ### Key Differences from v5
100
+
101
+ - v6.0.0 introduces session-based backups vs simple file-level backups in v5
102
+ - v6.0.0 adds one-command rollback capability not available in v5
103
+ - v6.0.0 implements multi-layer binary detection vs simple method in v5
104
+ - v6.0.0 includes comprehensive metadata tracking in v5 was minimal
105
+ - v6.0.0 adds named backup directories with clear session identification
106
+
107
+ ## Version Support
108
+
109
+ Current versions:
110
+ - **6.0.0**: Latest stable release (recommended)
111
+ - **5.x.x**: Deprecated, no longer maintained
112
+
113
+ ## Migration Guide
114
+
115
+ For users upgrading from version 5:
116
+
117
+ 1. Download version 6.0.0
118
+ 2. Replace sr script: `cp sr.sh /usr/local/bin/sr`
119
+ 3. Existing backups from v5 will be managed separately from v6 sessions
120
+ 4. No data loss - all previous backups remain accessible
121
+ 5. New releases will use v6 session format
122
+
123
+ ## Planned Features (Roadmap)
124
+
125
+ - [ ] Parallel processing for large file sets
126
+ - [ ] Remote execution via SSH
127
+ - [ ] Git integration for automatic commits
128
+ - [ ] Web UI for non-technical users
129
+ - [ ] Configuration file support (.srrc)
130
+ - [ ] Statistics database for historical tracking
131
+ - [ ] Notification system for long operations
132
+ - [ ] Custom filter plugins
133
+
134
+ ## Known Issues
135
+
136
+ No known critical issues in v6.0.0
137
+
138
+ For feature requests and bug reports, please visit:
139
+ https://github.com/paulmann/sr-search-replace/issues
140
+
141
+ ---
142
+
143
+ **Last Updated**: 2024-01-12
144
+ **Maintained By**: Mikhail Deynekin (@paulmann)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Mikhail Deynekin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.