Skip to content

cli: infer a default environment when none is specified#643

Draft
pgavlin wants to merge 1 commit into
mainfrom
pgavlin/default-env
Draft

cli: infer a default environment when none is specified#643
pgavlin wants to merge 1 commit into
mainfrom
pgavlin/default-env

Conversation

@pgavlin
Copy link
Copy Markdown
Member

@pgavlin pgavlin commented May 7, 2026

These changes allow esc env open, esc env run, esc env get, and friends
to operate without an explicit environment argument. The default environment
is inferred from a .esc.yaml file in the working directory or any parent,
falling back to the imports of the currently-selected Pulumi IaC stack.

The .esc.yaml schema accepts three forms under its environment field: a
single environment reference, an anonymous list of imports, or a command
whose JSON stdout matches either of the prior two forms. See esc env --help
for the full schema.

esc env open and esc env run accept an inferred import list directly,
opening it as an anonymous environment. Commands that operate on a specific
named environment error if the inferred default is a list rather than a
single reference. esc env ls annotates the inferred default with (default).

These changes allow `esc env open`, `esc env run`, `esc env get`, and friends
to operate without an explicit environment argument. The default environment
is inferred from a `.esc.yaml` file in the working directory or any parent,
falling back to the imports of the currently-selected Pulumi IaC stack.

The `.esc.yaml` schema accepts three forms under its `environment` field: a
single environment reference, an anonymous list of imports, or a command
whose JSON stdout matches either of the prior two forms. See `esc env --help`
for the full schema.

`esc env open` and `esc env run` accept an inferred import list directly,
opening it as an anonymous environment. Commands that operate on a specific
named environment error if the inferred default is a list rather than a
single reference. `esc env ls` annotates the inferred default with `(default)`.
@pgavlin pgavlin force-pushed the pgavlin/default-env branch from 2a60ed0 to 4c9eef6 Compare May 7, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant