zod-envkit 1.3.3 → 1.3.4
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/CHANGELOG.md +21 -2
- package/dist/cli/index.cjs +96 -0
- package/dist/cli/index.js +96 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
## [1.3.
|
|
1
|
+
## [1.3.4](https://github.com/nxtxe/zod-envkit/compare/v1.3.3...v1.3.4) (2026-04-20)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
* **cli:**
|
|
6
|
+
* **cli:** harden 1.3.4 output stability and edge robustness ([e3f52d7](https://github.com/nxtxe/zod-envkit/commit/e3f52d78917f726f08f7213fd31c00a52ca39deb))
|
|
7
|
+
|
|
8
|
+
## [1.3.4](https://github.com/nxtxe/zod-envkit/compare/v1.3.3...v1.3.4) (2026-03-xx)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* deterministic output polish:
|
|
14
|
+
* lock stable ordering and formatting of grouped `check --strict` errors across repeated runs
|
|
15
|
+
* masking edge hardening:
|
|
16
|
+
* add coverage for short secret values (`1-2` chars) in `partial/full` modes
|
|
17
|
+
* keep case-insensitive secret detection stable (`Api_Key`, `my_password`)
|
|
18
|
+
* dotenv parsing robustness:
|
|
19
|
+
* add coverage for BOM, trailing spaces, and duplicate keys with deterministic override behavior
|
|
20
|
+
* fallback clarity hardening:
|
|
21
|
+
* extend tests for empty/comment-only `.env.example` fallback path
|
|
22
|
+
* CLI smoke hardening:
|
|
23
|
+
* repeated `--help`, `--version`, `show`, and `check` invocations across locales
|
|
24
|
+
* docs consistency patch:
|
|
25
|
+
* keep EN/RU CLI contract sections aligned (no behavior changes)
|
|
7
26
|
|
|
8
27
|
## [1.3.3](https://github.com/nxtxe/zod-envkit/compare/v1.3.2...v1.3.3) (2026-03-xx)
|
|
9
28
|
|
package/dist/cli/index.cjs
CHANGED
|
@@ -745,8 +745,10 @@ injectDefaultCommandIfMissing(process.argv, {
|
|
|
745
745
|
"show",
|
|
746
746
|
"check",
|
|
747
747
|
"init",
|
|
748
|
+
"help",
|
|
748
749
|
"-h",
|
|
749
750
|
"--help",
|
|
751
|
+
"--all",
|
|
750
752
|
"-V",
|
|
751
753
|
"--version",
|
|
752
754
|
"--lang"
|
|
@@ -771,4 +773,98 @@ registerGenerate(program, getLang);
|
|
|
771
773
|
registerShow(program, getLang);
|
|
772
774
|
registerCheck(program, getLang);
|
|
773
775
|
registerInit(program, getLang);
|
|
776
|
+
function resolveCliLangArg(argv) {
|
|
777
|
+
for (let i = 0; i < argv.length; i++) {
|
|
778
|
+
const token = argv[i] ?? "";
|
|
779
|
+
if (token === "--lang") return argv[i + 1];
|
|
780
|
+
if (token.startsWith("--lang=")) return token.slice("--lang=".length);
|
|
781
|
+
}
|
|
782
|
+
return void 0;
|
|
783
|
+
}
|
|
784
|
+
function renderDeepHelp(lang) {
|
|
785
|
+
const commandNames = program.commands.map((cmd) => cmd.name()).join(", ");
|
|
786
|
+
const blocks = lang === "ru" ? [
|
|
787
|
+
"=== zod-envkit \u043F\u043E\u0434\u0440\u043E\u0431\u043D\u0430\u044F \u0441\u043F\u0440\u0430\u0432\u043A\u0430 ===",
|
|
788
|
+
"",
|
|
789
|
+
"\u0411\u0430\u0437\u043E\u0432\u0430\u044F \u0438\u0434\u0435\u044F:",
|
|
790
|
+
" env.meta.json \u2014 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u043F\u0440\u0430\u0432\u0434\u044B \u0434\u043B\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438, \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A \u0438 \u043E\u043D\u0431\u043E\u0440\u0434\u0438\u043D\u0433\u0430.",
|
|
791
|
+
"",
|
|
792
|
+
"\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u0441\u0442\u0430\u0440\u0442:",
|
|
793
|
+
" 1) npx zod-envkit init",
|
|
794
|
+
" 2) npx zod-envkit generate",
|
|
795
|
+
" 3) npx zod-envkit show",
|
|
796
|
+
" 4) npx zod-envkit check --strict",
|
|
797
|
+
"",
|
|
798
|
+
"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u043A\u043E\u043C\u0430\u043D\u0434\u044B:",
|
|
799
|
+
` ${commandNames}`,
|
|
800
|
+
"",
|
|
801
|
+
"\u0420\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0443\u0435\u043C\u044B\u0435 workflow:",
|
|
802
|
+
" - \u0441\u0442\u0430\u0440\u0442 \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0435\u0433\u043E env example:",
|
|
803
|
+
" npx zod-envkit init --input .env.example --output env.meta.json",
|
|
804
|
+
" - \u0434\u0435\u0442\u0435\u0440\u043C\u0438\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F \u0432 CI:",
|
|
805
|
+
" npx zod-envkit generate --format md --sort required-first",
|
|
806
|
+
" npx zod-envkit check --strict --dotenv .env,.env.local",
|
|
807
|
+
" - \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u0430 schema \u2194 meta:",
|
|
808
|
+
" npx zod-envkit check --schema ./schema/env.mjs --schema-mode strict",
|
|
809
|
+
"",
|
|
810
|
+
"\u0414\u0435\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u043F\u0440\u0430\u0432\u043A\u0430 \u043F\u043E \u043A\u043E\u043C\u0430\u043D\u0434\u0430\u043C:",
|
|
811
|
+
""
|
|
812
|
+
] : [
|
|
813
|
+
"=== zod-envkit deep help ===",
|
|
814
|
+
"",
|
|
815
|
+
"Core idea:",
|
|
816
|
+
" env.meta.json is the source of truth for docs, checks and onboarding.",
|
|
817
|
+
"",
|
|
818
|
+
"Quick start:",
|
|
819
|
+
" 1) npx zod-envkit init",
|
|
820
|
+
" 2) npx zod-envkit generate",
|
|
821
|
+
" 3) npx zod-envkit show",
|
|
822
|
+
" 4) npx zod-envkit check --strict",
|
|
823
|
+
"",
|
|
824
|
+
"Available commands:",
|
|
825
|
+
` ${commandNames}`,
|
|
826
|
+
"",
|
|
827
|
+
"Recommended workflows:",
|
|
828
|
+
" - bootstrap from existing env example:",
|
|
829
|
+
" npx zod-envkit init --input .env.example --output env.meta.json",
|
|
830
|
+
" - keep docs deterministic in CI:",
|
|
831
|
+
" npx zod-envkit generate --format md --sort required-first",
|
|
832
|
+
" npx zod-envkit check --strict --dotenv .env,.env.local",
|
|
833
|
+
" - validate schema contract against meta:",
|
|
834
|
+
" npx zod-envkit check --schema ./schema/env.mjs --schema-mode strict",
|
|
835
|
+
"",
|
|
836
|
+
"Detailed command reference:",
|
|
837
|
+
""
|
|
838
|
+
];
|
|
839
|
+
for (const cmd of program.commands) {
|
|
840
|
+
blocks.push(cmd.helpInformation().trim(), "");
|
|
841
|
+
}
|
|
842
|
+
if (lang === "ru") {
|
|
843
|
+
blocks.push(
|
|
844
|
+
"\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438:",
|
|
845
|
+
" - \u044F\u0437\u044B\u043A CLI: --lang en|ru",
|
|
846
|
+
" - \u0441\u043F\u0440\u0430\u0432\u043A\u0430 \u043F\u043E \u043A\u043E\u043C\u0430\u043D\u0434\u0435: npx zod-envkit help <command>",
|
|
847
|
+
" - \u043F\u043E\u043B\u043D\u044B\u0439 \u0433\u0430\u0439\u0434: npx zod-envkit help --all"
|
|
848
|
+
);
|
|
849
|
+
} else {
|
|
850
|
+
blocks.push(
|
|
851
|
+
"Tips:",
|
|
852
|
+
" - global language: --lang en|ru",
|
|
853
|
+
" - command help: npx zod-envkit help <command>",
|
|
854
|
+
" - full handbook: npx zod-envkit help --all"
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
return `${blocks.join("\n").trimEnd()}
|
|
858
|
+
`;
|
|
859
|
+
}
|
|
860
|
+
program.addHelpText("after", () => {
|
|
861
|
+
const lang = resolveLang(resolveCliLangArg(process.argv.slice(2)));
|
|
862
|
+
return lang === "ru" ? "\n\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E: `npx zod-envkit help --all` \u0432\u044B\u0432\u043E\u0434\u0438\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u0443\u044E \u0441\u043F\u0440\u0430\u0432\u043A\u0443 \u0441 workflow \u0438 \u043F\u043E\u043B\u043D\u043E\u0439 \u0441\u0432\u043E\u0434\u043A\u043E\u0439 \u043A\u043E\u043C\u0430\u043D\u0434.\n" : "\nTip: `npx zod-envkit help --all` prints an extended handbook with workflows and full command reference.\n";
|
|
863
|
+
});
|
|
864
|
+
var cliArgs = process.argv.slice(2);
|
|
865
|
+
if (cliArgs[0] === "help" && cliArgs.includes("--all")) {
|
|
866
|
+
const lang = resolveLang(resolveCliLangArg(cliArgs));
|
|
867
|
+
process.stdout.write(renderDeepHelp(lang));
|
|
868
|
+
process.exit(0);
|
|
869
|
+
}
|
|
774
870
|
program.parse(process.argv);
|
package/dist/cli/index.js
CHANGED
|
@@ -524,8 +524,10 @@ injectDefaultCommandIfMissing(process.argv, {
|
|
|
524
524
|
"show",
|
|
525
525
|
"check",
|
|
526
526
|
"init",
|
|
527
|
+
"help",
|
|
527
528
|
"-h",
|
|
528
529
|
"--help",
|
|
530
|
+
"--all",
|
|
529
531
|
"-V",
|
|
530
532
|
"--version",
|
|
531
533
|
"--lang"
|
|
@@ -550,4 +552,98 @@ registerGenerate(program, getLang);
|
|
|
550
552
|
registerShow(program, getLang);
|
|
551
553
|
registerCheck(program, getLang);
|
|
552
554
|
registerInit(program, getLang);
|
|
555
|
+
function resolveCliLangArg(argv) {
|
|
556
|
+
for (let i = 0; i < argv.length; i++) {
|
|
557
|
+
const token = argv[i] ?? "";
|
|
558
|
+
if (token === "--lang") return argv[i + 1];
|
|
559
|
+
if (token.startsWith("--lang=")) return token.slice("--lang=".length);
|
|
560
|
+
}
|
|
561
|
+
return void 0;
|
|
562
|
+
}
|
|
563
|
+
function renderDeepHelp(lang) {
|
|
564
|
+
const commandNames = program.commands.map((cmd) => cmd.name()).join(", ");
|
|
565
|
+
const blocks = lang === "ru" ? [
|
|
566
|
+
"=== zod-envkit \u043F\u043E\u0434\u0440\u043E\u0431\u043D\u0430\u044F \u0441\u043F\u0440\u0430\u0432\u043A\u0430 ===",
|
|
567
|
+
"",
|
|
568
|
+
"\u0411\u0430\u0437\u043E\u0432\u0430\u044F \u0438\u0434\u0435\u044F:",
|
|
569
|
+
" env.meta.json \u2014 \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u043F\u0440\u0430\u0432\u0434\u044B \u0434\u043B\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u0438, \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A \u0438 \u043E\u043D\u0431\u043E\u0440\u0434\u0438\u043D\u0433\u0430.",
|
|
570
|
+
"",
|
|
571
|
+
"\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u0441\u0442\u0430\u0440\u0442:",
|
|
572
|
+
" 1) npx zod-envkit init",
|
|
573
|
+
" 2) npx zod-envkit generate",
|
|
574
|
+
" 3) npx zod-envkit show",
|
|
575
|
+
" 4) npx zod-envkit check --strict",
|
|
576
|
+
"",
|
|
577
|
+
"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u043A\u043E\u043C\u0430\u043D\u0434\u044B:",
|
|
578
|
+
` ${commandNames}`,
|
|
579
|
+
"",
|
|
580
|
+
"\u0420\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0443\u0435\u043C\u044B\u0435 workflow:",
|
|
581
|
+
" - \u0441\u0442\u0430\u0440\u0442 \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0435\u0433\u043E env example:",
|
|
582
|
+
" npx zod-envkit init --input .env.example --output env.meta.json",
|
|
583
|
+
" - \u0434\u0435\u0442\u0435\u0440\u043C\u0438\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F \u0432 CI:",
|
|
584
|
+
" npx zod-envkit generate --format md --sort required-first",
|
|
585
|
+
" npx zod-envkit check --strict --dotenv .env,.env.local",
|
|
586
|
+
" - \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u0430 schema \u2194 meta:",
|
|
587
|
+
" npx zod-envkit check --schema ./schema/env.mjs --schema-mode strict",
|
|
588
|
+
"",
|
|
589
|
+
"\u0414\u0435\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u043F\u0440\u0430\u0432\u043A\u0430 \u043F\u043E \u043A\u043E\u043C\u0430\u043D\u0434\u0430\u043C:",
|
|
590
|
+
""
|
|
591
|
+
] : [
|
|
592
|
+
"=== zod-envkit deep help ===",
|
|
593
|
+
"",
|
|
594
|
+
"Core idea:",
|
|
595
|
+
" env.meta.json is the source of truth for docs, checks and onboarding.",
|
|
596
|
+
"",
|
|
597
|
+
"Quick start:",
|
|
598
|
+
" 1) npx zod-envkit init",
|
|
599
|
+
" 2) npx zod-envkit generate",
|
|
600
|
+
" 3) npx zod-envkit show",
|
|
601
|
+
" 4) npx zod-envkit check --strict",
|
|
602
|
+
"",
|
|
603
|
+
"Available commands:",
|
|
604
|
+
` ${commandNames}`,
|
|
605
|
+
"",
|
|
606
|
+
"Recommended workflows:",
|
|
607
|
+
" - bootstrap from existing env example:",
|
|
608
|
+
" npx zod-envkit init --input .env.example --output env.meta.json",
|
|
609
|
+
" - keep docs deterministic in CI:",
|
|
610
|
+
" npx zod-envkit generate --format md --sort required-first",
|
|
611
|
+
" npx zod-envkit check --strict --dotenv .env,.env.local",
|
|
612
|
+
" - validate schema contract against meta:",
|
|
613
|
+
" npx zod-envkit check --schema ./schema/env.mjs --schema-mode strict",
|
|
614
|
+
"",
|
|
615
|
+
"Detailed command reference:",
|
|
616
|
+
""
|
|
617
|
+
];
|
|
618
|
+
for (const cmd of program.commands) {
|
|
619
|
+
blocks.push(cmd.helpInformation().trim(), "");
|
|
620
|
+
}
|
|
621
|
+
if (lang === "ru") {
|
|
622
|
+
blocks.push(
|
|
623
|
+
"\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438:",
|
|
624
|
+
" - \u044F\u0437\u044B\u043A CLI: --lang en|ru",
|
|
625
|
+
" - \u0441\u043F\u0440\u0430\u0432\u043A\u0430 \u043F\u043E \u043A\u043E\u043C\u0430\u043D\u0434\u0435: npx zod-envkit help <command>",
|
|
626
|
+
" - \u043F\u043E\u043B\u043D\u044B\u0439 \u0433\u0430\u0439\u0434: npx zod-envkit help --all"
|
|
627
|
+
);
|
|
628
|
+
} else {
|
|
629
|
+
blocks.push(
|
|
630
|
+
"Tips:",
|
|
631
|
+
" - global language: --lang en|ru",
|
|
632
|
+
" - command help: npx zod-envkit help <command>",
|
|
633
|
+
" - full handbook: npx zod-envkit help --all"
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
return `${blocks.join("\n").trimEnd()}
|
|
637
|
+
`;
|
|
638
|
+
}
|
|
639
|
+
program.addHelpText("after", () => {
|
|
640
|
+
const lang = resolveLang(resolveCliLangArg(process.argv.slice(2)));
|
|
641
|
+
return lang === "ru" ? "\n\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E: `npx zod-envkit help --all` \u0432\u044B\u0432\u043E\u0434\u0438\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u0443\u044E \u0441\u043F\u0440\u0430\u0432\u043A\u0443 \u0441 workflow \u0438 \u043F\u043E\u043B\u043D\u043E\u0439 \u0441\u0432\u043E\u0434\u043A\u043E\u0439 \u043A\u043E\u043C\u0430\u043D\u0434.\n" : "\nTip: `npx zod-envkit help --all` prints an extended handbook with workflows and full command reference.\n";
|
|
642
|
+
});
|
|
643
|
+
var cliArgs = process.argv.slice(2);
|
|
644
|
+
if (cliArgs[0] === "help" && cliArgs.includes("--all")) {
|
|
645
|
+
const lang = resolveLang(resolveCliLangArg(cliArgs));
|
|
646
|
+
process.stdout.write(renderDeepHelp(lang));
|
|
647
|
+
process.exit(0);
|
|
648
|
+
}
|
|
553
649
|
program.parse(process.argv);
|