Add printenv command for printing a single resolved env var#314
Add printenv command for printing a single resolved env var#314
printenv command for printing a single resolved env var#314Conversation
🦋 Changeset detectedLatest commit: 228de31 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
printenv command for printing a single resolved env var
|
@copilot - this looks great. Some additional complexity comes from certain values needing to be resolved to load the schema itself, like the currentEnv, or anything else that could affect conditional imports which might affect the item. Also any items that affect the item's validation/coercion/etc |
Good catch — I traced through both concerns carefully:
Items affecting validation/coercion: Added a comment in |
|
@theoephraim We may want to consider a different name for this since |
…ution Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
…ion-time deps Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
cf7a93f to
df4c9db
Compare
varlock
@varlock/astro-integration
@varlock/nextjs-integration
@varlock/vite-integration
@varlock/1password-plugin
@varlock/aws-secrets-plugin
@varlock/azure-key-vault-plugin
@varlock/bitwarden-plugin
@varlock/google-secret-manager-plugin
@varlock/infisical-plugin
commit: |
|
@copilot - add docs for this on the website |
Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
Added docs for |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
varlock-website | 228de31 | Commit Preview URL Branch Preview URL |
Feb 24 2026, 11:53 PM |
Adds a
varlock printenv MY_VARcommand that resolves and prints a single env var's value — useful for embedding in larger shell pipelines wherevarlock run -- echo $MY_VARwon't work (shell expands$MY_VARbefore varlock runs).Changes
getTransitiveDeps(key, adjacencyList)— new utility ingraph-utils.tsthat computes all transitive dependencies of a node via iterative DFSEnvGraph.resolveItemWithDeps(key)— new method that resolves only the requested item and its transitive deps, skipping unrelated items entirely. Includes a comment documenting thatcurrentEnv/conditional import deps are already handled at load time, and that decorator-based validation/coercion deps are captured independencyKeysprintenv.command.ts— new CLI command; accepts a positional var name, runs selective resolution, and prints the raw value to stdoutcli-executable.ts— registers the newprintenvsubcommandcli-commands.mdx— addedvarlock printenvsection to the CLI reference docs on the website, including usage examples and an explanation of whyvarlock run -- echo $MY_VARdoesn't workUsage
Original prompt
printenvcommand to output single var #89💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.