@xlameiro/env-typegen 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js","../src/cli.ts","../src/config.ts","../src/pipeline.ts","../src/generators/declaration-generator.ts","../src/generators/t3-generator.ts","../src/generators/typescript-generator.ts","../src/generators/zod-generator.ts","../src/parser/env-parser.ts","../src/inferrer/rules.ts","../src/inferrer/type-inferrer.ts","../src/parser/comment-parser.ts","../src/utils/file.ts","../src/utils/format.ts","../src/utils/logger.ts","../src/watch.ts"],"sourcesContent":["let p = process || {}, argv = p.argv || [], env = p.env || {}\nlet isColorSupported =\n\t!(!!env.NO_COLOR || argv.includes(\"--no-color\")) &&\n\t(!!env.FORCE_COLOR || argv.includes(\"--color\") || p.platform === \"win32\" || ((p.stdout || {}).isTTY && env.TERM !== \"dumb\") || !!env.CI)\n\nlet formatter = (open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input, index = string.indexOf(close, open.length)\n\t\treturn ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\", cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet f = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: f(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: f(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: f(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: f(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: f(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: f(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: f(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: f(\"\\x1b[9m\", \"\\x1b[29m\"),\n\n\t\tblack: f(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: f(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: f(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: f(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: f(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: f(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: f(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: f(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\n\t\tbgBlack: f(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: f(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: f(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: f(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: f(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: f(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: f(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: f(\"\\x1b[47m\", \"\\x1b[49m\"),\n\n\t\tblackBright: f(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tredBright: f(\"\\x1b[91m\", \"\\x1b[39m\"),\n\t\tgreenBright: f(\"\\x1b[92m\", \"\\x1b[39m\"),\n\t\tyellowBright: f(\"\\x1b[93m\", \"\\x1b[39m\"),\n\t\tblueBright: f(\"\\x1b[94m\", \"\\x1b[39m\"),\n\t\tmagentaBright: f(\"\\x1b[95m\", \"\\x1b[39m\"),\n\t\tcyanBright: f(\"\\x1b[96m\", \"\\x1b[39m\"),\n\t\twhiteBright: f(\"\\x1b[97m\", \"\\x1b[39m\"),\n\n\t\tbgBlackBright: f(\"\\x1b[100m\", \"\\x1b[49m\"),\n\t\tbgRedBright: f(\"\\x1b[101m\", \"\\x1b[49m\"),\n\t\tbgGreenBright: f(\"\\x1b[102m\", \"\\x1b[49m\"),\n\t\tbgYellowBright: f(\"\\x1b[103m\", \"\\x1b[49m\"),\n\t\tbgBlueBright: f(\"\\x1b[104m\", \"\\x1b[49m\"),\n\t\tbgMagentaBright: f(\"\\x1b[105m\", \"\\x1b[49m\"),\n\t\tbgCyanBright: f(\"\\x1b[106m\", \"\\x1b[49m\"),\n\t\tbgWhiteBright: f(\"\\x1b[107m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n","// CLI entry point — shebang (#!/usr/bin/env node) is injected by tsup banner config.\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { inspect, parseArgs } from \"node:util\";\n\nimport { loadConfig, type EnvTypegenConfig, type GeneratorName } from \"./config.js\";\nimport { runGenerate, type RunGenerateOptions } from \"./pipeline.js\";\nimport { error } from \"./utils/logger.js\";\nimport { startWatch } from \"./watch.js\";\n\n// Re-export for consumers who import programmatic API via this file\nexport { runGenerate } from \"./pipeline.js\";\nexport type { RunGenerateOptions } from \"./pipeline.js\";\n\nconst VERSION = \"0.1.0\";\n\nconst HELP_TEXT = [\n \"env-typegen — Generate TypeScript types from .env.example\",\n \"\",\n \"Usage:\",\n \" env-typegen -i <path> [options]\",\n \"\",\n \"Options:\",\n \" -i, --input <path> Path to .env.example file\",\n \" -o, --output <path> Output file path (default: env.generated.ts)\",\n \" -f, --format <name> Generator format: ts|zod|t3|declaration\",\n \" May be specified multiple times.\",\n \" -g, --generator <name> Backward-compatible alias for --format\",\n \" --stdout Print generated output to stdout\",\n \" --dry-run Parse and generate without writing files\",\n \" --no-format Disable prettier formatting\",\n \" -s, --silent Suppress success logs\",\n \" -w, --watch Watch for changes and regenerate\",\n \" -c, --config <path> Path to config file\",\n \" -v, --version Print version\",\n \" -h, --help Show this help\",\n].join(\"\\n\");\n\nconst FORMAT_TO_GENERATOR: Readonly<Record<string, GeneratorName>> = {\n ts: \"typescript\",\n typescript: \"typescript\",\n zod: \"zod\",\n t3: \"t3\",\n declaration: \"declaration\",\n};\n\nfunction normalizeGenerator(input: string): GeneratorName | undefined {\n return FORMAT_TO_GENERATOR[input] ?? FORMAT_TO_GENERATOR[input.toLowerCase()];\n}\n\nfunction getErrorMessage(errorValue: unknown): string {\n if (errorValue instanceof Error) {\n return errorValue.message;\n }\n\n return inspect(errorValue, { depth: 2 });\n}\n\n/**\n * Parses command-line arguments and runs the CLI.\n *\n * Exported for unit testing — pass a custom argv array to avoid reading\n * from process.argv.\n */\nexport async function runCli(argv: string[] = process.argv.slice(2)): Promise<void> {\n const { values } = parseArgs({\n args: argv,\n options: {\n input: { type: \"string\", short: \"i\" },\n output: { type: \"string\", short: \"o\" },\n generator: { type: \"string\", short: \"g\", multiple: true },\n format: { type: \"string\", short: \"f\", multiple: true },\n \"no-format\": { type: \"boolean\" },\n stdout: { type: \"boolean\" },\n \"dry-run\": { type: \"boolean\" },\n silent: { type: \"boolean\", short: \"s\" },\n watch: { type: \"boolean\", short: \"w\" },\n config: { type: \"string\", short: \"c\" },\n version: { type: \"boolean\", short: \"v\" },\n help: { type: \"boolean\", short: \"h\" },\n } as const,\n });\n\n if (values.version === true) {\n console.log(VERSION);\n return;\n }\n\n if (values.help === true) {\n console.log(HELP_TEXT);\n return;\n }\n\n // Load config file — explicit path from --config, or auto-discover in cwd\n let fileConfig: EnvTypegenConfig | undefined;\n if (values.config !== undefined) {\n const configPath = path.resolve(values.config);\n const mod = (await import(pathToFileURL(configPath).href)) as {\n default?: EnvTypegenConfig;\n };\n fileConfig = mod.default;\n } else {\n fileConfig = await loadConfig(process.cwd());\n }\n\n // Merge: CLI flags take precedence over config file values\n const input = values.input ?? fileConfig?.input;\n if (input === undefined) {\n error(\"No input file specified. Use -i <path> or set input in env-typegen.config.ts\");\n process.exit(1);\n }\n\n const output = values.output ?? fileConfig?.output ?? \"env.generated.ts\";\n\n // Collect and validate generators from --format (spec) and --generator (compat)\n const rawFormats = values.format;\n const rawGenerators = values.generator;\n\n const requested = [...(rawFormats ?? []), ...(rawGenerators ?? [])].map(String);\n let generators: GeneratorName[];\n if (requested.length > 0) {\n const normalizedGenerators = requested\n .map((item) => normalizeGenerator(item))\n .filter((item): item is GeneratorName => item !== undefined);\n\n const invalid = requested.filter((item) => normalizeGenerator(item) === undefined);\n if (invalid.length > 0) {\n error(`Unknown format(s): ${invalid.join(\", \")}. Valid: ts, zod, t3, declaration`);\n process.exit(1);\n }\n\n generators = [...new Set(normalizedGenerators)];\n } else {\n generators = fileConfig?.generators ?? ([\"typescript\"] as GeneratorName[]);\n }\n\n const shouldFormat = values[\"no-format\"] === true ? false : (fileConfig?.format ?? true);\n const useStdout = values.stdout ?? false;\n const isDryRun = values[\"dry-run\"] ?? false;\n const isSilent = values.silent ?? false;\n const shouldWatch = values.watch ?? false;\n\n const options: RunGenerateOptions = {\n input,\n output,\n generators,\n format: shouldFormat,\n stdout: useStdout,\n dryRun: isDryRun,\n silent: isSilent,\n };\n\n if (shouldWatch) {\n startWatch({ inputPath: input, runOptions: options });\n } else {\n await runGenerate(options);\n }\n}\n\n// Only auto-execute when this file is the CLI entry point, not when imported\nif (\n process.argv[1] !== undefined &&\n path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url))\n) {\n await runCli().catch((err: unknown) => {\n error(getErrorMessage(err));\n process.exit(1);\n });\n}\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\n/** Generator identifiers supported by env-typegen. */\nexport type GeneratorName = \"typescript\" | \"zod\" | \"t3\" | \"declaration\";\n\n/** Configuration shape accepted by env-typegen's CLI and programmatic API. */\nexport type EnvTypegenConfig = {\n /** Path to the .env.example file to parse. */\n input: string;\n /** Output directory for generated files. Defaults to the input file's directory. */\n output?: string;\n /** Which generators to run. When omitted, all four generators run. */\n generators?: GeneratorName[];\n /** Format generated output with prettier. Defaults to true. */\n format?: boolean;\n};\n\n/** Config file names searched in order when calling loadConfig(). */\nconst CONFIG_FILE_NAMES = [\n \"env-typegen.config.ts\",\n \"env-typegen.config.mjs\",\n \"env-typegen.config.js\",\n] as const;\n\n/**\n * Type-safe config helper.\n * Returns the config object unchanged — exists purely for IDE autocompletion\n * and compile-time validation of the config shape.\n */\nexport function defineConfig(config: EnvTypegenConfig): EnvTypegenConfig {\n return config;\n}\n\n/**\n * Loads env-typegen config by searching for a config file in `cwd`.\n * Searches for env-typegen.config.ts → .mjs → .js in order.\n * Returns `undefined` when no config file is found.\n */\nexport async function loadConfig(\n cwd: string = process.cwd(),\n): Promise<EnvTypegenConfig | undefined> {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.resolve(cwd, name);\n if (existsSync(filePath)) {\n const fileUrl = pathToFileURL(filePath).href;\n const mod = (await import(fileUrl)) as { default?: EnvTypegenConfig };\n return mod.default;\n }\n }\n return undefined;\n}\n","import path from \"node:path\";\n\nimport { type GeneratorName } from \"./config.js\";\nimport { generateDeclaration } from \"./generators/declaration-generator.js\";\nimport { generateT3Env } from \"./generators/t3-generator.js\";\nimport { generateTypeScriptTypes } from \"./generators/typescript-generator.js\";\nimport { generateZodSchema } from \"./generators/zod-generator.js\";\nimport { parseEnvFileContent } from \"./parser/env-parser.js\";\nimport type { ParsedEnvFile } from \"./parser/types.js\";\nimport { readEnvFile, writeOutput } from \"./utils/file.js\";\nimport { formatOutput } from \"./utils/format.js\";\nimport { success } from \"./utils/logger.js\";\n\n/** Options accepted by the runGenerate pipeline. */\nexport type RunGenerateOptions = {\n input: string;\n output: string;\n generators: GeneratorName[];\n format: boolean;\n stdout?: boolean;\n dryRun?: boolean;\n silent?: boolean;\n};\n\n/** Derive the output file path for a generator when multiple generators are in use. */\nfunction deriveOutputPath(base: string, generator: GeneratorName, isSingle: boolean): string {\n if (isSingle) return base;\n const ext = path.extname(base);\n const noExt = ext.length > 0 ? base.slice(0, -ext.length) : base;\n return `${noExt}.${generator}${ext.length > 0 ? ext : \".ts\"}`;\n}\n\n/** Invoke the correct generator function for the given name. */\nfunction buildOutput(generator: GeneratorName, parsed: ParsedEnvFile): string {\n switch (generator) {\n case \"typescript\":\n return generateTypeScriptTypes(parsed);\n case \"zod\":\n return generateZodSchema(parsed);\n case \"t3\":\n return generateT3Env(parsed);\n case \"declaration\":\n return generateDeclaration(parsed);\n }\n}\n\nasync function persistOutput(params: {\n generated: string;\n generator: GeneratorName;\n outputPath: string;\n isSingle: boolean;\n stdout: boolean;\n dryRun: boolean;\n silent: boolean;\n}): Promise<void> {\n const { generated, generator, outputPath, isSingle, stdout, dryRun, silent } = params;\n\n if (stdout) {\n if (isSingle) {\n console.log(generated);\n } else {\n console.log(`// --- ${generator}:${outputPath} ---`);\n console.log(generated);\n }\n return;\n }\n\n if (dryRun) {\n if (!silent) {\n success(`Dry run: ${outputPath}`);\n }\n return;\n }\n\n await writeOutput(outputPath, generated);\n if (!silent) {\n success(`Generated ${outputPath}`);\n }\n}\n\n/**\n * Reads the input file, runs the requested generators, optionally formats each\n * output, and writes the results to disk.\n *\n * Exported for unit testing — call this directly rather than spawning a child process.\n */\nexport async function runGenerate(options: RunGenerateOptions): Promise<void> {\n const {\n input,\n output,\n generators,\n format: shouldFormat,\n stdout = false,\n dryRun = false,\n silent = false,\n } = options;\n const isSingle = generators.length === 1;\n\n const content = await readEnvFile(input);\n const parsed = parseEnvFileContent(content, input);\n\n for (const generator of generators) {\n let generated = buildOutput(generator, parsed);\n if (shouldFormat) {\n generated = await formatOutput(generated);\n }\n const outputPath = deriveOutputPath(output, generator, isSingle);\n await persistOutput({\n generated,\n generator,\n outputPath,\n isSingle,\n stdout,\n dryRun,\n silent,\n });\n }\n}\n","import path from \"node:path\";\n\nimport type { ParsedEnvFile } from \"../parser/types.js\";\n\n/**\n * Generates an ambient `.d.ts` declaration file from a parsed .env.example.\n *\n * Output is a pure `NodeJS.ProcessEnv` augmentation — no `export type` statements.\n * This makes the file valid as a global ambient declaration that can be dropped\n * into `lib/` or `types/` without affecting module resolution.\n *\n * Output structure:\n * ```\n * // Generated by env-typegen — do not edit manually\n * // Source: .env.example\n *\n * declare namespace NodeJS {\n * interface ProcessEnv {\n * readonly KEY: string; // all vars are runtime strings\n * readonly OPT?: string; // optional vars use ?: string\n * readonly NUM: string; // coerce to number: Number(process.env.NUM)\n * readonly FLAG: string; // coerce to boolean: process.env.FLAG === 'true'\n * }\n * }\n * ```\n *\n * For a `.ts` output with typed `export type EnvVars` / `ServerEnvVars` /\n * `ClientEnvVars`, use `generateTypeScriptTypes` instead.\n *\n * - `ProcessEnv` uses `readonly string` for every variable (runtime reality)\n * - Number and boolean vars include an inline coercion hint comment\n * - `annotatedType` takes precedence over `inferredType`\n */\nexport function generateDeclaration(parsed: ParsedEnvFile): string {\n const fileName = path.basename(parsed.filePath);\n const lines: string[] = [];\n\n // Header\n lines.push(\"// Generated by env-typegen — do not edit manually\");\n lines.push(`// Source: ${fileName}`);\n lines.push(\"\");\n\n // NodeJS.ProcessEnv augmentation — ambient only, no exports\n lines.push(\"declare namespace NodeJS {\");\n lines.push(\" interface ProcessEnv {\");\n for (const variable of parsed.vars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n const optional = variable.isOptional ? \"?\" : \"\";\n if (variable.description !== undefined) {\n lines.push(` /** ${variable.description} */`);\n }\n let propLine = ` readonly ${variable.key}${optional}: string;`;\n if (effectiveType === \"number\") {\n propLine += ` // coerce to number: Number(process.env.${variable.key})`;\n } else if (effectiveType === \"boolean\") {\n propLine += ` // coerce to boolean: process.env.${variable.key} === 'true'`;\n }\n lines.push(propLine);\n }\n lines.push(\" }\");\n lines.push(\"}\");\n\n return lines.join(\"\\n\") + \"\\n\";\n}\n","import type { EnvVarType, ParsedEnvFile } from \"../parser/types.js\";\n\n/**\n * Maps an EnvVarType to its Zod schema expression for use in t3-env createEnv().\n *\n * Note: boolean uses `z.coerce.boolean()` here (not the `.transform()` approach\n * in the standalone zod-generator) because @t3-oss/env-nextjs handles coercion\n * internally with `z.coerce`.\n */\nfunction toT3ZodType(envVarType: EnvVarType): string {\n if (envVarType === \"number\") return \"z.coerce.number()\";\n if (envVarType === \"boolean\") return \"z.coerce.boolean()\";\n if (envVarType === \"url\") return \"z.string().url()\";\n if (envVarType === \"email\") return \"z.string().email()\";\n return \"z.string()\";\n}\n\n/**\n * Generates a `@t3-oss/env-nextjs` configuration file from a parsed .env.example.\n *\n * Output structure:\n * ```\n * import { createEnv } from \"@t3-oss/env-nextjs\";\n * import { z } from \"zod\";\n *\n * export const env = createEnv({\n * server: { /* non-NEXT_PUBLIC_ vars *\\/ },\n * client: { /* NEXT_PUBLIC_ vars *\\/ },\n * runtimeEnv: { /* all vars mapped to process.env *\\/ },\n * });\n * ```\n *\n * - `server:` is omitted when there are no server-side vars\n * - `client:` is omitted when there are no client-side vars (NEXT_PUBLIC_ prefix)\n * - `runtimeEnv:` always includes all vars\n * - `annotatedType` takes precedence over `inferredType`\n * - Optional vars have `.optional()` appended\n * - Vars with a description have `.describe(\"text\")` appended (before `.optional()`)\n */\nexport function generateT3Env(parsed: ParsedEnvFile): string {\n const serverVars = parsed.vars.filter((v) => !v.isClientSide);\n const clientVars = parsed.vars.filter((v) => v.isClientSide);\n const lines: string[] = [];\n\n lines.push(\"// Generated by env-typegen — do not edit manually\");\n lines.push('import { createEnv } from \"@t3-oss/env-nextjs\";');\n lines.push('import { z } from \"zod\";');\n lines.push(\"\");\n lines.push(\"export const env = createEnv({\");\n\n if (serverVars.length > 0) {\n lines.push(\" server: {\");\n for (const variable of serverVars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n let zodExpr = toT3ZodType(effectiveType);\n if (variable.description !== undefined) {\n zodExpr += `.describe(\"${variable.description}\")`;\n }\n if (variable.isOptional) {\n zodExpr += \".optional()\";\n }\n lines.push(` ${variable.key}: ${zodExpr},`);\n }\n lines.push(\" },\");\n }\n\n if (clientVars.length > 0) {\n lines.push(\" client: {\");\n for (const variable of clientVars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n let zodExpr = toT3ZodType(effectiveType);\n if (variable.description !== undefined) {\n zodExpr += `.describe(\"${variable.description}\")`;\n }\n if (variable.isOptional) {\n zodExpr += \".optional()\";\n }\n lines.push(` ${variable.key}: ${zodExpr},`);\n }\n lines.push(\" },\");\n }\n\n lines.push(\" runtimeEnv: {\");\n for (const variable of parsed.vars) {\n lines.push(` ${variable.key}: process.env.${variable.key},`);\n }\n lines.push(\" },\");\n lines.push(\"});\");\n\n return lines.join(\"\\n\") + \"\\n\";\n}\n","import path from \"node:path\";\n\nimport type { EnvVarType, ParsedEnvFile } from \"../parser/types.js\";\n\n/**\n * Maps an EnvVarType to its TypeScript primitive equivalent.\n * url, email, semver, json, and unknown all map to `string` because\n * TypeScript has no built-in branded types for these.\n */\nfunction toTsType(envVarType: EnvVarType): string {\n if (envVarType === \"number\") return \"number\";\n if (envVarType === \"boolean\") return \"boolean\";\n return \"string\";\n}\n\n/**\n * Generates a TypeScript source file from a parsed .env.example file.\n *\n * Output structure:\n * 1. Header comments — generated-by notice, source file name, ISO timestamp\n * 2. `declare namespace NodeJS { interface ProcessEnv { ... } }` — global augmentation\n * where all properties are typed as `readonly string` (the runtime reality).\n * Number and boolean vars include an inline coercion hint comment.\n * 3. `export type EnvVars = { ... }` — typed module export using semantic types\n * (number, boolean, string).\n * 4. `ServerEnvVars` / `ClientEnvVars` — emitted only when `NEXT_PUBLIC_` vars exist.\n *\n * The output is valid as both a `.ts` and `.d.ts` file.\n * For an ambient-only `.d.ts` (without `export type` statements), use\n * `generateDeclaration` instead.\n *\n * `annotatedType` takes precedence over `inferredType` when both are set.\n */\nexport function generateTypeScriptTypes(parsed: ParsedEnvFile): string {\n const clientVars = parsed.vars.filter((v) => v.isClientSide);\n const hasClientVars = clientVars.length > 0;\n const fileName = path.basename(parsed.filePath);\n const timestamp = new Date().toISOString();\n const lines: string[] = [];\n\n // Header\n lines.push(\"// Generated by env-typegen — do not edit manually\");\n lines.push(`// Source: ${fileName}`);\n lines.push(`// Generated at: ${timestamp}`);\n lines.push(\"\");\n\n // NodeJS.ProcessEnv augmentation — all props are runtime strings with optional coercion hints\n lines.push(\"declare namespace NodeJS {\");\n lines.push(\" interface ProcessEnv {\");\n for (const variable of parsed.vars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n const optional = variable.isOptional ? \"?\" : \"\";\n if (variable.description !== undefined) {\n lines.push(` /** ${variable.description} */`);\n }\n let propLine = ` readonly ${variable.key}${optional}: string;`;\n if (effectiveType === \"number\") {\n propLine += ` // coerce to number: Number(process.env.${variable.key})`;\n } else if (effectiveType === \"boolean\") {\n propLine += ` // coerce to boolean: process.env.${variable.key} === 'true'`;\n }\n lines.push(propLine);\n }\n lines.push(\" }\");\n lines.push(\"}\");\n lines.push(\"\");\n\n // EnvVars type with semantic TypeScript types\n lines.push(\"export type EnvVars = {\");\n for (const variable of parsed.vars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n const tsType = toTsType(effectiveType);\n const optional = variable.isOptional ? \"?\" : \"\";\n lines.push(` ${variable.key}${optional}: ${tsType};`);\n }\n lines.push(\"};\");\n\n // ServerEnvVars / ClientEnvVars — only emitted when NEXT_PUBLIC_ vars exist\n if (hasClientVars) {\n const clientKeyUnion = clientVars.map((v) => `\"${v.key}\"`).join(\" | \");\n lines.push(\"\");\n lines.push(`export type ServerEnvVars = Omit<EnvVars, ${clientKeyUnion}>;`);\n lines.push(`export type ClientEnvVars = Pick<EnvVars, ${clientKeyUnion}>;`);\n }\n\n return lines.join(\"\\n\") + \"\\n\";\n}\n\n/**\n * Generates a runtime `validateEnv()` function that throws when any required\n * environment variable is absent from `process.env`.\n */\nexport function generateEnvValidation(parsed: ParsedEnvFile): string {\n const required = parsed.vars.filter((v) => v.isRequired).map((v) => v.key);\n const lines: string[] = [];\n\n lines.push(\"// Generated by env-typegen — do not edit manually\");\n lines.push(\"\");\n lines.push(\"export function validateEnv(): void {\");\n\n if (required.length === 0) {\n lines.push(\" // No required environment variables defined\");\n } else {\n const keyList = required.map((k) => `\"${k}\"`).join(\", \");\n lines.push(` const required = [${keyList}];`);\n lines.push(\" for (const key of required) {\");\n lines.push(\" if (!process.env[key]) {\");\n lines.push(\" throw new Error(`Missing required environment variable: ${key}`);\");\n lines.push(\" }\");\n lines.push(\" }\");\n }\n\n lines.push(\"}\");\n\n return lines.join(\"\\n\") + \"\\n\";\n}\n","import type { EnvVarType, ParsedEnvFile } from \"../parser/types.js\";\n\n/**\n * Maps an EnvVarType to its Zod schema expression.\n *\n * - `number` → `z.coerce.number()` (env vars are strings; coerce handles the cast)\n * - `boolean` → `z.coerce.boolean()` (env vars are strings; coerce handles truthy cast)\n * - `url` → `z.string().url()`\n * - `email` → `z.string().email()`\n * - everything else → `z.string()` (string | semver | json | unknown)\n */\nfunction toZodType(envVarType: EnvVarType): string {\n if (envVarType === \"number\") return \"z.coerce.number()\";\n if (envVarType === \"boolean\") return \"z.coerce.boolean()\";\n if (envVarType === \"url\") return \"z.string().url()\";\n if (envVarType === \"email\") return \"z.string().email()\";\n return \"z.string()\";\n}\n\n/**\n * Generates a Zod schema file from a parsed .env.example file.\n *\n * Output structure:\n * ```\n * // Generated by env-typegen — do not edit manually\n * import { z } from \"zod\";\n *\n * export const serverEnvSchema = z.object({\n * DATABASE_URL: z.string().url(),\n * PORT: z.coerce.number(),\n * });\n *\n * export const clientEnvSchema = z.object({\n * NEXT_PUBLIC_API_URL: z.string().url(),\n * });\n *\n * export const envSchema = serverEnvSchema.merge(clientEnvSchema);\n * export type Env = z.infer<typeof envSchema>;\n * ```\n *\n * - Server-side vars (non-`NEXT_PUBLIC_`) go into `serverEnvSchema`\n * - Client-side vars (`NEXT_PUBLIC_` prefix) go into `clientEnvSchema`\n * - `envSchema` is the merged union of both, for full-stack validation\n * - `annotatedType` takes precedence over `inferredType` when both are set\n * - Optional vars have `.optional()` appended to their Zod expression\n */\nexport function generateZodSchema(parsed: ParsedEnvFile): string {\n const serverVars = parsed.vars.filter((v) => !v.isClientSide);\n const clientVars = parsed.vars.filter((v) => v.isClientSide);\n const lines: string[] = [];\n\n lines.push(\"// Generated by env-typegen — do not edit manually\");\n lines.push('import { z } from \"zod\";');\n lines.push(\"\");\n\n // serverEnvSchema — non-NEXT_PUBLIC_ vars\n lines.push(\"export const serverEnvSchema = z.object({\");\n for (const variable of serverVars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n const zodExpr = variable.isOptional\n ? `${toZodType(effectiveType)}.optional()`\n : toZodType(effectiveType);\n lines.push(` ${variable.key}: ${zodExpr},`);\n }\n lines.push(\"});\");\n lines.push(\"\");\n\n // clientEnvSchema — NEXT_PUBLIC_ vars\n lines.push(\"export const clientEnvSchema = z.object({\");\n for (const variable of clientVars) {\n const effectiveType = variable.annotatedType ?? variable.inferredType;\n const zodExpr = variable.isOptional\n ? `${toZodType(effectiveType)}.optional()`\n : toZodType(effectiveType);\n lines.push(` ${variable.key}: ${zodExpr},`);\n }\n lines.push(\"});\");\n lines.push(\"\");\n\n // Merged schema — the full validation object for use in lib/env.ts\n lines.push(\"export const envSchema = serverEnvSchema.merge(clientEnvSchema);\");\n lines.push(\"export type Env = z.infer<typeof envSchema>;\");\n\n return lines.join(\"\\n\") + \"\\n\";\n}\n","import { readFileSync } from \"node:fs\";\n\nimport { inferType } from \"../inferrer/type-inferrer.js\";\nimport { parseCommentBlock } from \"./comment-parser.js\";\nimport type { ParsedEnvFile, ParsedEnvVar } from \"./types.js\";\n\nexport { inferType } from \"../inferrer/type-inferrer.js\";\n\n/** Matches a valid env var declaration: KEY=VALUE (value may be empty) */\nconst ENV_VAR_RE = /^([A-Z_][A-Z0-9_]*)=(.*)$/;\n\n/**\n * Matches a section header comment of the form:\n * `# --- SectionName ---` or `# === SectionName ===`\n */\nconst SECTION_HEADER_RE = /^#\\s+[-=]{3,}\\s+(.+?)\\s+[-=]{3,}\\s*$/;\n\n/**\n * Parse the string content of a `.env.example` file into a `ParsedEnvFile`.\n *\n * Exposed separately from `parseEnvFile` to enable unit testing without\n * filesystem access.\n *\n * @param content - Raw file content as a UTF-8 string\n * @param filePath - Used to populate `ParsedEnvFile.filePath` only\n */\nexport function parseEnvFileContent(content: string, filePath: string): ParsedEnvFile {\n const lines = content.split(\"\\n\");\n const vars: ParsedEnvVar[] = [];\n const groups: string[] = [];\n\n let currentGroup: string | undefined;\n let commentBlock: string[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n const lineNumber = i + 1;\n const trimmed = line.trim();\n\n // Blank line — break the comment block association\n if (trimmed === \"\") {\n commentBlock = [];\n continue;\n }\n\n // Section header — update current group and reset comment block\n const sectionMatch = SECTION_HEADER_RE.exec(trimmed);\n if (sectionMatch !== null) {\n const groupName = (sectionMatch[1] ?? \"\").trim();\n currentGroup = groupName;\n if (!groups.includes(groupName)) {\n groups.push(groupName);\n }\n commentBlock = [];\n continue;\n }\n\n // Comment line — accumulate for the next env var\n if (trimmed.startsWith(\"#\")) {\n commentBlock.push(line);\n continue;\n }\n\n // Env var declaration\n const envMatch = ENV_VAR_RE.exec(trimmed);\n if (envMatch !== null) {\n const key = envMatch[1] ?? \"\";\n const rawValue = envMatch[2] ?? \"\";\n const annotations = parseCommentBlock(commentBlock);\n const inferredType = inferType(key, rawValue);\n const isRequired = rawValue.length > 0 || annotations.isRequired;\n const isOptional = rawValue.length === 0 && !annotations.isRequired;\n const isClientSide = key.startsWith(\"NEXT_PUBLIC_\");\n\n const parsedVar: ParsedEnvVar = {\n key,\n rawValue,\n inferredType,\n isRequired,\n isOptional,\n isClientSide,\n lineNumber,\n };\n\n // Only set optional fields when they have a value (exactOptionalPropertyTypes)\n if (annotations.annotatedType !== undefined) {\n parsedVar.annotatedType = annotations.annotatedType;\n }\n if (annotations.description !== undefined) {\n parsedVar.description = annotations.description;\n }\n if (currentGroup !== undefined) {\n parsedVar.group = currentGroup;\n }\n\n vars.push(parsedVar);\n commentBlock = [];\n } else {\n // Unrecognised line — reset comment block\n commentBlock = [];\n }\n }\n\n return { filePath, vars, groups };\n}\n\n/**\n * Read and parse a `.env.example` file from disk.\n *\n * @param filePath - Absolute or relative path to the file\n */\nexport function parseEnvFile(filePath: string): ParsedEnvFile {\n const content = readFileSync(filePath, \"utf8\");\n return parseEnvFileContent(content, filePath);\n}\n","import type { EnvVarType } from \"../parser/types.js\";\n\nexport type InferenceRule = {\n id: string;\n priority: number;\n match: (key: string, value: string) => boolean;\n type: EnvVarType;\n};\n\nexport const inferenceRules: readonly InferenceRule[] = [\n {\n id: \"P2_key_url_suffix\",\n priority: 2,\n match: (key: string) => key.toUpperCase().endsWith(\"_URL\"),\n type: \"url\",\n },\n {\n id: \"P3_key_email_from_suffix\",\n priority: 3,\n match: (key: string) => {\n const normalizedKey = key.toUpperCase();\n return normalizedKey.endsWith(\"_EMAIL\") || normalizedKey.endsWith(\"_FROM\");\n },\n type: \"email\",\n },\n {\n id: \"P4_boolean_prefix\",\n priority: 4,\n match: (key: string) => {\n const normalizedKey = key.toUpperCase();\n return (\n normalizedKey.startsWith(\"ENABLE_\") ||\n normalizedKey.startsWith(\"DISABLE_\") ||\n normalizedKey.startsWith(\"IS_\") ||\n normalizedKey.startsWith(\"DEBUG\") ||\n normalizedKey.startsWith(\"FEATURE_\")\n );\n },\n type: \"boolean\",\n },\n {\n id: \"P5_key_port\",\n priority: 5,\n match: (key: string) => {\n const normalizedKey = key.toUpperCase();\n return normalizedKey.endsWith(\"_PORT\") || normalizedKey === \"PORT\";\n },\n type: \"number\",\n },\n {\n id: \"P6_empty_unknown\",\n priority: 6,\n match: (_key: string, value: string) => value.length === 0,\n type: \"unknown\",\n },\n {\n id: \"P7_boolean_literal\",\n priority: 7,\n match: (_key: string, value: string) => {\n const lower = value.toLowerCase();\n return lower === \"true\" || lower === \"false\";\n },\n type: \"boolean\",\n },\n {\n id: \"P8_numeric_literal\",\n priority: 8,\n match: (_key: string, value: string) => /^\\d+(\\.\\d+)?$/.test(value),\n type: \"number\",\n },\n {\n id: \"P9_semver\",\n priority: 9,\n match: (_key: string, value: string) => /^\\d+\\.\\d+\\.\\d+/.test(value),\n type: \"semver\",\n },\n {\n id: \"P10_url_scheme\",\n priority: 10,\n match: (_key: string, value: string) => /^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\//.test(value),\n type: \"url\",\n },\n {\n id: \"P11_email_literal\",\n priority: 11,\n match: (_key: string, value: string) => /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(value),\n type: \"email\",\n },\n {\n id: \"P12_json_object_array\",\n priority: 12,\n match: (_key: string, value: string) => {\n try {\n const parsed: unknown = JSON.parse(value);\n return typeof parsed === \"object\" && parsed !== null;\n } catch {\n return false;\n }\n },\n type: \"json\",\n },\n] as const;\n","import type { EnvVarType } from \"../parser/types.js\";\nimport { inferenceRules } from \"./rules.js\";\n\nexport type InferTypeOptions = {\n fallbackType?: EnvVarType;\n};\n\nconst sortedRules = [...inferenceRules].sort((left, right) => left.priority - right.priority);\n\nexport function inferType(key: string, value: string, options?: InferTypeOptions): EnvVarType {\n for (const rule of sortedRules) {\n if (rule.match(key, value)) {\n return rule.type;\n }\n }\n\n return options?.fallbackType ?? \"string\";\n}\n\nexport function inferTypesFromParsedVars(\n parsed: { vars: Array<{ key: string; rawValue: string }> },\n options?: InferTypeOptions,\n): EnvVarType[] {\n return parsed.vars.map((item) => inferType(item.key, item.rawValue, options));\n}","import type { EnvVarType } from \"./types.js\";\n\n/**\n * Structured annotations extracted from a JSDoc-style comment block\n * that precedes an env var declaration.\n *\n * @example\n * ```\n * # @description PostgreSQL connection string\n * # @required\n * # @type string\n * DATABASE_URL=\n * ```\n */\nexport type CommentAnnotations = {\n /** Type explicitly declared with `@type` in the comment block */\n annotatedType?: EnvVarType;\n\n /** Description from `@description` or the first free-form comment line */\n description?: string;\n\n /** true when the `@required` annotation is present in the comment block */\n isRequired: boolean;\n};\n\nconst VALID_ENV_VAR_TYPES = new Set<string>([\n \"string\",\n \"number\",\n \"boolean\",\n \"url\",\n \"email\",\n \"semver\",\n \"json\",\n \"unknown\",\n]);\n\nfunction isEnvVarType(value: string): value is EnvVarType {\n return VALID_ENV_VAR_TYPES.has(value);\n}\n\n/**\n * Parse a block of consecutive comment lines (each starting with `#`) and\n * extract JSDoc-style annotations.\n *\n * Recognised annotations:\n * - `@description <text>` — sets the variable description\n * - `@required` — marks the variable as required regardless of value\n * - `@optional` — informational (isRequired stays false)\n * - `@type <EnvVarType>` — overrides the inferred type\n *\n * Non-annotation comment lines act as a fallback description when no\n * `@description` annotation is present (first non-empty line wins).\n *\n * @param lines - Raw comment lines from the .env file, e.g. `[\"# @required\"]`\n */\nexport function parseCommentBlock(lines: readonly string[]): CommentAnnotations {\n let annotatedType: EnvVarType | undefined;\n let description: string | undefined;\n let isRequired = false;\n\n for (const line of lines) {\n // Strip the leading `#` and any trailing whitespace\n const content = line.replace(/^#\\s*/, \"\").trimEnd();\n\n if (content.startsWith(\"@description \")) {\n description = content.slice(\"@description \".length).trim();\n } else if (content.startsWith(\"@type \")) {\n const typeStr = content.slice(\"@type \".length).trim();\n if (isEnvVarType(typeStr)) {\n annotatedType = typeStr;\n }\n } else if (content.trim() === \"@required\") {\n isRequired = true;\n } else if (content.trim() === \"@optional\") {\n // Informational only — isRequired stays false (which is already the default)\n } else if (description === undefined && content.trim().length > 0) {\n // First non-empty, non-annotation line is a fallback description\n description = content.trim();\n }\n }\n\n const result: CommentAnnotations = { isRequired };\n if (annotatedType !== undefined) result.annotatedType = annotatedType;\n if (description !== undefined) result.description = description;\n return result;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\n/**\n * Reads a .env file from `filePath` and returns its full text content.\n * Rejects with a Node.js filesystem error if the file does not exist.\n */\nexport async function readEnvFile(filePath: string): Promise<string> {\n return readFile(path.resolve(filePath), \"utf8\");\n}\n\n/**\n * Writes `content` to `filePath`, creating intermediate directories as needed.\n * Overwrites any existing file at that path.\n */\nexport async function writeOutput(filePath: string, content: string): Promise<void> {\n const resolved = path.resolve(filePath);\n await mkdir(path.dirname(resolved), { recursive: true });\n await writeFile(resolved, content, \"utf8\");\n}\n","import { format } from \"prettier\";\n\n/**\n * Formats `content` using prettier with the specified `parser`.\n * Defaults to the \"typescript\" parser, which is correct for all generator outputs.\n * Returns the original content unchanged if prettier throws (e.g., invalid syntax).\n */\nexport async function formatOutput(\n content: string,\n parser: string = \"typescript\",\n): Promise<string> {\n try {\n return await format(content, { parser });\n } catch {\n return content;\n }\n}\n","import { green, red, yellow } from \"picocolors\";\n\n/** Prints a plain informational message to stdout. */\nexport function log(message: string): void {\n console.log(message);\n}\n\n/** Prints a yellow ⚠ warning message to stderr. */\nexport function warn(message: string): void {\n console.warn(yellow(`⚠ ${message}`));\n}\n\n/** Prints a red ✖ error message to stderr. */\nexport function error(message: string): void {\n console.error(red(`✖ ${message}`));\n}\n\n/** Prints a green ✔ success message to stdout. */\nexport function success(message: string): void {\n console.log(green(`✔ ${message}`));\n}\n","import { watch } from \"chokidar\";\n\nimport type { RunGenerateOptions } from \"./pipeline.js\";\nimport { runGenerate } from \"./pipeline.js\";\nimport { error, log } from \"./utils/logger.js\";\n\nexport type WatchOptions = {\n inputPath: string;\n runOptions: RunGenerateOptions;\n};\n\nexport function startWatch({ inputPath, runOptions }: WatchOptions): void {\n log(`Watching ${inputPath} for changes...`);\n\n void runGenerate(runOptions).catch((err: unknown) => {\n const message = err instanceof Error ? err.message : JSON.stringify(err);\n error(message);\n });\n\n const watcher = watch(inputPath, { persistent: true });\n\n watcher.on(\"change\", () => {\n log(`${inputPath} changed, regenerating...`);\n void runGenerate(runOptions).catch((err: unknown) => {\n const message = err instanceof Error ? err.message : JSON.stringify(err);\n error(message);\n });\n });\n\n process.on(\"SIGINT\", () => {\n void watcher.close().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