helm-env-delta 1.10.2 → 1.10.3
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 +17 -15
- package/dist/commandLine.js +3 -3
- package/dist/utils/fileFilter.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
HelmEnvDelta (`hed`) automates environment synchronization for GitOps workflows while protecting your production-specific settings and preventing dangerous changes.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="helm-env-delta.png" alt="helm-env-delta" />
|
|
17
|
+
</p>
|
|
16
18
|
|
|
17
19
|
## 👤 Who Is This For?
|
|
18
20
|
|
|
@@ -697,28 +699,28 @@ outputFormat:
|
|
|
697
699
|
|
|
698
700
|
The `-f/--filter` flag supports logical operators for complex filtering:
|
|
699
701
|
|
|
700
|
-
| Operator | Name | Example
|
|
701
|
-
| -------- | ------ |
|
|
702
|
-
| (none) | Simple | `-f prod`
|
|
703
|
-
|
|
|
704
|
-
|
|
|
702
|
+
| Operator | Name | Example | Matches |
|
|
703
|
+
| -------- | ------ | ----------------- | ----------------------------------------------- |
|
|
704
|
+
| (none) | Simple | `-f prod` | Files where filename or content contains "prod" |
|
|
705
|
+
| `,` | OR | `-f prod,staging` | Files matching "prod" OR "staging" |
|
|
706
|
+
| `+` | AND | `-f values+prod` | Files matching "values" AND "prod" |
|
|
705
707
|
|
|
706
708
|
```bash
|
|
707
709
|
# OR: match ANY term (filename or content)
|
|
708
|
-
hed -c config.yaml -f
|
|
710
|
+
hed -c config.yaml -f prod,staging --list-files
|
|
709
711
|
|
|
710
712
|
# AND: match ALL terms (can be split between filename and content)
|
|
711
|
-
hed -c config.yaml -f
|
|
713
|
+
hed -c config.yaml -f values+prod --list-files
|
|
712
714
|
|
|
713
|
-
# Escape literal
|
|
714
|
-
hed -c config.yaml -f "foo
|
|
715
|
+
# Escape literal , or + with backslash
|
|
716
|
+
hed -c config.yaml -f "foo\,bar" --list-files
|
|
715
717
|
```
|
|
716
718
|
|
|
717
719
|
**Constraints:**
|
|
718
720
|
|
|
719
|
-
- Cannot mix
|
|
721
|
+
- Cannot mix `+` and `,` in a single filter (throws error)
|
|
720
722
|
- Case-insensitive matching
|
|
721
|
-
- Empty terms are ignored (`a
|
|
723
|
+
- Empty terms are ignored (`a,,b` becomes `a,b`)
|
|
722
724
|
|
|
723
725
|
---
|
|
724
726
|
|
|
@@ -797,7 +799,7 @@ hed --config <file> [options] # Short alias
|
|
|
797
799
|
| `--show-config` | | Display resolved config after inheritance |
|
|
798
800
|
| `--format-only` | | Format destination files only (source not required) |
|
|
799
801
|
| `--skip-format` | `-S` | Skip YAML formatting during sync |
|
|
800
|
-
| `--filter <string>` | `-f` | Filter files by filename/content (supports
|
|
802
|
+
| `--filter <string>` | `-f` | Filter files by filename/content (supports `,` OR, `+` AND) |
|
|
801
803
|
| `--mode <type>` | `-m` | Filter by change type: new, modified, deleted, all (default: all) |
|
|
802
804
|
| `--no-color` | | Disable colored output (CI/accessibility) |
|
|
803
805
|
| `--verbose` | | Show detailed debug info |
|
|
@@ -840,10 +842,10 @@ hed -c config.yaml --force
|
|
|
840
842
|
hed -c config.yaml -f prod -d
|
|
841
843
|
|
|
842
844
|
# Filter with OR: match files containing 'prod' OR 'staging'
|
|
843
|
-
hed -c config.yaml -f
|
|
845
|
+
hed -c config.yaml -f prod,staging -l
|
|
844
846
|
|
|
845
847
|
# Filter with AND: match files containing BOTH 'values' AND 'prod'
|
|
846
|
-
hed -c config.yaml -f
|
|
848
|
+
hed -c config.yaml -f values+prod -d
|
|
847
849
|
|
|
848
850
|
# Sync only new files
|
|
849
851
|
hed -c config.yaml -m new
|
package/dist/commandLine.js
CHANGED
|
@@ -26,7 +26,7 @@ const parseCommandLine = (argv) => {
|
|
|
26
26
|
.option('--suggest', 'Analyze differences and suggest transforms and stop rules', false)
|
|
27
27
|
.option('--suggest-threshold <number>', 'Minimum confidence for suggestions (0-1, default: 0.3)', '0.3')
|
|
28
28
|
.option('--no-color', 'Disable colored output')
|
|
29
|
-
.option('-f, --filter <string>', 'Filter files by filename or content (supports
|
|
29
|
+
.option('-f, --filter <string>', 'Filter files by filename or content (supports , for OR, + for AND)')
|
|
30
30
|
.option('-m, --mode <type>', 'Filter by change type: new, modified, deleted, all', 'all')
|
|
31
31
|
.option('--verbose', 'Show detailed debug information', false)
|
|
32
32
|
.option('--quiet', 'Suppress all output except critical errors', false)
|
|
@@ -51,10 +51,10 @@ Examples:
|
|
|
51
51
|
$ helm-env-delta --config config.yaml -f prod --diff
|
|
52
52
|
|
|
53
53
|
# Filter with OR: files matching 'prod' OR 'staging'
|
|
54
|
-
$ helm-env-delta --config config.yaml -f
|
|
54
|
+
$ helm-env-delta --config config.yaml -f prod,staging --diff
|
|
55
55
|
|
|
56
56
|
# Filter with AND: files matching 'values' AND 'prod'
|
|
57
|
-
$ helm-env-delta --config config.yaml -f
|
|
57
|
+
$ helm-env-delta --config config.yaml -f values+prod --diff
|
|
58
58
|
|
|
59
59
|
# Sync only new files
|
|
60
60
|
$ helm-env-delta --config config.yaml --mode new
|
package/dist/utils/fileFilter.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.filterFileMaps = exports.filterFileMap = exports.filterDiffResultByMode = exports.fileMatchesFilter = exports.parseFilterExpression = exports.isFilterParseError = exports.FilterParseError = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
const filterParseErrorCodes = {
|
|
6
|
-
MIXED_OPERATORS: 'Cannot combine AND (
|
|
6
|
+
MIXED_OPERATORS: 'Cannot combine AND (+) and OR (,) operators in a single filter expression'
|
|
7
7
|
};
|
|
8
8
|
exports.FilterParseError = (0, errors_1.createErrorClass)('FilterParseError', filterParseErrorCodes);
|
|
9
9
|
exports.isFilterParseError = (0, errors_1.createErrorTypeGuard)(exports.FilterParseError);
|
|
@@ -15,17 +15,17 @@ const parseFilterExpression = (filter) => {
|
|
|
15
15
|
for (let index = 0; index < filter.length; index++) {
|
|
16
16
|
const char = filter[index];
|
|
17
17
|
const isEscaped = index > 0 && filter[index - 1] === '\\';
|
|
18
|
-
if (char === '
|
|
18
|
+
if (char === ',' && !isEscaped)
|
|
19
19
|
hasUnescapedOr = true;
|
|
20
|
-
if (char === '
|
|
20
|
+
if (char === '+' && !isEscaped)
|
|
21
21
|
hasUnescapedAnd = true;
|
|
22
22
|
}
|
|
23
23
|
if (hasUnescapedOr && hasUnescapedAnd)
|
|
24
24
|
throw new exports.FilterParseError('Mixed operators detected', {
|
|
25
25
|
code: 'MIXED_OPERATORS',
|
|
26
26
|
hints: [
|
|
27
|
-
'Use only
|
|
28
|
-
String.raw `Escape literal characters with backslash:
|
|
27
|
+
'Use only , (OR) or only + (AND) in a single filter',
|
|
28
|
+
String.raw `Escape literal characters with backslash: \, or \+`
|
|
29
29
|
]
|
|
30
30
|
});
|
|
31
31
|
const operator = hasUnescapedOr ? 'OR' : hasUnescapedAnd ? 'AND' : 'NONE';
|
|
@@ -33,7 +33,7 @@ const parseFilterExpression = (filter) => {
|
|
|
33
33
|
if (operator === 'NONE')
|
|
34
34
|
terms = [filter];
|
|
35
35
|
else {
|
|
36
|
-
const splitChar = operator === 'OR' ? '
|
|
36
|
+
const splitChar = operator === 'OR' ? ',' : '+';
|
|
37
37
|
terms = [];
|
|
38
38
|
let currentTerm = '';
|
|
39
39
|
for (let index = 0; index < filter.length; index++) {
|
|
@@ -43,7 +43,7 @@ const parseFilterExpression = (filter) => {
|
|
|
43
43
|
terms.push(currentTerm);
|
|
44
44
|
currentTerm = '';
|
|
45
45
|
}
|
|
46
|
-
else if (char === '\\' && index + 1 < filter.length && (filter[index + 1] === '
|
|
46
|
+
else if (char === '\\' && index + 1 < filter.length && (filter[index + 1] === ',' || filter[index + 1] === '+'))
|
|
47
47
|
continue;
|
|
48
48
|
else
|
|
49
49
|
currentTerm += char;
|
|
@@ -52,7 +52,7 @@ const parseFilterExpression = (filter) => {
|
|
|
52
52
|
}
|
|
53
53
|
const processedTerms = terms
|
|
54
54
|
.map((term) => term
|
|
55
|
-
.replaceAll(/\\([
|
|
55
|
+
.replaceAll(/\\([+,])/g, '$1')
|
|
56
56
|
.trim()
|
|
57
57
|
.toLowerCase())
|
|
58
58
|
.filter((term) => term.length > 0);
|