Skip to content

Releases: BernCarney/bydefault

Release v0.5.5

16 Jun 21:54
42cd9b3

Choose a tag to compare

🔧 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.whl

Standalone 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

10 Jun 03:50
9fde4ab

Choose a tag to compare

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

  • #38: Bugfix/merge multiline values again
  • #37: fix: Improve handling of multiline values in config merging

Release v0.5.3

26 Mar 05:44

Choose a tag to compare

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-local flag 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 distribution
  • bydefault-0.5.3-py3-none-any.whl: Python wheel package
  • byDefault-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.gz

Usage 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/ta

Notes

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

24 Mar 17:05

Choose a tag to compare

What's New

  • New Feature: Added --include-removed flag to the scan command to optionally show files and stanzas that exist in default but not in local
  • Enhancement: Changed the default behavior of the scan command to hide removed items, which aligns with the merge command approach
  • Testing: Added comprehensive tests for the new functionality

Assets

  • bydefault-0.5.2.tar.gz - Python package source distribution
  • bydefault-0.5.2-py3-none-any.whl - Python wheel package
  • byDefault-v0.5.2-standalone.tar.gz - Standalone executable (Linux)

v0.5.1

19 Mar 21:11
267bfcc

Choose a tag to compare

  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
  2. Added thorough test coverage for various edge cases
  3. Bumped the version from v0.5.0 to v0.5.1 in:
    • src/bydefault/init.py
    • pyproject.toml
  4. Built the package with the correct versioning using:
    • uv build --all-packages
    • pyinstaller --noconfirm src/bydefault/cli.py --name byDefault-0.5.1
  5. 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

19 Mar 01:11

Choose a tag to compare

Release Notes for v0.5.0 - Configuration Merging

New Features

  • New merge command 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

12 Mar 21:13

Choose a tag to compare

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

  1. 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
  2. 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]"
    • 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
  3. 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
  4. 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

  1. 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
  2. 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
  3. 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
  4. Validation

    • Verify structural integrity after sorting
    • Compare key counts before and after to ensure no data loss
    • Check for parser errors after regenerating files
  5. 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

  1. Core Files

    • src/bydefault/commands/sort.py: Main sort command implementation
    • src/bydefault/models/sort_models.py: Data models for sorting operations
    • src/bydefault/models/stanza.py: Stanza classification and ordering models
    • src/bydefault/utils/sort_utils.py: Utility functions for sorting
    • src/bydefault/utils/parser.py: Enhanced parser for comment-preserving parsing
    • src/bydefault/utils/writer.py: File writer that maintains structure
    • tests/commands/test_sort.py: Tests for the sort command
    • tests/utils/test_sort_utils.py: Tests for sorting utilities
  2. Key Classes and Functions

    • sort(): Main command function in commands/sort.py
    • ConfigSorter: 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

  1. 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
  2. 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
  3. 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

  1. Basic Sorting

    bydefault sort inputs.conf
  2. Sorting with Backup

    bydefault sort --backup props.conf transforms.conf
  3. Dry Run Mode

    bydefault sort --dry-run --verbose app.conf
  4. Sort with Verification

    bydefault sort --verify props.conf
  5. Batch Sorting

    bydefault sort *.conf

Acceptance Criteria

  1. 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
  2. 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
  3. 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
  4. Performance

    • Sorting large files completes in reasonable time
    • Memory usage remains efficient for large files

Future Enhancements (Post-Phase 4)

  1. Additional Sorting Options

    • Custom stanza ordering rules
    • Preservation of specific settings order
    • Configuration files for persistent sort preferences
  2. Integration with Other Commands

    • Automatic sorting after merge operations
    • Sorting during validation processes
  3. 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

27 Feb 01:47

Choose a tag to compare

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

29 Nov 03:07

Choose a tag to compare

byDefault v0.1.0 - CLI Framework Release

13 Nov 18:50

Choose a tag to compare

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

@BernCarney

Next Steps

Phase 2 will focus on implementing file detection and change reporting functionality, building upon the established CLI framework.