Cache and codegen
varlock cache
Section titled “varlock cache”Manage the encrypted disk cache used by cache() and plugin authors when cache mode is set to disk. When run in a TTY, opens an interactive browser; otherwise prints a status summary.
varlock cache [status|clear] [options]Sub-commands:
status: print a non-interactive cache status summary (location, file size, entry counts by group)clear: remove cache entries. Requires--yesfor non-interactive use.
Options:
--plugin <name>: When clearing, only remove entries for a specific plugin--yes/-y: Skip confirmation prompts (required when clearing without a TTY)
Examples:
# Interactive cache browser (or status summary in CI)varlock cache
# Print a non-interactive status summaryvarlock cache status
# Clear all cache entries (prompts to confirm)varlock cache clear
# Clear all cache entries without confirming (e.g. CI)varlock cache clear --yes
# Clear cache for a specific plugin onlyvarlock cache clear --plugin 1password --yesSee the Caching guide for cache mode strategy and troubleshooting.
varlock codegen
Section titled “varlock codegen”Runs the code-generation decorators in your schema: typed env accessors like @generateTsTypes (type declarations) and @generatePythonEnv (a loadable module), plus any generators contributed by plugins. Uses only your schema definitions, so output is deterministic regardless of which environment is active. Keys (and decorators) that come only from value files like .env or .env.local are ignored. Only items declared in your .env.schema (or imported into it) are included. When run directly, the command reports any keys found only in a plain .env so you can move them into your schema if they belong there.
Add a per-language decorator for each output file you want: @generateTsTypes, @generatePythonEnv, @generateRustEnv, @generateGoEnv, @generatePhpEnv, @generateJavaEnv, or @generateCsharpEnv. Each generates its own file. Each decorator can also take a filter= arg to scope its output to a subset of items, using the same selectors as the --filter CLI flag; see the code generation reference.
This command is particularly useful when you have set auto=false on a generator decorator to disable automatic generation during varlock load or varlock run.
varlock codegen [options]Options:
- Common options:
--path/-p
Examples:
# Generate using the default schemavarlock codegen
# Generate from a specific .env filevarlock codegen --path .env.prod
# Generate from multiple directoriesvarlock codegen -p ./envs -p ./overrides