feat(COMPT-50): implement Zod-based env schema validation engine#2
Merged
y-aithnini merged 4 commits intodevelopfrom Apr 6, 2026
Merged
Conversation
- Add defineConfig(schema) returning ConfigDefinition<T> - Add ConfigDefinition.parse() — validates process.env synchronously, returns frozen fully-typed config, throws ConfigValidationError on failure - Add ConfigValidationError extending Error with fields: ZodIssue[] - Add zod as peerDependency (^3 || ^4) - Install zod as devDependency for local development - Update src/index.ts to export defineConfig, ConfigDefinition, ConfigValidationError - Add node to tsconfig types array for process.env access
There was a problem hiding this comment.
Pull request overview
Implements the initial Zod-backed environment schema validation “engine” for @ciscode/config-kit, exposing a defineConfig() API plus a dedicated validation error type for startup-time env validation.
Changes:
- Added
defineConfig()andConfigDefinition.parse()to validateprocess.envvia a consumer-provided Zod object schema. - Added
ConfigValidationErrorthat carriesZodIssue[]and formats a multi-issue error message. - Updated public exports and package/tooling configuration (Zod peer+dev dependency, Node types in TS config).
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Adds node types to support process.env typing. |
| src/index.ts | Updates the public API exports to expose the new validation engine + error. |
| src/define-config.ts | Introduces ConfigDefinition + defineConfig() with safeParse and frozen output. |
| src/errors/config-validation.error.ts | Adds a custom error type wrapping ZodIssue[] with a multi-line message. |
| package.json | Adds zod as a peer dependency (and dev dependency for local development). |
| package-lock.json | Locks the added zod dev dependency and updates lock metadata accordingly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Checklist
npm run lintpassesnpm run typecheckpassesnpm testpassesnpm run buildpassesnpx changeset) if this affects consumersNotes