From 663f2e5a2cfdad8a273fc668363c6aefa2cbe931 Mon Sep 17 00:00:00 2001 From: Ilya Dvorkin Date: Thu, 3 Jul 2025 15:18:19 +0300 Subject: [PATCH] Update documentation and bump version to 0.1.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add comprehensive exclude patterns documentation to README - Document new exclude pattern matching strategies - Update CLAUDE.md with exclude pattern examples and workflow updates - Add CHANGELOG.md with version history and recent improvements - Bump version to 0.1.10 for enhanced exclude pattern functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- CHANGELOG.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 22 ++++++++++++---- Cargo.toml | 2 +- README.md | 49 +++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+), 6 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8097790 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,73 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Fixed +- Enhanced exclude pattern matching to support substring matching, path component matching, and improved glob pattern support +- Exclude patterns now work consistently in both sort-only and regular diff modes +- Fixed issue where exclude patterns like `--exclude 'configgen'` had no effect + +## [0.1.8] - 2024-12-XX + +### Added +- Exclude patterns support for sort-only mode +- Ability to skip specific files during sorting using `--exclude` flag +- Configuration file support for exclude patterns + +### Changed +- Improved CLI documentation with exclude pattern examples + +## [0.1.7] - 2024-12-XX + +### Added +- Sort-only mode feature (`--sort-only` flag) +- Ability to sort YAML files without diff computation +- Support for recursive glob patterns (`**/*.yaml`) +- In-place sorting capability with `-i` flag + +### Changed +- Enhanced CLI with new sorting options +- Updated README with sort-only examples + +## [0.1.6] - 2024-12-XX + +### Added +- Regex path parser feature +- Enhanced path pattern matching + +### Changed +- Improved dependency versions +- Updated package lock file + +## [0.1.5] - 2024-12-XX + +### Added +- Initial crates.io publishing support +- CI/CD workflow improvements + +### Changed +- Dependency upgrades +- Code cleanup and optimization + +## [0.1.4] - 2024-12-XX + +### Fixed +- Package lock file updates +- Various bug fixes and improvements + +--- + +## Release Notes + +This project follows semantic versioning. Each release includes: +- **Added** for new features +- **Changed** for changes in existing functionality +- **Deprecated** for soon-to-be removed features +- **Removed** for now removed features +- **Fixed** for any bug fixes +- **Security** for security vulnerabilities \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 13a7018..7a58c8b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,6 +2,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +## Important Notes for Claude Code + +* Always commit as current user, not as `claude`. + ## Project Overview YABE (YAml Base Extractor) is a GitOps YAML organizer tool written in Rust. It computes common base configurations among multiple YAML files and generates differences for each file, reducing duplication in GitOps workflows. The tool supports quorum-based diffing, YAML sorting, and both configuration file and command-line interfaces. @@ -36,6 +40,12 @@ cargo run -- -i -r helm_values.yaml file1.yaml file2.yaml # Using path patterns cargo run -- -p "*.yaml" -p "configs/*.yaml" + +# Using exclude patterns to skip files +cargo run -- -p "**/*.yaml" --exclude "target" --exclude "*.tmp" + +# Sort-only mode with exclusions +cargo run -- --sort-only --sort-config-path ./sort-config.yaml -p "**/*.yaml" --exclude "target" ``` ## Architecture @@ -50,11 +60,12 @@ cargo run -- -p "*.yaml" -p "configs/*.yaml" ### Key Data Flow 1. **Input Processing**: Parse CLI args and config files, expand glob patterns -2. **YAML Loading**: Read and parse all input YAML files -3. **Base Merging**: If existing base provided, merge with each input file -4. **Diff Computation**: Compute diffs against read-only base (if provided) -5. **Quorum Processing**: Extract common base from diffs using quorum percentage -6. **Output Generation**: Write base file and per-file diffs (in-place or to output folder) +2. **File Filtering**: Apply exclude patterns to filter out unwanted files using multiple matching strategies +3. **YAML Loading**: Read and parse all remaining input YAML files +4. **Base Merging**: If existing base provided, merge with each input file +5. **Diff Computation**: Compute diffs against read-only base (if provided) +6. **Quorum Processing**: Extract common base from diffs using quorum percentage +7. **Output Generation**: Write base file and per-file diffs (in-place or to output folder) ### Configuration System The tool supports both command-line arguments and YAML configuration files. Config file values are overridden by command-line arguments. Key configuration options: @@ -62,6 +73,7 @@ The tool supports both command-line arguments and YAML configuration files. Conf - `base`: Existing base to merge with inputs - `quorum`: Percentage threshold for common base extraction - `sort_config_path`: YAML sorting rules configuration +- `exclude_patterns`: Patterns to exclude files during processing (supports substring, glob, and path component matching) ### Testing Structure Tests are organized by module: diff --git a/Cargo.toml b/Cargo.toml index b6d4921..bb4a39e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "yabe-gitops" description = "GitOps organizer" repository = "https://github.com/dvrkn/yabe" readme = "README.md" -version = "0.1.9" +version = "0.1.10" edition = "2021" keywords = ["gitops", "kubernetes", "argocd", "yaml", "helm"] license = "MIT" diff --git a/README.md b/README.md index a788177..f3425ae 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,55 @@ Use the --sort-only flag to only sort YAML files without performing any diffing # Sort files in-place while excluding terraform files ./yabe --sort-only --sort-config-path sort-config.yaml -p "./envs/**/*.yaml" --exclude "*.terraform.yaml" -i + +# Exclude files by directory name (any file with "target" in the path) +./yabe --sort-only --sort-config-path sort-config.yaml -p "**/*.yaml" --exclude "target" + +# Exclude multiple patterns - files in build directories and temp files +./yabe --sort-only --sort-config-path sort-config.yaml -p "**/*.yaml" --exclude "target" --exclude "build" --exclude "*.tmp" +``` + +### Exclude Patterns + +The `--exclude` option supports flexible pattern matching to skip unwanted files during processing. You can specify multiple exclude patterns, and files matching any pattern will be skipped. + +**Supported pattern types:** + +1. **Substring matching**: Excludes files containing the pattern anywhere in the path + ```bash + --exclude "target" # Excludes files with "target" in the path + --exclude "node_modules" # Excludes files with "node_modules" in the path + ``` + +2. **Glob patterns**: Standard file matching patterns + ```bash + --exclude "*.tmp" # Excludes all .tmp files + --exclude ".*" # Excludes hidden files + --exclude "test_*.yaml" # Excludes files starting with "test_" + ``` + +3. **Path component matching**: Matches against individual directories or filenames + ```bash + --exclude "build" # Excludes files in any "build" directory + --exclude "dist" # Excludes files in any "dist" directory + ``` + +4. **Full path glob matching**: Complex path patterns + ```bash + --exclude "*/temp/*" # Excludes files in any "temp" subdirectory + --exclude "target/**" # Excludes all files under target directory + ``` + +**Examples:** +```bash +# Exclude multiple directory types +./yabe -p "**/*.yaml" --exclude "target" --exclude "node_modules" --exclude ".git" + +# Exclude by file patterns and directories +./yabe -p "**/*.yaml" --exclude "*.terraform.yaml" --exclude "build" --exclude "dist" + +# Complex exclusion for GitOps environments +./yabe --sort-only -p "**/*.yaml" --exclude "target" --exclude ".argocd" --exclude "*.secret.yaml" ``` ### Using Configuration File