helm-env-delta 1.15.3 → 2.0.1
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/README.md +279 -95
- package/config.schema.json +496 -0
- package/dist/commandLine.d.ts +9 -11
- package/dist/commandLine.js +288 -101
- package/dist/config/ZodError.d.ts +2 -2
- package/dist/config/configFile.d.ts +1 -1
- package/dist/config/configFile.js +87 -41
- package/dist/config/configLoader.d.ts +2 -1
- package/dist/config/configMerger.d.ts +2 -1
- package/dist/consoleFormatter.d.ts +1 -1
- package/dist/exitCodes.d.ts +5 -0
- package/dist/exitCodes.js +8 -0
- package/dist/index.js +48 -43
- package/dist/logger.d.ts +3 -3
- package/dist/pipeline/fileDiff.d.ts +6 -5
- package/dist/pipeline/fileLoader.d.ts +2 -1
- package/dist/pipeline/fileLoader.js +2 -2
- package/dist/pipeline/fileUpdater.d.ts +4 -4
- package/dist/pipeline/fileUpdater.js +1 -1
- package/dist/pipeline/stopRulesValidator.d.ts +2 -1
- package/dist/pipeline/stopRulesValidator.js +2 -4
- package/dist/pipeline/yamlFormatter.d.ts +1 -1
- package/dist/pipeline/yamlFormatter.js +9 -9
- package/dist/reporters/consoleDiffReporter.d.ts +2 -2
- package/dist/reporters/htmlReporter.d.ts +4 -3
- package/dist/reporters/htmlReporter.js +20 -10
- package/dist/reporters/htmlTemplate.d.ts +1 -1
- package/dist/reporters/jsonReporter.d.ts +2 -2
- package/dist/reporters/treeRenderer.d.ts +1 -1
- package/dist/suggestionEngine.d.ts +2 -2
- package/dist/suggestionEngine.js +2 -2
- package/dist/utils/arrayMerger.d.ts +1 -1
- package/dist/utils/patternMatcher.d.ts +1 -1
- package/package.json +18 -17
package/README.md
CHANGED
|
@@ -58,9 +58,9 @@ HelmEnvDelta (`hed`) automates environment synchronization for GitOps workflows
|
|
|
58
58
|
|
|
59
59
|
📊 **Multiple Reports** - Console, HTML (visual, self-contained), and JSON (CI/CD) output formats. HTML reports include collapsible diff stats dashboard, stop rule violations table (dry-run only), synchronized side-by-side scrolling, copy diff buttons, file search, collapse/expand controls, jump-to-sidebar navigation, and auto-collapse for large file sets. Empty categories are automatically hidden.
|
|
60
60
|
|
|
61
|
-
🔍 **Discovery Tools** - Preview files (
|
|
61
|
+
🔍 **Discovery Tools** - Preview files (`list-files`), inspect config (`show-config`), filter by filename/content (`-f`), filter by change type (`-m`), filter to your own git changes (`--my`), validate with comprehensive warnings including unused pattern detection.
|
|
62
62
|
|
|
63
|
-
💡 **Smart Suggestions** - Heuristic analysis (
|
|
63
|
+
💡 **Smart Suggestions** - Heuristic analysis (`suggest` command) detects patterns and recommends transforms and stop rules automatically. Control sensitivity with `--suggest-threshold`.
|
|
64
64
|
|
|
65
65
|
🛡️ **Safety First** - Pre-execution summary, first-run tips, improved error messages with helpful examples.
|
|
66
66
|
|
|
@@ -82,6 +82,59 @@ npm install -g helm-env-delta
|
|
|
82
82
|
|
|
83
83
|
---
|
|
84
84
|
|
|
85
|
+
## ⚠️ Upgrading from v1.x to v2.0.0
|
|
86
|
+
|
|
87
|
+
v2.0.0 replaces flag-based invocation with proper subcommands. Update your scripts and aliases:
|
|
88
|
+
|
|
89
|
+
| v1.x (old) | v2.0.0 (new) |
|
|
90
|
+
| ---------------------------------- | -------------------------------- |
|
|
91
|
+
| `hed -c config.yaml` | `hed run -c config.yaml` |
|
|
92
|
+
| `hed -c config.yaml --validate` | `hed validate -c config.yaml` |
|
|
93
|
+
| `hed -c config.yaml --format-only` | `hed format -c config.yaml` |
|
|
94
|
+
| `hed -c config.yaml --suggest` | `hed suggest -c config.yaml` |
|
|
95
|
+
| `hed -c config.yaml --diff` | `hed diff -c config.yaml` |
|
|
96
|
+
| `hed -c config.yaml --diff-html` | `hed diff -c config.yaml --html` |
|
|
97
|
+
| `hed -c config.yaml --diff-json` | `hed diff -c config.yaml --json` |
|
|
98
|
+
| `hed -c config.yaml --list-files` | `hed list-files -c config.yaml` |
|
|
99
|
+
| `hed -c config.yaml --show-config` | `hed show-config -c config.yaml` |
|
|
100
|
+
|
|
101
|
+
**New in v2.0.0:**
|
|
102
|
+
|
|
103
|
+
- `validate --strict` — exits with code 4 if any warnings are found. Enables hard enforcement in CI/CD pipelines without needing to parse output.
|
|
104
|
+
- Console diff output is suppressed when `--html` or `--json` is used on the `diff` command — only one output format is produced at a time.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## ✍️ Editor Support
|
|
109
|
+
|
|
110
|
+
The package ships a `config.schema.json` that enables autocompletion, hover documentation, and inline validation in any editor with YAML JSON Schema support (VS Code, IntelliJ, Neovim + LSP, etc.).
|
|
111
|
+
|
|
112
|
+
### VS Code
|
|
113
|
+
|
|
114
|
+
Requires the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) (`redhat.vscode-yaml`).
|
|
115
|
+
|
|
116
|
+
**Option 1 — per-file modeline** (no project config needed):
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
# yaml-language-server: $schema=./node_modules/helm-env-delta/config.schema.json
|
|
120
|
+
source: './uat'
|
|
121
|
+
destination: './prod'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Option 2 — workspace settings** (applies automatically to all matching files):
|
|
125
|
+
|
|
126
|
+
Add to `.vscode/settings.json` in your project:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"yaml.schemas": {
|
|
131
|
+
"./node_modules/helm-env-delta/config.schema.json": ["config.yaml", "*.hed.yaml"]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
85
138
|
## 🎯 Quick Start
|
|
86
139
|
|
|
87
140
|
### 1️⃣ Create Config
|
|
@@ -106,30 +159,40 @@ transforms:
|
|
|
106
159
|
### 2️⃣ Preview Changes
|
|
107
160
|
|
|
108
161
|
```bash
|
|
109
|
-
hed -c config.yaml
|
|
162
|
+
hed diff -c config.yaml
|
|
110
163
|
```
|
|
111
164
|
|
|
112
165
|
### 3️⃣ Execute Sync
|
|
113
166
|
|
|
114
167
|
```bash
|
|
115
|
-
hed -c config.yaml
|
|
168
|
+
hed run -c config.yaml
|
|
116
169
|
```
|
|
117
170
|
|
|
118
171
|
### 4️⃣ Review in Browser
|
|
119
172
|
|
|
120
173
|
```bash
|
|
121
|
-
hed -c config.yaml
|
|
174
|
+
hed diff -c config.yaml --html
|
|
122
175
|
```
|
|
123
176
|
|
|
124
177
|
Self-contained HTML report — works offline, no CDN required. Includes collapsible diff stats dashboard, stop rule violations table (shown in dry-run mode), synchronized side-by-side scrolling, copy buttons, sidebar search, collapse/expand controls, and jump-to-sidebar navigation. File blocks auto-collapse when there are more than 10 files. Empty categories are automatically hidden.
|
|
125
178
|
|
|
179
|
+
To save the report as a file without opening a browser (e.g. for CI/CD artifacts), use `--report-output`:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Save to an exact path
|
|
183
|
+
hed diff -c config.yaml --report-output ./reports/2026-04-27.html
|
|
184
|
+
|
|
185
|
+
# Save to a directory (filename auto-generated)
|
|
186
|
+
hed diff -c config.yaml --report-output ./reports/
|
|
187
|
+
```
|
|
188
|
+
|
|
126
189
|
### 5️⃣ Get Smart Suggestions (Optional)
|
|
127
190
|
|
|
128
191
|
```bash
|
|
129
|
-
hed -c config.yaml
|
|
192
|
+
hed suggest -c config.yaml
|
|
130
193
|
|
|
131
194
|
# Control suggestion sensitivity (0-1, default: 0.3)
|
|
132
|
-
hed -c config.yaml --suggest
|
|
195
|
+
hed suggest -c config.yaml --suggest-threshold 0.7
|
|
133
196
|
```
|
|
134
197
|
|
|
135
198
|
Analyzes differences and suggests transforms and stop rules automatically with configurable confidence filtering.
|
|
@@ -233,7 +296,7 @@ The repository includes ready-to-run examples:
|
|
|
233
296
|
The simplest possible setup — syncs changes from UAT to Production while preserving environment-specific values.
|
|
234
297
|
|
|
235
298
|
```bash
|
|
236
|
-
helm-env-delta --config example/0-basic/config.yaml
|
|
299
|
+
helm-env-delta diff --config example/0-basic/config.yaml
|
|
237
300
|
```
|
|
238
301
|
|
|
239
302
|
### 📁 Example 1: Config Inheritance
|
|
@@ -241,7 +304,7 @@ helm-env-delta --config example/0-basic/config.yaml --dry-run --diff
|
|
|
241
304
|
Shows how to reuse base configuration across multiple environment pairs.
|
|
242
305
|
|
|
243
306
|
```bash
|
|
244
|
-
helm-env-delta --config example/1-config-inheritance/config.uat-to-prod.yaml
|
|
307
|
+
helm-env-delta diff --config example/1-config-inheritance/config.uat-to-prod.yaml
|
|
245
308
|
```
|
|
246
309
|
|
|
247
310
|
### 🚦 Example 2: Stop Rules
|
|
@@ -249,7 +312,7 @@ helm-env-delta --config example/1-config-inheritance/config.uat-to-prod.yaml --d
|
|
|
249
312
|
Demonstrates all 7 stop rule types and how violations block execution.
|
|
250
313
|
|
|
251
314
|
```bash
|
|
252
|
-
helm-env-delta --config example/2-stop-rules/config.yaml
|
|
315
|
+
helm-env-delta diff --config example/2-stop-rules/config.yaml
|
|
253
316
|
```
|
|
254
317
|
|
|
255
318
|
### ⛓️ Example 3: Multi-Environment Chain
|
|
@@ -266,7 +329,7 @@ cd example/3-multi-env-chain
|
|
|
266
329
|
File deletion behavior with `prune: true` vs `prune: false`.
|
|
267
330
|
|
|
268
331
|
```bash
|
|
269
|
-
helm-env-delta --config example/4-prune-mode/config.with-prune.yaml
|
|
332
|
+
helm-env-delta diff --config example/4-prune-mode/config.with-prune.yaml
|
|
270
333
|
```
|
|
271
334
|
|
|
272
335
|
### 📦 Example 5: External Files
|
|
@@ -274,7 +337,7 @@ helm-env-delta --config example/4-prune-mode/config.with-prune.yaml --dry-run --
|
|
|
274
337
|
Load transforms and stop rules from external YAML files for better organization and reusability.
|
|
275
338
|
|
|
276
339
|
```bash
|
|
277
|
-
helm-env-delta --config example/5-external-files/config.yaml
|
|
340
|
+
helm-env-delta diff --config example/5-external-files/config.yaml
|
|
278
341
|
```
|
|
279
342
|
|
|
280
343
|
**Features shown:**
|
|
@@ -288,7 +351,7 @@ helm-env-delta --config example/5-external-files/config.yaml --dry-run --diff
|
|
|
288
351
|
Set specific fields to constant values regardless of source/destination. Perfect for enforcing production settings.
|
|
289
352
|
|
|
290
353
|
```bash
|
|
291
|
-
helm-env-delta --config example/6-fixed-values/config.yaml
|
|
354
|
+
helm-env-delta diff --config example/6-fixed-values/config.yaml
|
|
292
355
|
```
|
|
293
356
|
|
|
294
357
|
**Features shown:**
|
|
@@ -298,25 +361,21 @@ helm-env-delta --config example/6-fixed-values/config.yaml --dry-run --diff
|
|
|
298
361
|
- Array filter operators (`env[name=LOG_LEVEL].value`)
|
|
299
362
|
- Combining with skipPath and transforms
|
|
300
363
|
|
|
301
|
-
### 🎨 Example 7: Format
|
|
364
|
+
### 🎨 Example 7: Format Command
|
|
302
365
|
|
|
303
366
|
Format YAML files without syncing. No source directory required - perfect for standardizing existing files.
|
|
304
367
|
|
|
305
368
|
```bash
|
|
306
|
-
# Preview which files would be formatted
|
|
307
|
-
helm-env-delta --config example/7-format-only/config.yaml --format-only --list-files
|
|
308
|
-
|
|
309
369
|
# Preview formatting changes
|
|
310
|
-
helm-env-delta --config example/7-format-only/config.yaml --
|
|
370
|
+
helm-env-delta format --config example/7-format-only/config.yaml --dry-run
|
|
311
371
|
|
|
312
372
|
# Apply formatting
|
|
313
|
-
helm-env-delta --config example/7-format-only/config.yaml
|
|
373
|
+
helm-env-delta format --config example/7-format-only/config.yaml
|
|
314
374
|
```
|
|
315
375
|
|
|
316
376
|
**Features shown:**
|
|
317
377
|
|
|
318
|
-
- Format
|
|
319
|
-
- Combining `--format-only` with `--list-files` to preview files
|
|
378
|
+
- Format command (no source required)
|
|
320
379
|
- Key ordering, array sorting, indentation standardization
|
|
321
380
|
- Minimal config for formatting existing files
|
|
322
381
|
|
|
@@ -324,15 +383,15 @@ helm-env-delta --config example/7-format-only/config.yaml --format-only
|
|
|
324
383
|
|
|
325
384
|
## 💡 Smart Configuration Suggestions (Heuristic)
|
|
326
385
|
|
|
327
|
-
The
|
|
386
|
+
The `suggest` command uses heuristic analysis to examine differences between environments and automatically recommend configuration updates. This intelligent pattern detection helps bootstrap your config by discovering repeated changes and potential safety rules.
|
|
328
387
|
|
|
329
388
|
### How It Works
|
|
330
389
|
|
|
331
390
|
```bash
|
|
332
|
-
helm-env-delta --config config.yaml
|
|
391
|
+
helm-env-delta suggest --config config.yaml
|
|
333
392
|
|
|
334
393
|
# Control suggestion sensitivity (higher threshold = fewer, higher-confidence suggestions)
|
|
335
|
-
helm-env-delta --config config.yaml --suggest
|
|
394
|
+
helm-env-delta suggest --config config.yaml --suggest-threshold 0.7
|
|
336
395
|
```
|
|
337
396
|
|
|
338
397
|
**How heuristic analysis works:**
|
|
@@ -382,28 +441,28 @@ stopRules:
|
|
|
382
441
|
|
|
383
442
|
```bash
|
|
384
443
|
# More suggestions (lower threshold = less strict)
|
|
385
|
-
helm-env-delta --config config.yaml --suggest
|
|
444
|
+
helm-env-delta suggest --config config.yaml --suggest-threshold 0.2
|
|
386
445
|
|
|
387
446
|
# Default balance (standard heuristics, threshold: 0.3)
|
|
388
|
-
helm-env-delta --config config.yaml
|
|
447
|
+
helm-env-delta suggest --config config.yaml
|
|
389
448
|
|
|
390
449
|
# Only high-confidence (higher threshold = more strict)
|
|
391
|
-
helm-env-delta --config config.yaml --suggest
|
|
450
|
+
helm-env-delta suggest --config config.yaml --suggest-threshold 0.8
|
|
392
451
|
```
|
|
393
452
|
|
|
394
453
|
**Workflow:**
|
|
395
454
|
|
|
396
455
|
```bash
|
|
397
456
|
# 1. Get suggestions (optionally with custom threshold)
|
|
398
|
-
helm-env-delta --config config.yaml --suggest
|
|
457
|
+
helm-env-delta suggest --config config.yaml --suggest-threshold 0.5 > suggestions.yaml
|
|
399
458
|
|
|
400
459
|
# 2. Review and copy relevant sections to config.yaml
|
|
401
460
|
|
|
402
|
-
# 3.
|
|
403
|
-
helm-env-delta --config config.yaml
|
|
461
|
+
# 3. Review changes
|
|
462
|
+
helm-env-delta diff --config config.yaml
|
|
404
463
|
|
|
405
464
|
# 4. Execute
|
|
406
|
-
helm-env-delta --config config.yaml
|
|
465
|
+
helm-env-delta run --config config.yaml
|
|
407
466
|
```
|
|
408
467
|
|
|
409
468
|
---
|
|
@@ -413,7 +472,7 @@ helm-env-delta --config config.yaml
|
|
|
413
472
|
### 🎯 Core Settings
|
|
414
473
|
|
|
415
474
|
```yaml
|
|
416
|
-
source: './uat' # Required: Source folder (optional
|
|
475
|
+
source: './uat' # Required: Source folder (optional for the format command)
|
|
417
476
|
destination: './prod' # Required: Destination folder (must differ from source)
|
|
418
477
|
|
|
419
478
|
include: # Optional: File patterns (default: all)
|
|
@@ -736,13 +795,13 @@ The `-f/--filter` flag supports logical operators for complex filtering:
|
|
|
736
795
|
|
|
737
796
|
```bash
|
|
738
797
|
# OR: match ANY term (filename or content)
|
|
739
|
-
hed -c config.yaml -f prod,staging
|
|
798
|
+
hed list-files -c config.yaml -f prod,staging
|
|
740
799
|
|
|
741
800
|
# AND: match ALL terms (can be split between filename and content)
|
|
742
|
-
hed -c config.yaml -f values+prod
|
|
801
|
+
hed list-files -c config.yaml -f values+prod
|
|
743
802
|
|
|
744
803
|
# Escape literal , or + with backslash
|
|
745
|
-
hed -c config.yaml -f "foo\,bar"
|
|
804
|
+
hed list-files -c config.yaml -f "foo\,bar"
|
|
746
805
|
```
|
|
747
806
|
|
|
748
807
|
**Constraints:**
|
|
@@ -759,13 +818,13 @@ Filter the sync to only source files **you** modified in git. Your identity is r
|
|
|
759
818
|
|
|
760
819
|
```bash
|
|
761
820
|
# Sync only files you modified in the last 30 days (default)
|
|
762
|
-
hed -c config.yaml --my
|
|
821
|
+
hed run -c config.yaml --my
|
|
763
822
|
|
|
764
823
|
# Sync only files you modified in the last 7 days
|
|
765
|
-
hed -c config.yaml --my 7
|
|
824
|
+
hed run -c config.yaml --my 7
|
|
766
825
|
|
|
767
826
|
# Preview first
|
|
768
|
-
hed -c config.yaml --my
|
|
827
|
+
hed diff -c config.yaml --my
|
|
769
828
|
```
|
|
770
829
|
|
|
771
830
|
**How it works:** Queries `git log` for commits by your git identity within the time window, collects modified file paths, and filters source files to that set. The matching destination files are filtered in tandem.
|
|
@@ -830,99 +889,168 @@ stopRules: # Add production safety rules
|
|
|
830
889
|
### Commands
|
|
831
890
|
|
|
832
891
|
```bash
|
|
833
|
-
helm-env-delta
|
|
834
|
-
hed
|
|
892
|
+
helm-env-delta <command> [options]
|
|
893
|
+
hed <command> [options] # Short alias
|
|
835
894
|
```
|
|
836
895
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
|
840
|
-
|
|
|
841
|
-
|
|
|
842
|
-
|
|
|
843
|
-
|
|
|
844
|
-
|
|
|
845
|
-
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
|
852
|
-
|
|
|
853
|
-
| `--
|
|
854
|
-
| `--
|
|
855
|
-
| `--
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
896
|
+
| Command | Description |
|
|
897
|
+
| ------------- | ------------------------------------------------------------------------------------------- |
|
|
898
|
+
| `run` | Sync source YAML changes to destination |
|
|
899
|
+
| `validate` | Validate configuration and patterns (shows warnings, `--strict` exits non-zero on warnings) |
|
|
900
|
+
| `format` | Format destination YAML files without syncing |
|
|
901
|
+
| `suggest` | Analyze differences and suggest config updates |
|
|
902
|
+
| `diff` | Show changes between source and destination (read-only) |
|
|
903
|
+
| `list-files` | List files that would be processed without computing diff |
|
|
904
|
+
| `show-config` | Display resolved configuration after inheritance |
|
|
905
|
+
|
|
906
|
+
### Global Options
|
|
907
|
+
|
|
908
|
+
All commands accept:
|
|
909
|
+
|
|
910
|
+
| Flag | Description |
|
|
911
|
+
| ------------ | ----------------------------------------- |
|
|
912
|
+
| `--no-color` | Disable colored output (CI/accessibility) |
|
|
913
|
+
| `--verbose` | Show detailed debug info |
|
|
914
|
+
| `--quiet` | Suppress output except errors |
|
|
915
|
+
|
|
916
|
+
### Command Options
|
|
917
|
+
|
|
918
|
+
**`run` — Sync source changes to destination**
|
|
919
|
+
|
|
920
|
+
| Flag | Short | Description |
|
|
921
|
+
| ------------------- | ----- | --------------------------------------------------------------------------- |
|
|
922
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
923
|
+
| `--dry-run` | `-D` | Preview changes without writing files |
|
|
924
|
+
| `--force` | | Override stop rules |
|
|
925
|
+
| `--skip-format` | `-S` | Skip YAML formatting during sync |
|
|
926
|
+
| `--filter <string>` | `-f` | Filter files by filename/content (supports `,` OR, `+` AND) |
|
|
927
|
+
| `--mode <type>` | `-m` | Filter by change type: new, modified, deleted, all (default: all) |
|
|
928
|
+
| `--my [days]` | | Filter to source files you modified in git in the last N days (default: 30) |
|
|
929
|
+
|
|
930
|
+
**`validate` — Validate configuration and pattern usage**
|
|
931
|
+
|
|
932
|
+
| Flag | Short | Description |
|
|
933
|
+
| ------------------- | ----- | ------------------------------------------------------------------- |
|
|
934
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
935
|
+
| `--strict` | | Exit with code 4 if any warnings are found (useful for CI/CD gates) |
|
|
936
|
+
| `--filter <string>` | `-f` | Filter files |
|
|
937
|
+
| `--my [days]` | | Limit to files you modified in git in the last N days |
|
|
938
|
+
|
|
939
|
+
**`format` — Format destination YAML files (source not required)**
|
|
940
|
+
|
|
941
|
+
| Flag | Short | Description |
|
|
942
|
+
| ------------------- | ----- | ------------------------------------------ |
|
|
943
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
944
|
+
| `--dry-run` | `-D` | Preview formatting changes without writing |
|
|
945
|
+
| `--filter <string>` | `-f` | Filter files |
|
|
946
|
+
|
|
947
|
+
**`suggest` — Analyze differences and suggest config updates**
|
|
948
|
+
|
|
949
|
+
| Flag | Short | Description |
|
|
950
|
+
| --------------------------- | ----- | ----------------------------------------------------- |
|
|
951
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
952
|
+
| `--suggest-threshold <0-1>` | | Minimum confidence for suggestions (default: 0.3) |
|
|
953
|
+
| `--filter <string>` | `-f` | Filter files |
|
|
954
|
+
| `--mode <type>` | `-m` | Filter by change type |
|
|
955
|
+
| `--my [days]` | | Limit to files you modified in git in the last N days |
|
|
956
|
+
|
|
957
|
+
**`diff` — Show changes (always read-only, never writes files)**
|
|
958
|
+
|
|
959
|
+
| Flag | Short | Description |
|
|
960
|
+
| ------------------------ | ----- | ----------------------------------------------------------------- |
|
|
961
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
962
|
+
| `--html` | `-H` | Generate HTML report (opens in browser) |
|
|
963
|
+
| `--json` | `-J` | Output JSON to stdout (pipe to jq) |
|
|
964
|
+
| `--report-output <path>` | | Save HTML report to file or directory (suppresses browser open) |
|
|
965
|
+
| `--filter <string>` | `-f` | Filter files by filename/content |
|
|
966
|
+
| `--mode <type>` | `-m` | Filter by change type: new, modified, deleted, all (default: all) |
|
|
967
|
+
| `--my [days]` | | Limit to files you modified in git in the last N days |
|
|
968
|
+
|
|
969
|
+
**`list-files` — List files without processing diffs**
|
|
970
|
+
|
|
971
|
+
| Flag | Short | Description |
|
|
972
|
+
| ------------------- | ----- | ----------------------------------------------------- |
|
|
973
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
974
|
+
| `--filter <string>` | `-f` | Filter files |
|
|
975
|
+
| `--my [days]` | | Limit to files you modified in git in the last N days |
|
|
976
|
+
|
|
977
|
+
**`show-config` — Display resolved configuration**
|
|
978
|
+
|
|
979
|
+
| Flag | Short | Description |
|
|
980
|
+
| ----------------- | ----- | --------------------------------- |
|
|
981
|
+
| `--config <path>` | `-c` | **Required** — Configuration file |
|
|
860
982
|
|
|
861
983
|
### Examples
|
|
862
984
|
|
|
863
985
|
```bash
|
|
864
|
-
# Validate configuration (shows warnings)
|
|
865
|
-
hed -c config.yaml
|
|
986
|
+
# Validate configuration (shows warnings, exits 0)
|
|
987
|
+
hed validate -c config.yaml
|
|
988
|
+
|
|
989
|
+
# Strict mode — exit 4 if any warnings found (CI gate)
|
|
990
|
+
hed validate -c config.yaml --strict
|
|
866
991
|
|
|
867
992
|
# Get smart configuration suggestions
|
|
868
|
-
hed -c config.yaml
|
|
993
|
+
hed suggest -c config.yaml
|
|
869
994
|
|
|
870
995
|
# Get only high-confidence suggestions
|
|
871
|
-
hed -c config.yaml --suggest
|
|
996
|
+
hed suggest -c config.yaml --suggest-threshold 0.7
|
|
872
997
|
|
|
873
998
|
# Preview files that will be synced
|
|
874
|
-
hed -c config.yaml
|
|
999
|
+
hed list-files -c config.yaml
|
|
875
1000
|
|
|
876
1001
|
# Display resolved config (after inheritance)
|
|
877
|
-
hed -c config.yaml
|
|
1002
|
+
hed show-config -c config.yaml
|
|
878
1003
|
|
|
879
|
-
#
|
|
880
|
-
hed -c config.yaml
|
|
1004
|
+
# Show changes (read-only console diff)
|
|
1005
|
+
hed diff -c config.yaml
|
|
881
1006
|
|
|
882
1007
|
# Visual HTML report
|
|
883
|
-
hed -c config.yaml
|
|
1008
|
+
hed diff -c config.yaml --html
|
|
1009
|
+
|
|
1010
|
+
# Save HTML report as CI/CD artifact (no browser)
|
|
1011
|
+
hed diff -c config.yaml --report-output ./reports/
|
|
884
1012
|
|
|
885
1013
|
# CI/CD integration (no colors)
|
|
886
|
-
hed -c config.yaml
|
|
1014
|
+
hed diff -c config.yaml --json --no-color | jq '.summary'
|
|
887
1015
|
|
|
888
1016
|
# Execute sync
|
|
889
|
-
hed -c config.yaml
|
|
1017
|
+
hed run -c config.yaml
|
|
1018
|
+
|
|
1019
|
+
# Preview sync without writing
|
|
1020
|
+
hed run -c config.yaml --dry-run
|
|
890
1021
|
|
|
891
1022
|
# Force override stop rules
|
|
892
|
-
hed -c config.yaml --force
|
|
1023
|
+
hed run -c config.yaml --force
|
|
893
1024
|
|
|
894
1025
|
# Filter to only process files matching 'prod'
|
|
895
|
-
hed -c config.yaml -f prod
|
|
1026
|
+
hed diff -c config.yaml -f prod
|
|
896
1027
|
|
|
897
1028
|
# Filter with OR: match files containing 'prod' OR 'staging'
|
|
898
|
-
hed -c config.yaml -f prod,staging
|
|
1029
|
+
hed list-files -c config.yaml -f prod,staging
|
|
899
1030
|
|
|
900
1031
|
# Filter with AND: match files containing BOTH 'values' AND 'prod'
|
|
901
|
-
hed -c config.yaml -f values+prod
|
|
1032
|
+
hed diff -c config.yaml -f values+prod
|
|
902
1033
|
|
|
903
1034
|
# Sync only new files
|
|
904
|
-
hed -c config.yaml -m new
|
|
1035
|
+
hed run -c config.yaml -m new
|
|
905
1036
|
|
|
906
1037
|
# Preview modified files only
|
|
907
|
-
hed -c config.yaml -m modified
|
|
1038
|
+
hed diff -c config.yaml -m modified
|
|
908
1039
|
|
|
909
1040
|
# Combine filter and mode
|
|
910
|
-
hed -c config.yaml -f deployment -m modified
|
|
1041
|
+
hed diff -c config.yaml -f deployment -m modified
|
|
911
1042
|
|
|
912
1043
|
# Sync only files you modified in the last 30 days (auto-detects your git identity)
|
|
913
|
-
hed -c config.yaml --my -
|
|
1044
|
+
hed run -c config.yaml --my --dry-run
|
|
914
1045
|
|
|
915
1046
|
# Sync only files you modified in the last 7 days
|
|
916
|
-
hed -c config.yaml --my 7 -
|
|
1047
|
+
hed run -c config.yaml --my 7 --dry-run
|
|
917
1048
|
|
|
918
1049
|
# Format destination files only (no sync, source not required in config)
|
|
919
|
-
hed -c config.yaml
|
|
1050
|
+
hed format -c config.yaml
|
|
920
1051
|
|
|
921
1052
|
# Preview format changes
|
|
922
|
-
hed -c config.yaml --
|
|
923
|
-
|
|
924
|
-
# List files that would be formatted (--list-files takes precedence)
|
|
925
|
-
hed -c config.yaml --format-only -l
|
|
1053
|
+
hed format -c config.yaml --dry-run
|
|
926
1054
|
|
|
927
1055
|
# Format-only config example (no source needed):
|
|
928
1056
|
# destination: './prod'
|
|
@@ -951,13 +1079,13 @@ flowchart LR
|
|
|
951
1079
|
|
|
952
1080
|
```bash
|
|
953
1081
|
# 1. Preview changes
|
|
954
|
-
hed -c config.yaml
|
|
1082
|
+
hed diff -c config.yaml
|
|
955
1083
|
|
|
956
1084
|
# 2. Review in browser
|
|
957
|
-
hed -c config.yaml
|
|
1085
|
+
hed diff -c config.yaml --html
|
|
958
1086
|
|
|
959
1087
|
# 3. Execute sync
|
|
960
|
-
hed -c config.yaml
|
|
1088
|
+
hed run -c config.yaml
|
|
961
1089
|
|
|
962
1090
|
# 4. Git workflow
|
|
963
1091
|
git add prod/
|
|
@@ -1002,10 +1130,66 @@ git push origin main
|
|
|
1002
1130
|
|
|
1003
1131
|
---
|
|
1004
1132
|
|
|
1005
|
-
## 📊
|
|
1133
|
+
## 📊 CI/CD Output
|
|
1134
|
+
|
|
1135
|
+
### Exit Codes
|
|
1136
|
+
|
|
1137
|
+
`helm-env-delta` uses granular exit codes so pipelines can act on outcomes without parsing JSON:
|
|
1138
|
+
|
|
1139
|
+
| Code | Meaning |
|
|
1140
|
+
| ---- | ----------------------------------------------------------------------- |
|
|
1141
|
+
| `0` | No changes detected — files are already in sync |
|
|
1142
|
+
| `1` | Changes synced (or formatted) successfully |
|
|
1143
|
+
| `2` | Stop rule violation(s) blocked the sync |
|
|
1144
|
+
| `3` | Configuration or CLI argument error |
|
|
1145
|
+
| `4` | Warnings found during `validate --strict` (config is usable but impure) |
|
|
1146
|
+
|
|
1147
|
+
**Usage in CI:**
|
|
1148
|
+
|
|
1149
|
+
```bash
|
|
1150
|
+
hed run -c config.yaml
|
|
1151
|
+
STATUS=$?
|
|
1152
|
+
|
|
1153
|
+
if [ $STATUS -eq 0 ]; then
|
|
1154
|
+
echo "Nothing to do."
|
|
1155
|
+
elif [ $STATUS -eq 1 ]; then
|
|
1156
|
+
echo "Sync complete — commit and push."
|
|
1157
|
+
elif [ $STATUS -eq 2 ]; then
|
|
1158
|
+
echo "Blocked by stop rules — review before using --force."
|
|
1159
|
+
elif [ $STATUS -eq 3 ]; then
|
|
1160
|
+
echo "Config error — check your config.yaml and CLI flags."
|
|
1161
|
+
exit 1
|
|
1162
|
+
elif [ $STATUS -eq 4 ]; then
|
|
1163
|
+
echo "Validation warnings found — fix them or drop --strict."
|
|
1164
|
+
exit 1
|
|
1165
|
+
fi
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
**Notes:**
|
|
1169
|
+
|
|
1170
|
+
- Early exits (`show-config`, `validate`, `list-files`, `suggest`) return `0` — no sync occurred.
|
|
1171
|
+
- `validate --strict` returns `4` when warnings are present (and `0` when clean).
|
|
1172
|
+
- Runtime errors (file I/O failures, YAML parse errors) return `1`.
|
|
1173
|
+
- `run --dry-run` with changes still returns `1` (changes exist, even if not written).
|
|
1174
|
+
|
|
1175
|
+
---
|
|
1176
|
+
|
|
1177
|
+
### HTML Report as Artifact
|
|
1178
|
+
|
|
1179
|
+
```bash
|
|
1180
|
+
# Save to a directory — filename auto-generated with timestamp
|
|
1181
|
+
hed diff --config config.yaml --report-output ./artifacts/
|
|
1182
|
+
|
|
1183
|
+
# Save to an exact path
|
|
1184
|
+
hed diff --config config.yaml --report-output ./artifacts/report.html
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
Browser auto-open is suppressed when `--report-output` is used. The flag also implies HTML generation, so `--html` is not required alongside it.
|
|
1188
|
+
|
|
1189
|
+
### JSON Output
|
|
1006
1190
|
|
|
1007
1191
|
```bash
|
|
1008
|
-
hed --config config.yaml --
|
|
1192
|
+
hed diff --config config.yaml --json > report.json
|
|
1009
1193
|
```
|
|
1010
1194
|
|
|
1011
1195
|
**Schema:**
|
|
@@ -1099,7 +1283,7 @@ HelmEnvDelta validates that your configuration patterns actually match files and
|
|
|
1099
1283
|
**Run validation:**
|
|
1100
1284
|
|
|
1101
1285
|
```bash
|
|
1102
|
-
helm-env-delta --config config.yaml
|
|
1286
|
+
helm-env-delta validate --config config.yaml
|
|
1103
1287
|
```
|
|
1104
1288
|
|
|
1105
1289
|
**What gets validated:**
|
|
@@ -1139,7 +1323,7 @@ helm-env-delta --config config.yaml --validate
|
|
|
1139
1323
|
- To verify config file patterns after file reorganization
|
|
1140
1324
|
- As part of CI/CD pre-flight checks
|
|
1141
1325
|
|
|
1142
|
-
**Important:** Warnings are non-fatal and don't block execution.
|
|
1326
|
+
**Important:** Warnings are non-fatal by default and don't block execution. Use `--strict` to exit with code 4 when warnings are present, enabling hard enforcement in CI/CD pipelines.
|
|
1143
1327
|
|
|
1144
1328
|
---
|
|
1145
1329
|
|