import { define } from './chunk-WIL4LMMA.js';
import { checkForSchemaErrors, checkForNoEnvFiles } from './chunk-4MCNC4YY.js';
import { loadVarlockEnvGraph } from './chunk-5SI4EGRL.js';
import { CliExitError } from './chunk-7M6WZ65V.js';
import { __name } from './chunk-IBAHCH6O.js';

// src/cli/commands/typegen.command.ts
var commandSpec = define({
  name: "typegen",
  description: "Generate TypeScript types from your env schema",
  args: {
    path: {
      type: "string",
      short: "p",
      multiple: true,
      description: "Path to a specific .env file or directory to use as the entry point (can be specified multiple times)"
    }
  },
  examples: `
Generates TypeScript type definitions from your .env schema files.
Uses only non-environment-specific schema info, so output is deterministic
regardless of which environment is active.

This is useful when you have \`@generateTypes(lang=ts, path=env.d.ts, auto=false)\`
in your schema to disable automatic type generation during \`varlock load\` or \`varlock run\`.

Examples:
  varlock typegen                    # Generate types using default schema
  varlock typegen --path .env.prod   # Generate types from a specific .env file
`.trim()
});
var commandFn = /* @__PURE__ */ __name(async (ctx) => {
  const envGraph = await loadVarlockEnvGraph({
    entryFilePaths: ctx.values.path
  });
  checkForSchemaErrors(envGraph);
  checkForNoEnvFiles(envGraph);
  const generatedCount = await envGraph.generateTypesIfNeeded({ ignoreAutoFalse: true });
  if (generatedCount === 0) {
    throw new CliExitError("No @generateTypes decorator found in your schema", {
      suggestion: "Add `@generateTypes(lang=ts, path=env.d.ts)` to your .env.schema file."
    });
  }
  console.log("\u2705 Types generated successfully");
}, "commandFn");

export { commandFn, commandSpec };
//# sourceMappingURL=chunk-WDJR3BMV.js.map
//# sourceMappingURL=chunk-WDJR3BMV.js.map