### Example Workflow for Generating and Applying Suggestions Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md This example demonstrates a typical workflow for using `helm-env-delta`, starting with a minimal configuration, generating suggestions, reviewing them, and finally executing the sync with a dry-run. ```bash # 1. Create minimal config with just source/destination cat > config.yaml < suggestions.yaml # 3. Review suggestions and copy relevant sections to config.yaml # 4. Test with dry-run helm-env-delta --config config.yaml --dry-run --diff # 5. Execute sync helm-env-delta --config config.yaml ``` -------------------------------- ### HelmEnvDelta CLI Examples Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md Practical examples demonstrating how to use the HelmEnvDelta CLI for various tasks. These examples cover validating configurations, getting suggestions, previewing changes, generating reports, and executing the synchronization process, including forcing overrides. ```bash # Validate configuration (shows warnings) hed --config config.yaml --validate # Get smart configuration suggestions hed --config config.yaml --suggest # Get only high-confidence suggestions hed --config config.yaml --suggest --suggest-threshold 0.7 # Preview files that will be synced hed --config config.yaml --list-files # Display resolved config (after inheritance) hed --config config.yaml --show-config # Preview with diff hed --config config.yaml --dry-run --diff # Visual HTML report hed --config config.yaml --diff-html # CI/CD integration (no colors) hed --config config.yaml --diff-json --no-color | jq '.summary' # Execute sync hed --config config.yaml # Force override stop rules hed --config config.yaml --force ``` -------------------------------- ### Clone and Setup HelmEnvDelta Repository Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/CONTRIBUTING.md Instructions for forking the HelmEnvDelta repository, cloning it locally, adding the upstream remote, installing dependencies, and verifying the setup. ```bash git clone https://github.com/YOUR_USERNAME/helm-env-delta.git cd helm-env-delta git remote add upstream https://github.com/BCsabaEngine/helm-env-delta.git npm install npm run all ``` -------------------------------- ### Run Example 3: Multi-Environment Chain (Shell Script) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This command navigates into the directory for the third example and executes a shell script named `sync-all.sh`. This example demonstrates progressive promotion through different environments (Dev → UAT → Prod) with cumulative transforms. ```bash cd example/3-multi-env-chain ./sync-all.sh ``` -------------------------------- ### Automate Multi-Stage Sync with Shell Script Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/3-multi-env-chain/README.md This shell script automates the entire multi-environment synchronization process, starting from Dev to UAT and then to Production. It includes prompts for confirmation at each stage, ensuring controlled progression through the deployment pipeline. ```bash cd example-3-multi-env-chain chmod +x sync-all.sh ./sync-all.sh ``` -------------------------------- ### Vitest Test Structure Example Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/CONTRIBUTING.md Demonstrates the use of Vitest with the describe/it pattern for structuring tests. It includes setup (beforeEach) and teardown (afterEach) mocks, and examples of testing both successful execution and error conditions using Arrange-Act-Assert. ```typescript import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; describe('MyModule', () => { beforeEach(() => { vi.clearAllMocks(); }); afterEach(() => { vi.restoreAllMocks(); }); it('should handle valid input correctly', () => { // Arrange const input = 'test'; // Act const result = myFunction(input); // Assert expect(result).toBe('expected'); }); it('should throw error for invalid input', () => { // Arrange const input = ''; // Act & Assert expect(() => myFunction(input)).toThrow(); }); }); ``` -------------------------------- ### Multi-Service GitOps Configuration Example Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md An example HelmEnvDelta configuration for a multi-service GitOps setup. It synchronizes Helm charts from a UAT environment to production, skipping sensitive production-specific settings like namespaces and resource limits, and transforming environment-specific URLs. ```yaml source: './helm/uat' destination: './helm/prod' skipPath: '**/*.yaml': - 'metadata.namespace' - 'resources.limits' - 'spec.replicas' transforms: '**/*.yaml': content: - find: '-uat\b' replace: '-prod' ``` -------------------------------- ### Run Example 1: Config Inheritance (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This command executes the first example demonstrating config inheritance. It uses `helm-env-delta` with a specified configuration file and includes `--dry-run` and `--diff` flags to show changes without applying them. ```bash helm-env-delta --config example/1-config-inheritance/config.uat-to-prod.yaml --dry-run --diff ``` -------------------------------- ### Run Example 2: Stop Rules Demonstration (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This command runs the second example, which showcases all five stop rule types and how they block execution upon violation. It uses a specific configuration file and includes `--dry-run` and `--diff` flags. ```bash helm-env-delta --config example/2-stop-rules/config.yaml --dry-run --diff ``` -------------------------------- ### Preview and Execute Dev to UAT Sync with helm-env-delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/3-multi-env-chain/README.md This command previews the changes for the Dev to UAT synchronization using the specified configuration file. It then executes the actual synchronization, applying transformations and updates between the development and UAT environments. ```bash helm-env-delta --config example-3-multi-env-chain/config.dev-to-uat.yaml --dry-run --diff helm-env-delta --config example-3-multi-env-chain/config.dev-to-uat.yaml ``` -------------------------------- ### Preview and Execute UAT to Prod Sync with helm-env-delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/3-multi-env-chain/README.md This command previews the changes for the UAT to Production synchronization, including any defined stop rules. It then executes the synchronization, applying transformations and updates while enforcing production safeguards. ```bash helm-env-delta --config example-3-multi-env-chain/config.uat-to-prod.yaml --dry-run --diff helm-env-delta --config example-3-multi-env-chain/config.uat-to-prod.yaml ``` -------------------------------- ### Run Example 4: Prune Mode Behavior (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This command executes the fourth example, demonstrating file deletion behavior based on the `prune` setting. It uses a specific configuration file with `prune: true` and includes `--dry-run` and `--diff` flags. ```bash helm-env-delta --config example/4-prune-mode/config.with-prune.yaml --dry-run --diff ``` -------------------------------- ### Integrating HelmEnvDelta into GitHub Actions CI/CD Pipeline Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md Provides an example GitHub Actions workflow for integrating HelmEnvDelta into a CI/CD pipeline. It covers installing the tool, validating syncs using --dry-run and --diff-json with jq for programmatic analysis, executing the sync, and committing changes. ```yaml - name: Install HelmEnvDelta run: npm install -g helm-env-delta - name: Validate sync run: | helm-env-delta --config config.yaml --dry-run --diff-json > report.json # Check for stop rule violations VIOLATIONS=$(cat report.json | jq '.stopRuleViolations | length') if [ "$VIOLATIONS" -gt 0 ]; then echo "Stop rule violations detected!" cat report.json | jq '.stopRuleViolations' exit 1 fi - name: Execute sync run: helm-env-delta --config config.yaml - name: Commit changes run: | git add . git commit -m "Automated sync [skip ci]" git push ``` -------------------------------- ### Example Suggested Stop Rules (YAML) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This YAML snippet shows example output from the `--suggest` flag, specifically for suggested stop rules. It includes a `type` and `path`, along with a comment indicating detected version changes. ```yaml # Suggested Stop Rules stopRules: '**/*.yaml': - type: 'semverMajorUpgrade' path: 'image.tag' # Detected version changes: v1.2.3 → v2.0.0 ``` -------------------------------- ### HelmEnvDelta Typical Workflow Steps Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This section outlines a typical workflow for using HelmEnvDelta, from previewing changes to executing the sync and integrating with Git. It provides a step-by-step guide with corresponding CLI commands for each stage. ```bash # 1. Preview changes hed --config config.yaml --dry-run --diff # 2. Review in browser hed --config config.yaml --diff-html # 3. Execute sync hed --config config.yaml # 4. Git workflow git add prod/ git commit -m "Sync UAT to Prod" git push origin main ``` -------------------------------- ### Example Suggested Transforms (YAML) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This YAML snippet shows example output from the `--suggest` flag, specifically for suggested transforms. It includes a `find` and `replace` pattern with confidence score and occurrence count. ```yaml # Suggested Transforms transforms: '**/*.yaml': content: - find: 'uat-cluster' replace: 'prod-cluster' # Confidence: 95% (42 occurrences across 12 files) ``` -------------------------------- ### Example of Heuristic Pattern Suggestion and Refinement Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md This example demonstrates how heuristic analysis can automatically detect patterns, such as finding and replacing 'uat-db.internal' with 'prod-db.internal' in YAML files. The suggested pattern, identified with high confidence, can then be manually refined with more specific criteria like word boundaries. ```yaml # Heuristics detected this pattern automatically (semantic matching): transforms: '**/*.yaml': content: - find: 'uat-db\.internal' replace: 'prod-db.internal' # 95% confidence, 42 occurrences (boosted by 'uat/prod' semantic pattern) # You refine it with word boundaries: transforms: '**/*.yaml': content: - find: '\buat-db\.internal\b' replace: 'prod-db.internal' ``` -------------------------------- ### Transform File Format Example for helm-env-delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md Provides an example of the expected format for external transform files used by helm-env-delta. These files contain literal string replacements for content transformations. ```yaml # transforms/common.yaml - literal string replacements staging: production stg: prod staging-db.internal: production-db.internal ``` -------------------------------- ### Example Stop Rule File Format (Array of Regex) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/5-external-files/README.md This YAML snippet shows the format for an external file containing regex patterns for stop rules, intended for use with the `regexFile` directive. It defines an array of regular expressions, where each pattern is used to validate values. This example specifically blocks versions starting with '0.', as well as alpha and beta releases. ```yaml # patterns-forbidden-versions.yaml - '^0\..*' - '.*-alpha.*' - '.*-beta.*' ``` -------------------------------- ### Install HelmEnvDelta CLI Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt Installs the HelmEnvDelta CLI tool globally using npm. Requires Node.js version 22 or higher and npm version 9 or higher. ```bash npm install -g helm-env-delta ``` -------------------------------- ### Get Configuration Suggestions with HelmEnvDelta CLI Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt Utilizes heuristic analysis to suggest transforms and stop rules. Options include getting all suggestions, filtering by confidence threshold, and saving suggestions to a file. ```bash # Get configuration suggestions helm-env-delta --config config.yaml --suggest # Get only high-confidence suggestions (threshold 0-1) helm-env-delta --config config.yaml --suggest --suggest-threshold 0.7 # Save suggestions to file for review helm-env-delta --config config.yaml --suggest > suggestions.yaml ``` -------------------------------- ### Generate Configuration Suggestions with helm-env-delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md The --suggest flag uses heuristic analysis to automatically discover and suggest configuration patterns from files. This is useful when starting from scratch, discovering patterns, saving time, or auditing configurations. The output can be redirected to a file for review and refinement. ```bash # 1. Start with heuristic suggestions (tune threshold as needed) helm-env-delta --config minimal-config.yaml --suggest --suggest-threshold 0.5 > suggestions.yaml # 2. Review suggestions and pick high-confidence patterns from heuristic analysis # 3. Add to your config with refinements cat suggestions.yaml >> config.yaml # 4. Manually add complex/business-specific rules that heuristics can't detect # 5. Test thoroughly helm-env-delta --config config.yaml --dry-run --diff ``` -------------------------------- ### CI Workflow for Environment Sync with Helm Env Delta Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt This GitHub Actions workflow automates the synchronization of environments using Helm Env Delta. It checks out code, sets up Node.js, installs the tool, validates changes, and commits/pushes any modifications. It includes a check for stop rule violations before executing the sync. ```yaml name: Environment Sync on: push: branches: [main] jobs: sync: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' - name: Install HelmEnvDelta run: npm install -g helm-env-delta - name: Validate and Preview run: | helm-env-delta --config config.yaml --dry-run --diff-json > report.json # Check for stop rule violations VIOLATIONS=$(cat report.json | jq '.stopRuleViolations | length') if [ "$VIOLATIONS" -gt 0 ]; then echo "Stop rule violations detected!" cat report.json | jq '.stopRuleViolations' exit 1 fi - name: Execute Sync run: helm-env-delta --config config.yaml - name: Commit Changes run: | git config user.name "github-actions" git config user.email "github-actions@github.com" git add . git diff --staged --quiet || git commit -m "Sync environments [skip ci]" git push ``` -------------------------------- ### Run UAT to Prod Sync with Helm Env Delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/1-config-inheritance/README.md Executes the synchronization from the user acceptance testing (UAT) environment to the production environment. This command includes a dry-run option for previewing changes. It copies files, transforms environment names, and demonstrates the stopRule validation for minimum replicas. ```bash # Dry-run to preview helm-env-delta --config example-1-config-inheritance/config.uat-to-prod.yaml --dry-run --diff # Execute sync helm-env-delta --config example-1-config-inheritance/config.uat-to-prod.yaml ``` -------------------------------- ### Minimal HelmEnvDelta Configuration Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md Shows a basic configuration file for HelmEnvDelta, specifying source and destination directories and a simple content transformation. This serves as a starting point for users to set up the tool. ```yaml source: './uat' destination: './prod' transforms: '**/*.yaml': content: - find: "-uat\b" replace: '-prod' ``` -------------------------------- ### Preview Files with --list-files in Helm Env Delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md This snippet shows how to use the --list-files flag in helm-env-delta to preview which files will be synced without processing them. It provides an example command and describes the output format, explaining when this feature is most useful for verifying glob patterns and filename transforms. ```bash helm-env-delta --config config.yaml --list-files ``` -------------------------------- ### CI/CD Integration - GitHub Actions Workflow (YAML) Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt Integrate HelmEnvDelta into automated pipelines using GitHub Actions. This example shows a basic workflow structure for running HelmEnvDelta checks. ```yaml # Example GitHub Actions workflow snippet # (Actual HelmEnvDelta command execution would be added here) jobs: validate: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 # Add steps here to install and run HelmEnvDelta ``` -------------------------------- ### Dry-Run Command for Safety Check (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/4-prune-mode/README.md A general example of how to perform a dry-run with Helm Env Delta. This command simulates the synchronization process without making any actual changes to the files, allowing users to preview additions, updates, and deletions. ```bash helm-env-delta --config config.yaml --dry-run --diff ``` -------------------------------- ### View Resolved Configuration with --show-config in Helm Env Delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md This snippet demonstrates how to use the --show-config flag in helm-env-delta to display the merged configuration after all 'extends' chains are resolved. It provides an example command and explains the use cases for debugging configuration inheritance and understanding the effective configuration. ```bash helm-env-delta --config config.yaml --show-config ``` -------------------------------- ### Parse HelmEnvDelta JSON Report with jq Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md These examples demonstrate how to use the `jq` command-line JSON processor to extract specific information from the HelmEnvDelta JSON report. This is useful for scripting and automating tasks based on the synchronization results. ```bash # Summary jq '.summary' report.json # Violations jq '.stopRuleViolations' report.json # Changed files jq '.files.changed[].path' report.json ``` -------------------------------- ### Analyzing Helm Env Delta JSON Reports with jq Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt This section demonstrates how to use the `jq` command-line tool to parse and analyze the JSON output generated by Helm Env Delta. It covers generating reports, getting summary counts, listing changed files, inspecting field-level changes, and filtering specific violations or changes. ```bash # Generate JSON report helm-env-delta --config config.yaml --dry-run --diff-json > report.json # Get summary counts cat report.json | jq '.summary' # Output: { "added": 2, "changed": 3, "deleted": 1, "unchanged": 15 } # List changed files cat report.json | jq '.files.changed[].path' # Show all field-level changes cat report.json | jq '.files.changed[].changes' # Get stop rule violations cat report.json | jq '.stopRuleViolations' # Filter changes to specific field cat report.json | jq '.files.changed[].changes[] | select(.path | contains("image.tag"))' ``` -------------------------------- ### Run Dev to UAT Sync with Helm Env Delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/1-config-inheritance/README.md Executes the synchronization from the development environment to the user acceptance testing (UAT) environment. This includes a dry-run option to preview changes before execution. It copies files, transforms environment names, and preserves specific metadata. ```bash # Dry-run to preview helm-env-delta --config example-1-config-inheritance/config.dev-to-uat.yaml --dry-run --diff # Execute sync helm-env-delta --config example-1-config-inheritance/config.dev-to-uat.yaml ``` -------------------------------- ### UAT to Production Environment Promotion Configuration Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt This YAML configuration outlines the synchronization from UAT to Production. It extends the previous configuration by adding more fields to skip, refining content transformations for production values, and implementing stricter stop rules, including versioning and numeric constraints. ```yaml # config.uat-to-prod.yaml source: './uat' destination: './prod' include: - '**/*.yaml' skipPath: '**/*.yaml': - 'metadata.namespace' - 'spec.replicas' - 'resources.limits' transforms: '**/*.yaml': content: - find: '-uat\b' replace: '-prod' - find: 'uat-cluster' replace: 'prod-cluster' - find: 'uat.internal' replace: 'prod.internal' stopRules: '**/*.yaml': - type: 'semverMajorUpgrade' path: 'image.tag' - type: 'semverDowngrade' path: 'image.tag' - type: 'numeric' path: 'spec.replicas' min: 3 max: 20 - type: 'regex' regex: '^v0.' # Block pre-release versions globally ``` -------------------------------- ### Basic helm-env-delta Command-Line Operations Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md Demonstrates the fundamental command-line usage of helm-env-delta for generating suggestions, performing dry-runs with diffs, and executing the synchronization process. It shows how to specify configuration files and thresholds. ```bash helm-env-delta --config config.yaml --suggest --suggest-threshold 0.5 > suggestions.yaml helm-env-delta --config config.yaml --dry-run --diff helm-env-delta --config config.yaml ``` -------------------------------- ### Bash Script for Progressive Environment Promotion Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt This bash script automates the progressive promotion of environment configurations from Development to UAT, and then from UAT to Production. It includes dry-run previews and prompts for user confirmation before executing each synchronization step. ```bash #!/bin/bash # sync-all.sh - Progressive environment promotion # Dev -> UAT echo "Syncing Dev to UAT..." helm-env-delta --config config.dev-to-uat.yaml --dry-run --diff read -p "Proceed with Dev->UAT sync? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then helm-env-delta --config config.dev-to-uat.yaml fi # UAT -> Prod echo "Syncing UAT to Prod..." helm-env-delta --config config.uat-to-prod.yaml --dry-run --diff read -p "Proceed with UAT->Prod sync? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then helm-env-delta --config config.uat-to-prod.yaml fi echo "Done!" ``` -------------------------------- ### Enable Smart Configuration Suggestions (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This command enables the smart configuration suggestion feature using the `--suggest` flag. It analyzes differences between environments and recommends configuration updates, including transform patterns and stop rules. ```bash helm-env-delta --config config.yaml --suggest ``` -------------------------------- ### JSONPath Syntax for SkipPath Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md Provides examples of JSONPath syntax used within 'skipPath' to selectively ignore specific fields or array elements during transformations. The `$.` prefix should be omitted. ```yaml skipPath: '**/*.yaml': - 'metadata.namespace' # Top-level field - 'spec.destination.namespace' # Nested field - 'spec.env[*].value' # Array wildcard - 'annotations[kubernetes.io/name]' # Object key ``` -------------------------------- ### Standard Workflow for Syncing Environments with HelmEnvDelta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md Outlines the standard workflow for syncing environments using HelmEnvDelta. It emphasizes the importance of using --dry-run and --diff for reviewing changes before execution, followed by committing the synchronized changes. ```bash # 1. Review changes with dry-run helm-env-delta --config config.yaml --dry-run --diff # 2. Generate detailed HTML report helm-env-delta --config config.yaml --dry-run --diff-html # 3. Execute sync if changes look good helm-env-delta --config config.yaml # 4. Review the actual changes made git diff # 5. Commit and push git add . git commit -m "Sync UAT changes to Production" git push ``` -------------------------------- ### HelmEnvDelta Project Structure Overview Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/CONTRIBUTING.md A visual representation of the HelmEnvDelta project's directory structure, highlighting key directories like src, bin, tests, and examples. ```tree helm-env-delta/ ├── src/ # Source code │ ├── utils/ # Utility functions │ ├── index.ts # Main entry point │ └── ... # Core modules ├── bin/ # CLI entry point ├── tests/ # Test files (mirrors src/ structure) ├── examples/ # Example configurations └── package.json # Project metadata ``` -------------------------------- ### Path Filtering Configuration (skipPath) in helm-env-delta Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md Illustrates how to use the `skipPath` configuration to preserve specific environment-specific fields during synchronization. This includes examples for top-level fields, nested fields, and array wildcards. ```yaml skipPath: 'apps/*.yaml': - 'metadata.namespace' - 'spec.destination.namespace' - 'spec.ignoreDifferences[*].jsonPointers' 'services/**/values.yaml': - 'microservice.env[*].value' - 'resources.limits' ``` -------------------------------- ### Dev to UAT Environment Promotion Configuration Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt This YAML configuration defines the synchronization process from a development environment to a User Acceptance Testing (UAT) environment. It includes skipping specific fields, applying content transformations to adjust environment-specific values, and defining stop rules to prevent certain types of changes. ```yaml # config.dev-to-uat.yaml source: './dev' destination: './uat' include: - '**/*.yaml' skipPath: '**/*.yaml': - 'metadata.namespace' - 'spec.replicas' transforms: '**/*.yaml': content: - find: '-dev\b' replace: '-uat' - find: 'dev-cluster' replace: 'uat-cluster' - find: 'dev.internal' replace: 'uat.internal' stopRules: '**/*.yaml': - type: 'semverDowngrade' path: 'image.tag' ``` -------------------------------- ### Get HelmEnvDelta Smart Suggestions Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md Analyzes differences and automatically suggests potential transforms and stop rules. The `--suggest-threshold` flag can be used to control the sensitivity of these suggestions, with a value between 0 and 1. ```bash # Get smart suggestions helm-env-delta --config config.yaml --suggest # Control suggestion sensitivity (0-1, default: 0.3) helm-env-delta --config config.yaml --suggest --suggest-threshold 0.7 ``` -------------------------------- ### Project Core Flow Diagram Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/CONTRIBUTING.md Visualizes the core processing flow of the Helm Env Delta project, starting from command-line parsing to generating reports. It shows the sequence of operations performed by the application. ```mermaid graph TD parseCommandLine → loadConfigFile → loadFiles → computeFileDiff → validateStopRules → updateFiles → reports ``` -------------------------------- ### Preview Sync Changes with HelmEnvDelta CLI Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt Demonstrates how to preview changes without modifying files using the `--dry-run` flag. Supports console diff, HTML report generation, and JSON output for CI/CD integration. ```bash # Preview changes with console diff helm-env-delta --config config.yaml --dry-run --diff # Generate HTML report for visual review helm-env-delta --config config.yaml --dry-run --diff-html # Output JSON for CI/CD integration helm-env-delta --config config.yaml --dry-run --diff-json > report.json ``` -------------------------------- ### Execute Sync with HelmEnvDelta CLI Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt Shows commands to perform actual file synchronization. Includes options for a standard sync with confirmation, forcing the sync to override stop rules, and skipping YAML formatting. ```bash # Execute sync (shows 2-second confirmation pause) helm-env-delta --config config.yaml # Force sync, overriding stop rule violations helm-env-delta --config config.yaml --force # Skip YAML formatting during sync helm-env-delta --config config.yaml --skip-format ``` -------------------------------- ### HelmEnvDelta Config Inheritance Example (YAML) Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt Illustrates configuration inheritance in HelmEnvDelta. A base configuration (`config.base.yaml`) defines shared settings, which are then extended by an environment-specific configuration (`config.uat-to-prod.yaml`) that includes source/destination, transforms, and stop rules. ```yaml # config.base.yaml - Shared settings include: - '**/*.yaml' skipPath: '**/*.yaml': - 'metadata.namespace' - 'metadata.labels.environment' outputFormat: indent: 2 keySeparator: true keyOrders: '**/*.yaml': - 'apiVersion' - 'kind' - 'metadata' - 'spec' ``` ```yaml # config.uat-to-prod.yaml - Extends base extends: './config.base.yaml' source: './uat' destination: './prod' transforms: '**/*.yaml': content: - find: '-uat\b' replace: '-prod' - find: 'uat-cluster' replace: 'prod-cluster' stopRules: '**/*.yaml': - type: 'numeric' path: 'spec.replicas' min: 3 ``` -------------------------------- ### TypeScript Function Style Example Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/CLAUDE.md Illustrates the preferred TypeScript function syntax within the HelmEnvDelta project. Shows both implicit and explicit return styles for arrow functions, adhering to project coding standards. ```typescript // Single-line returns use implicit return const fn = (): Type => expression; // Multi-statement functions use explicit braces const fn = (): Type => { stmt1; return expr; }; ``` -------------------------------- ### Syncing Multiple Environment Pairs with HelmEnvDelta Configs or Scripts Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md Illustrates methods for syncing multiple environment pairs with HelmEnvDelta. This can be achieved by creating separate configuration files for each pair or by using a shell script to iterate through multiple configurations. ```bash # UAT → Prod helm-env-delta --config config.uat-to-prod.yaml # Dev → Staging helm-env-delta --config config.dev-to-staging.yaml # Staging → UAT helm-env-delta --config config.staging-to-uat.yaml ``` ```bash #!/bin/bash for config in configs/*.yaml; do helm-env-delta --config "$config" --dry-run --diff done ``` -------------------------------- ### Review Deleted Files with JSON Output (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/4-prune-mode/README.md Demonstrates how to use the `--diff-json` flag with Helm Env Delta and pipe the output to `jq` to isolate and view the list of files marked for deletion. This is a key safety practice before executing destructive operations. ```bash helm-env-delta --config config.yaml --diff-json | jq '.files.deleted' ``` -------------------------------- ### Generate Configuration Suggestions with --suggest Flag Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/FAQ.md Utilize the `--suggest` flag for heuristic analysis to automatically generate transform patterns and stop rules. This feature analyzes differences between source and destination, suggests modifications, and provides confidence scores. ```bash helm-env-delta --config config.yaml --suggest helm-env-delta --config config.yaml --suggest --suggest-threshold 0.7 ``` -------------------------------- ### Configuring Prune Mode for Deleting Orphaned Files Source: https://context7.com/bcsabaengine/helm-env-delta/llms.txt This configuration enables prune mode in Helm Env Delta, which allows for the deletion of files in the destination that no longer exist in the source. The example shows how to set up the configuration file and preview or execute the prune operation. ```yaml # config.yaml source: './uat' destination: './prod' prune: true # Delete files in dest that don't exist in source include: - '**/*.yaml' ``` ```bash # Preview what would be deleted helm-env-delta --config config.yaml --dry-run --diff-json | jq '.files.deleted' # Execute with prune (careful!) helm-env-delta --config config.yaml ``` -------------------------------- ### HelmEnvDelta CLI Commands Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This section lists the available commands and options for the HelmEnvDelta CLI tool. It includes the main command, its short alias, and a detailed table of options with their descriptions, such as configuration file path, validation, suggestion generation, dry runs, diffing, and output control. ```bash helm-env-delta --config [options] hed --config [options] # Short alias ``` -------------------------------- ### Configure Config Inheritance and Transforms Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/README.md This configuration demonstrates how to set up configuration inheritance and environment-specific transforms. A base configuration defines common settings like include patterns, pruning, and skipped paths. Environment-specific configurations can extend the base, define source and destination directories, and apply content transformations, such as replacing text patterns. ```yaml include: ['**/*.yaml'] prune: true skipPath: 'apps/*.yaml': - 'spec.destination.namespace' outputFormat: indent: 2 keySeparator: true ``` ```yaml extends: './base.yaml' # Inherit base settings source: './uat' destination: './prod' transforms: '**/*.yaml': content: - find: '-uat\b' replace: '-prod' stopRules: 'services/**/values.yaml': - type: 'semverMajorUpgrade' path: 'image.tag' ``` -------------------------------- ### Get Deleted Files in JSON Format (Bash) Source: https://github.com/bcsabaengine/helm-env-delta/blob/main/example/4-prune-mode/README.md Uses Helm Env Delta with prune mode enabled and pipes the output to `jq` to specifically extract and display a JSON array of files that would be deleted. This is useful for programmatic review of deletion actions. ```bash helm-env-delta --config example-4-prune-mode/config.with-prune.yaml --diff-json | jq '.files.deleted' ```