zod-envkit 1.3.1 → 1.3.2

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 CHANGED
@@ -1,30 +1,32 @@
1
- ## [1.3.1](https://github.com/nxtxe/zod-envkit/compare/v1.3.0...v1.3.1) (2026-03-19)
1
+ ## [1.3.2](https://github.com/nxtxe/zod-envkit/compare/v1.3.1...v1.3.2) (2026-03-23)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **cli:** improve env error grouping and hints ([d098a70](https://github.com/nxtxe/zod-envkit/commit/d098a70683f8028b7be275bd16a580f4fccb4938))
6
+ * handle meta fallback edge case ([f54596e](https://github.com/nxtxe/zod-envkit/commit/f54596e9835f47076c079029f2c926228329d990))
7
+
8
+ ## [1.3.2](https://github.com/nxtxe/zod-envkit/compare/v1.3.1...v1.3.2) (2026-03-xx)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * edge hardening for meta fallback:
14
+ * fail with actionable guidance when `.env.example` exists but has no parseable variables
15
+ * keep fallback behavior for valid `.env.example` (minimal meta generation)
16
+ * improve robustness coverage for edge paths:
17
+ * invalid JSON meta
18
+ * missing meta + fallback behavior
19
+ * strict dotenv-only checks
20
+ * repeated runs/idempotency scenarios
7
21
 
8
- ## [1.3.1](https://github.com/nxtxe/zod-envkit/compare/v1.3.0...v1.3.1) (2026-03-xx)
22
+ ## [1.3.1](https://github.com/nxtxe/zod-envkit/compare/v1.3.0...v1.3.1) (2026-03-19)
9
23
 
10
24
 
11
25
  ### Bug Fixes
12
26
 
13
- * Improve `zod-envkit check` error output by grouping issues:
14
- * clearly separate missing required variables and unknown variables (in strict mode)
15
- * use a single `ENV_INVALID` header with structured sections instead of multiple disjoint messages
16
- * Add actionable hints for env meta issues:
17
- * on `META_PARSE_FAILED`, show which file failed and suggest `npx zod-envkit generate -c env.meta.json`
18
- * on `META_NOT_FOUND` (and no `.env.example`), suggest generating `env.meta.json` from CLI
19
- * Clarify strict mode behavior in unknown-variable messages:
20
- * `UNKNOWN_ENV` now explicitly states that only dotenv-loaded keys are checked in `--strict` mode
21
- * Keep CLI contracts stable:
22
- * exit codes unchanged
23
- * `zod-envkit show` table format unchanged
24
- * `formatZodError` output shape unchanged
25
- * no JSON structures were modified
26
-
27
- # [1.3.0](https://github.com/nxtxe/zod-envkit/compare/v1.2.3...v1.3.0) (2026-03-04)
27
+ * **cli:** improve env error grouping and hints ([d098a70](https://github.com/nxtxe/zod-envkit/commit/d098a70683f8028b7be275bd16a580f4fccb4938))
28
+
29
+ ## [1.3.0](https://github.com/nxtxe/zod-envkit/compare/v1.2.3...v1.3.0) (2026-03-04)
28
30
 
29
31
 
30
32
  ### Features
@@ -34,6 +34,7 @@ var messages = {
34
34
  META_TRIED: "Tried:",
35
35
  META_TIP: "Tip:",
36
36
  META_PARSE_FAILED: "Failed to read/parse env meta file:",
37
+ META_EXAMPLE_EMPTY: ".env.example exists but has no parseable variables.",
37
38
  META_FALLBACK_EXAMPLE: "env.meta.json not found, falling back to .env.example (minimal meta).",
38
39
  META_FALLBACK_TIP: "Tip: create env.meta.json for richer docs, grouping, and stable CLI behavior.",
39
40
  GENERATED: "Generated: {example}, {docs}",
@@ -57,6 +58,7 @@ var messages = {
57
58
  META_TRIED: "\u041F\u0440\u043E\u0431\u043E\u0432\u0430\u043B\u0438:",
58
59
  META_TIP: "\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430:",
59
60
  META_PARSE_FAILED: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0438\u043B\u0438 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0438\u0442\u044C env meta \u0444\u0430\u0439\u043B:",
61
+ META_EXAMPLE_EMPTY: ".env.example \u043D\u0430\u0439\u0434\u0435\u043D, \u043D\u043E \u0432 \u043D\u0435\u043C \u043D\u0435\u0442 \u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u0432\u0430\u0435\u043C\u044B\u0445 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445.",
60
62
  META_FALLBACK_EXAMPLE: "env.meta.json \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C .env.example \u043A\u0430\u043A \u043C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0443\u044E \u043C\u0435\u0442\u0443.",
61
63
  META_FALLBACK_TIP: "\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430: \u043B\u0443\u0447\u0448\u0435 \u0441\u043E\u0437\u0434\u0430\u0442\u044C env.meta.json \u2014 \u0431\u0443\u0434\u0435\u0442 \u0431\u043E\u0433\u0430\u0447\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F \u0438 \u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u0435\u0435 CLI-\u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442.",
62
64
  GENERATED: "\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043E: {example}, {docs}",
@@ -172,10 +174,21 @@ function loadMeta(lang, configFile) {
172
174
  }
173
175
  const examplePath = import_node_path.default.resolve(process.cwd(), ".env.example");
174
176
  if (import_node_fs.default.existsSync(examplePath)) {
177
+ const meta = buildMetaFromEnvExample(examplePath);
178
+ const keys = Object.keys(meta);
179
+ if (keys.length === 0) {
180
+ fail(lang, "META_EXAMPLE_EMPTY", [
181
+ `- ${examplePath}`,
182
+ "",
183
+ t(lang, "META_TIP"),
184
+ " Add at least one KEY=value line to .env.example,",
185
+ " or create env.meta.json and run: npx zod-envkit generate -c env.meta.json"
186
+ ]);
187
+ }
175
188
  console.warn(`\u26A0\uFE0F ${t(lang, "META_FALLBACK_EXAMPLE")}`);
176
189
  console.warn(` ${t(lang, "META_FALLBACK_TIP")}`);
177
190
  console.warn("");
178
- return { meta: buildMetaFromEnvExample(examplePath), configPath: examplePath };
191
+ return { meta, configPath: examplePath };
179
192
  }
180
193
  fail(lang, "META_NOT_FOUND", [
181
194
  t(lang, "META_TRIED"),
package/dist/cli/index.js CHANGED
@@ -18,6 +18,7 @@ var messages = {
18
18
  META_TRIED: "Tried:",
19
19
  META_TIP: "Tip:",
20
20
  META_PARSE_FAILED: "Failed to read/parse env meta file:",
21
+ META_EXAMPLE_EMPTY: ".env.example exists but has no parseable variables.",
21
22
  META_FALLBACK_EXAMPLE: "env.meta.json not found, falling back to .env.example (minimal meta).",
22
23
  META_FALLBACK_TIP: "Tip: create env.meta.json for richer docs, grouping, and stable CLI behavior.",
23
24
  GENERATED: "Generated: {example}, {docs}",
@@ -41,6 +42,7 @@ var messages = {
41
42
  META_TRIED: "\u041F\u0440\u043E\u0431\u043E\u0432\u0430\u043B\u0438:",
42
43
  META_TIP: "\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430:",
43
44
  META_PARSE_FAILED: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0438\u043B\u0438 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0438\u0442\u044C env meta \u0444\u0430\u0439\u043B:",
45
+ META_EXAMPLE_EMPTY: ".env.example \u043D\u0430\u0439\u0434\u0435\u043D, \u043D\u043E \u0432 \u043D\u0435\u043C \u043D\u0435\u0442 \u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u0432\u0430\u0435\u043C\u044B\u0445 \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445.",
44
46
  META_FALLBACK_EXAMPLE: "env.meta.json \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C .env.example \u043A\u0430\u043A \u043C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0443\u044E \u043C\u0435\u0442\u0443.",
45
47
  META_FALLBACK_TIP: "\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430: \u043B\u0443\u0447\u0448\u0435 \u0441\u043E\u0437\u0434\u0430\u0442\u044C env.meta.json \u2014 \u0431\u0443\u0434\u0435\u0442 \u0431\u043E\u0433\u0430\u0447\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F \u0438 \u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u0435\u0435 CLI-\u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442.",
46
48
  GENERATED: "\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043E: {example}, {docs}",
@@ -156,10 +158,21 @@ function loadMeta(lang, configFile) {
156
158
  }
157
159
  const examplePath = path.resolve(process.cwd(), ".env.example");
158
160
  if (fs.existsSync(examplePath)) {
161
+ const meta = buildMetaFromEnvExample(examplePath);
162
+ const keys = Object.keys(meta);
163
+ if (keys.length === 0) {
164
+ fail(lang, "META_EXAMPLE_EMPTY", [
165
+ `- ${examplePath}`,
166
+ "",
167
+ t(lang, "META_TIP"),
168
+ " Add at least one KEY=value line to .env.example,",
169
+ " or create env.meta.json and run: npx zod-envkit generate -c env.meta.json"
170
+ ]);
171
+ }
159
172
  console.warn(`\u26A0\uFE0F ${t(lang, "META_FALLBACK_EXAMPLE")}`);
160
173
  console.warn(` ${t(lang, "META_FALLBACK_TIP")}`);
161
174
  console.warn("");
162
- return { meta: buildMetaFromEnvExample(examplePath), configPath: examplePath };
175
+ return { meta, configPath: examplePath };
163
176
  }
164
177
  fail(lang, "META_NOT_FOUND", [
165
178
  t(lang, "META_TRIED"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-envkit",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Validate environment variables with Zod and generate .env.example",
5
5
  "license": "MIT",
6
6
  "author": "",