Releases: BernCarney/bydefault
Release v0.5.5
🔧 What's New
Multiline Formatting Fix for Merge Command
- Fixed: Default-only stanzas now preserve their backslash continuations during merge operations
- Improved: Metadata file path handling in merge operations
- Maintained: All existing functionality preserved with no breaking changes
This release addresses an issue where stanzas that existed only in the default configuration file would lose their multiline formatting (backslash continuations) when merged, while stanzas present in both local and default files maintained their formatting correctly.
📦 Release Artifacts
| Artifact | Size | Description |
|---|---|---|
bydefault-0.5.5.tar.gz |
151 KB | Source distribution for pip/uv installation |
bydefault-0.5.5-py3-none-any.whl |
62 KB | Python wheel package |
byDefault-v0.5.5-standalone.tar.gz |
17 MB | Standalone executable (no Python required) |
🛠️ Installation
Package Installation
# Install from source distribution
uv tool install ./bydefault-0.5.5.tar.gz
# Or install from wheel
pip install ./bydefault-0.5.5-py3-none-any.whlStandalone Executable
# Extract and run standalone executable
tar -xzf byDefault-v0.5.5-standalone.tar.gz
./dist/byDefault-0.5.5/byDefault-0.5.5 --version🔍 Technical Details
- Python Requirement: ≥3.11
- Dependencies: Updated to latest versions
- Build System: Hatchling with PyInstaller for standalone builds
- Compatibility: Maintains backward compatibility with existing configurations
🚀 Upgrade Notes
This is a patch release that can be safely upgraded from v0.5.4 without any configuration changes or breaking modifications to existing workflows.
Full Changelog: Compare changes from v0.5.4...v0.5.5
Release v0.5.4
Bug Fixes
Configuration Merging Improvements
- Enhanced multiline value handling: Added proper handling of multiline values with continuation characters in configuration files
- Embedded comment support: Added support for embedded comments within multiline values
- Improved REPLACE mode: Fixed issue with merge command's REPLACE mode not completely replacing default files as expected
Code Quality & Testing
- Refactored ConfigMerger: Improved the write() method for better multiline value detection and processing
- Comprehensive test coverage: Added extensive test cases for complex multiline configurations and merge operations
- REPLACE behavior verification: Added additional tests to verify correct REPLACE mode behavior
Technical Details
This release focuses on improving the reliability and accuracy of configuration file merging, particularly when dealing with complex multiline configurations that include continuation characters and embedded comments. The REPLACE mode functionality has been corrected to ensure complete replacement of default files as intended.
Pull Requests Included
Release v0.5.3
Release Notes for byDefault v0.5.3
Overview
Version 0.5.3 enhances the merge command by automatically cleaning up merged files in the local directory, improving the overall workflow for Splunk TA development.
New Features
- Automatic Local File Cleanup: After a successful merge, files in the local directory are now automatically removed to prevent confusion and duplication
- Keep Local Option: Added a new
--keep-localflag to preserve files in the local directory after merging if desired
Improvements
- Enhanced Feedback: Added detailed messaging about files removed from local directory
- Dry Run Warnings: Added informative messages about what would happen to local files in dry run mode
- Better Error Handling: Improved handling of file removal errors with appropriate warnings
Files Included in Release
bydefault-0.5.3.tar.gz: Python package source distributionbydefault-0.5.3-py3-none-any.whl: Python wheel packagebyDefault-v0.5.3-standalone.tar.gz: Standalone executable archive
Installation
# Using UV (recommended)
uv tool install --reinstall-package bydefault ./dist/bydefault-0.5.3.tar.gz
# Using pip (alternative)
pip install ./dist/bydefault-0.5.3.tar.gzUsage Example
# Default behavior (creates backup and removes local files after merge)
bydefault merge path/to/ta
# To keep local files after merging
bydefault merge --keep-local path/to/ta
# Dry run to preview changes without modifying files
bydefault merge --dry-run --verbose path/to/taNotes
This release includes a behavior change where merged files are now removed from the local directory by default. Use the --keep-local flag if you want to maintain the previous behavior of preserving local files.
Release v0.5.2
What's New
- New Feature: Added
--include-removedflag to thescancommand to optionally show files and stanzas that exist in default but not in local - Enhancement: Changed the default behavior of the
scancommand to hide removed items, which aligns with themergecommand approach - Testing: Added comprehensive tests for the new functionality
Assets
bydefault-0.5.2.tar.gz- Python package source distributionbydefault-0.5.2-py3-none-any.whl- Python wheel packagebyDefault-v0.5.2-standalone.tar.gz- Standalone executable (Linux)
v0.5.1
- Fixed the stanza detection issue in the scan command by:
- Adding an _is_stanza_header helper function that correctly identifies genuine stanza headers
- Improving _parse_conf_file to properly handle multiline values with continuation characters
- Fixing square bracket detection in command contexts
- Added thorough test coverage for various edge cases
- Bumped the version from v0.5.0 to v0.5.1 in:
- src/bydefault/init.py
- pyproject.toml
- Built the package with the correct versioning using:
- uv build --all-packages
- pyinstaller --noconfirm src/bydefault/cli.py --name byDefault-0.5.1
- Created an updated Version Management cursor rule that includes guidance for updating version numbers in file names.
Full Changelog: v0.5.0...v0.5.1
v0.5.0
Release Notes for v0.5.0 - Configuration Merging
New Features
- New
mergecommand for merging changes from local directory into default directory - Support for both merge and replace modes
- Automatic backup creation during merge operations
- Structure and comment preservation during merging
- Dry-run capability for previewing changes
- Integration with Configuration Sorter
Improvements
- Updated documentation for all commands
- Added comprehensive command documentation to README.md
- Improved build process with PyInstaller integration
- Added proper environment setup for development
Technical Details
- Version bumped to 0.5.0
- Added PyInstaller as development dependency
- Updated build process to create standalone executable
- Integration with other components like scan and sort
Files
- Source Package: bydefault-0.5.0.tar.gz
- Wheel Package: bydefault-0.5.0-py3-none-any.whl
- Standalone: byDefault-v0.5.0-standalone.tar.gz
v0.4.0
Phase 4: Configuration Sorting
Overview
Phase 4 implements configuration file sorting while maintaining structure and comments. This phase builds upon the file detection system from Phase 3 to provide intelligent sorting of configuration files for improved readability and maintainability.
Core Requirements
Sorting Framework
-
Command Structure
@cli.command() @click.option("--verbose", is_flag=True, help="Show detailed output") @click.option("--dry-run", is_flag=True, help="Show what would be done without making changes") @click.option("--backup", is_flag=True, help="Create backup before sorting") @click.option("--verify", is_flag=True, help="Verify file structure after sort") @click.argument("files", nargs=-1, required=True, type=click.Path(exists=True)) def sort(verbose: bool, dry_run: bool, backup: bool, verify: bool, files: tuple[str, ...]) -> None: """Sort configuration files maintaining structure and comments. The sort command organizes stanzas and settings within Splunk configuration files while preserving comments and structure. """ # Implementation details here
-
Sort Functionality
- Sort stanzas according to Splunk's logical priority order:
- Primary Order (Highest to Lowest Priority):
- Global settings (no stanza header)
- Default stanza: Exact match "[default]"
- Global wildcard stanzas: Match pattern "[*::attribute]"
- Specific type stanzas: All "[type::*]" and "[type::attribute]" patterns
- Secondary Order (within specific type groups):
- Wildcard attribute "[type::*]"
- Wildcard-prefixed attribute "[type::*-attribute]"
- Specific attribute "[type::attribute]"
- Primary Order (Highest to Lowest Priority):
- Sort settings alphabetically within each stanza
- Maintain all comments and their associations with stanzas/settings
- Support options for customizing sort behavior
- Handle multiple files in a single command
- Sort stanzas according to Splunk's logical priority order:
-
Preservation Requirements
- Maintain all comments with specific association rules:
- Comments directly above stanza: Associated with that stanza
- Comments after stanza header: Prompt for association
- Comments directly above key=value: Associated with that pair
- Inline value comments: Move with the value
- Comments followed by blank line and another stanza: Associated with previous stanza block
- Preserve blank lines between stanzas for readability
- Keep comment-to-setting associations intact
- Retain the original file encoding and line endings
- Maintain all comments with specific association rules:
-
Safety Features
- Include a dry-run mode to preview changes without modifying files
- Offer backup option to create copies before sorting
- Verification option to validate file structure after sorting
- Handle errors gracefully with informative messages
Technical Specifications
-
Parser Enhancements
- Extend the configuration parser from Phase 3 to track comments and their relationships to settings/stanzas
- Create data structures that preserve the comment associations during sorting
- Implement stanza type detection for proper classification and sorting
-
Sorting Algorithms
- Implement priority-based sorting for stanzas according to Splunk's logical order
- Implement alpha-sorting for settings within stanzas
- Support custom sort orders for special stanzas (e.g., [default] always first)
- Allow for special handling of certain configuration files based on type
-
Output Generation
- Create a mechanism to rewrite files while maintaining formatting
- Support different line endings (CRLF/LF) based on the original file
- Ensure proper handling of encoding during read/write operations
-
Validation
- Verify structural integrity after sorting
- Compare key counts before and after to ensure no data loss
- Check for parser errors after regenerating files
-
Processing Scope
- Support both single file and full TA sorting
- Apply to configuration and metadata files only
- Maintain consistent sorting across all TAs
- Support integration with merge operations
Implementation Guidelines
File Structure
-
Core Files
src/bydefault/commands/sort.py: Main sort command implementationsrc/bydefault/models/sort_models.py: Data models for sorting operationssrc/bydefault/models/stanza.py: Stanza classification and ordering modelssrc/bydefault/utils/sort_utils.py: Utility functions for sortingsrc/bydefault/utils/parser.py: Enhanced parser for comment-preserving parsingsrc/bydefault/utils/writer.py: File writer that maintains structuretests/commands/test_sort.py: Tests for the sort commandtests/utils/test_sort_utils.py: Tests for sorting utilities
-
Key Classes and Functions
sort(): Main command function in commands/sort.pyConfigSorter: Main class handling the sorting process (in utils/sort_utils.py)CommentAwareParser: Parser that preserves comment relationships (in utils/parser.py)SortedConfigWriter: Writer that outputs sorted config while preserving structure (in utils/writer.py)StanzaType: Enum defining stanza classification types (in models/stanza.py)SortResult: Data class for sorting results (in models/sort_models.py)
Testing Strategy
-
Test Categories
- Unit tests for individual sorter components
- Integration tests for the complete sort process
- Property-based tests to verify sort invariants (e.g., key count preservation)
- Edge case tests for unusual file formats
-
Test Fixtures
- Sample configurations with varied complexity
- Files with different comment styles and placements
- Configurations with special format requirements
- Files with different encodings and line endings
- Examples of all stanza types and ordering scenarios
-
Validation Tests
- Verify stanza order matches expected order after sorting
- Confirm all comments are preserved in appropriate locations
- Check that blank line structure is maintained
- Ensure file validation succeeds after sorting
- Test correct handling of comments with ambiguous associations
Command Usage Examples
-
Basic Sorting
bydefault sort inputs.conf
-
Sorting with Backup
bydefault sort --backup props.conf transforms.conf
-
Dry Run Mode
bydefault sort --dry-run --verbose app.conf
-
Sort with Verification
bydefault sort --verify props.conf
-
Batch Sorting
bydefault sort *.conf
Acceptance Criteria
-
Sort Command Functions
- Command sorts stanzas according to Splunk's logical priority order
- Command sorts settings alphabetically within stanzas
- All command options function as described
- Multiple file handling works correctly
-
Structure Preservation
- All comments are preserved in correct positions according to association rules
- Blank line structure is maintained
- Special stanza ordering rules are followed
- User is prompted for ambiguous comment associations
-
Safety Features
- Dry-run mode shows changes without modifying files
- Backup functionality creates proper backups
- Verification correctly identifies any issues
- Error handling provides clear, actionable messages
-
Performance
- Sorting large files completes in reasonable time
- Memory usage remains efficient for large files
Future Enhancements (Post-Phase 4)
-
Additional Sorting Options
- Custom stanza ordering rules
- Preservation of specific settings order
- Configuration files for persistent sort preferences
-
Integration with Other Commands
- Automatic sorting after merge operations
- Sorting during validation processes
-
Advanced Features
- Comment reorganization options
- Setting grouping by functional area
- Batch directory processing with filters
Full Changelog: v0.3.0...v0.4.0
v0.3.0
Full Changelog: v0.2.0...v0.3.0
- Completion of Phase 3: File Detection
- TA directory structure validation
- Change detection between local and default directories
- Detailed file, stanza, and setting-level comparisons
- Various command options for customized scanning
v0.2.0: Version 0.2.0 - Complete Phase 2 Implementation
Full Changelog: v0.1.0...v0.2.0
Full Changelog: https://github.com/BernCarney/bydefault/commits/v0.2.0
byDefault v0.1.0 - CLI Framework Release
Overview
This initial release establishes the foundational CLI framework for byDefault, a Python-based tool for Splunk TA development and maintenance. Phase 1 implementation focuses on creating a robust and user-friendly command-line interface that will support future development phases.
Features
- Complete CLI framework implementation with comprehensive help system
- Consistent output formatting with Rich integration
- Global options for version information and verbosity control
- Development status indicators for planned functionality
- 100% test coverage for core CLI components
Installation
Install directly using UV:
$ uv tool install git+https://github.com/BernCarney/[email protected]Documentation Updates
- Added detailed installation instructions
- Included usage examples for planned commands
- Enhanced development setup documentation
- Updated project requirements and structure
Technical Improvements
- Upgraded UV to version 0.5.1
- Enhanced test coverage configuration
- Improved CLI context handling
- Added comprehensive test suite
Development Notes
- All Phase 1 success criteria met and verified
- Framework ready for Phase 2 implementation
- Test infrastructure established for future development
- Initial framework implementation
- Documentation improvements
- Test coverage enhancements
Contributors
Next Steps
Phase 2 will focus on implementing file detection and change reporting functionality, building upon the established CLI framework.