Skip to content

feat(COMPT-50): implement Zod-based env schema validation engine#2

Merged
y-aithnini merged 4 commits intodevelopfrom
feature/COMPT-50-zod-validation-engine
Apr 6, 2026
Merged

feat(COMPT-50): implement Zod-based env schema validation engine#2
y-aithnini merged 4 commits intodevelopfrom
feature/COMPT-50-zod-validation-engine

Conversation

@y-aithnini
Copy link
Copy Markdown

  • Add defineConfig(schema) returning ConfigDefinition
  • 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

Summary

  • What does this PR change?

Why

  • Why is this change needed?

Checklist

  • Added/updated tests (if behavior changed)
  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Added a changeset (npx changeset) if this affects consumers

Notes

  • Anything reviewers should pay attention to?

- 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
@y-aithnini y-aithnini requested a review from a team as a code owner April 6, 2026 12:42
Copilot AI review requested due to automatic review settings April 6, 2026 12:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and ConfigDefinition.parse() to validate process.env via a consumer-provided Zod object schema.
  • Added ConfigValidationError that carries ZodIssue[] 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.

@y-aithnini y-aithnini merged commit e21d112 into develop Apr 6, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants