Problem
Application code frequently references environment variables via untyped string lookups (e.g. process.env.PORT or os.Getenv("PORT")), resulting in runtime crashes when required variables or types are invalid.
Proposed Solution
Add an exenv schema / exenv typegen command that reads .env.example (with annotations like @bool, @options, @required) and generates strongly-typed definition files or runtime schemas for target languages.
Expected Behavior
exenv schema --format typescript: Generates TypeScript declarations (env.d.ts) or Zod schema objects (env.schema.ts).
exenv schema --format go: Generates a Go struct with typed fields, default values, and validation methods.
exenv schema --format json: Exports a standard JSON Schema describing all environment variables, types, and constraints.
Acceptance Criteria
- Generated code accurately reflects requiredness, default values, and allowed enum options.
- Output files can be written to stdout or specified file paths.
- Generates clean, idiomatic code without external runtime dependencies where possible.
Problem
Application code frequently references environment variables via untyped string lookups (e.g.
process.env.PORToros.Getenv("PORT")), resulting in runtime crashes when required variables or types are invalid.Proposed Solution
Add an
exenv schema/exenv typegencommand that reads.env.example(with annotations like@bool,@options,@required) and generates strongly-typed definition files or runtime schemas for target languages.Expected Behavior
exenv schema --format typescript: Generates TypeScript declarations (env.d.ts) or Zod schema objects (env.schema.ts).exenv schema --format go: Generates a Go struct with typed fields, default values, and validation methods.exenv schema --format json: Exports a standard JSON Schema describing all environment variables, types, and constraints.Acceptance Criteria