Open
feat(cli): default to envilder.json and .env when flags are omitted#314
Conversation
10 tasks
Copilot
AI
changed the title
[WIP] Add default behavior for envilder CLI without --map
feat(cli): zero-config defaults — --map → envilder.json, --envfile → .env
Jun 7, 2026
Copilot
AI
changed the title
feat(cli): zero-config defaults — --map → envilder.json, --envfile → .env
fix(docs): wrap long line in README.md to pass MD013 markdownlint check
Jun 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a “zero-config” CLI path resolution (defaulting to envilder.json and .env when flags are omitted), and updates docs/website copy and tests to reflect the new UX.
Changes:
- Add CLI defaults for
--map/--envfile(with new error when no map is discoverable). - Update docs + website quickstart snippets to show
envilder/envilder --pushwithout explicit paths. - Add/adjust unit + E2E test coverage for the new defaulting behavior.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/envilder/apps/cli/Cli.ts |
Adds default map/envfile resolution and updates banner/help messaging. |
tests/envilder/apps/cli/Cli.test.ts |
Adds unit tests + mocks for existsSync to cover default-map/default-envfile cases. |
e2e/cli.test.ts |
Adds E2E coverage for zero-arg behavior and updates expected error messaging; adds cwd support in runner. |
README.md |
Updates quickstart to show zero-config invocation and wraps the previously-long line. |
docs/pull-command.md |
Updates pull docs/examples/options to describe defaults. |
docs/push-command.md |
Updates push docs/examples/options to describe defaults. |
src/website/src/components/HowItWorks.astro |
Updates terminal snippets to use the shorter commands. |
src/website/src/components/GetStarted.astro |
Updates terminal snippet for pull to envilder only. |
src/website/src/i18n/en.ts |
Updates quickstart step text to “Run envilder”. |
src/website/src/i18n/es.ts |
Updates quickstart step text to “Ejecuta envilder”. |
src/website/src/i18n/ca.ts |
Updates quickstart step text to “Executa envilder”. |
Push-single mode (--key/--value/--secret-path) does not need a map file, but resolveMapFile() was called unconditionally and threw 'No map file found' when envilder.json was absent in the cwd. Guard the default-map lookup so push-single passes options.map through as-is. Pull and push-env modes are unchanged.
The zero-config and missing-map e2e tests deleted their temp directories after the assertions. A failing assertion left the directory behind. Wrap Act+Assert in try/finally so rm() always runs.
2168c0e to
93924f5
Compare
Push-single skipped map-file resolution entirely, so the config section (provider, vaultUrl, profile) from envilder.json was ignored — a user with an Azure config silently pushed to AWS. Now push-single resolves the default envilder.json when present (without throwing if absent) and reads its config section. Operation mode is derived from a single source (determineOperationMode), removing the duplicated push-single check, and the resolved provider is logged for transparency.
Single-variable push now reads the config section from envilder.json when present, targeting the same provider as the project. Clarify the behavior and add the optional map row to the push-single options table.
…ilot/featcli-default-to-envilder-json
…lt-to-envilder-json # Conflicts: # src/envilder/apps/cli/entry/Cli.ts
Comment on lines
+180
to
+184
| if (mapOption !== undefined) { | ||
| const trimmed = mapOption.trim(); | ||
| if (trimmed.length === 0) { | ||
| throw new Error('Invalid --map value: path must not be empty.'); | ||
| } |
Comment on lines
+197
to
+199
| throw new Error( | ||
| `No map file found. Provide --map or create ${DEFAULT_MAP_FILE} in the current directory.`, | ||
| ); |
- Mirror --map's trim+reject-empty validation for --envfile via a new resolveEnvfile() helper, preventing whitespace-only paths from being accepted. - Update the CLI banner's Azure Key Vault example to include --vault-url, since the provider requires it and the previous example would fail at runtime. Addresses PR review comments (databaseId 3439117098, 3482087203, 3453474681).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds zero-config CLI defaults: when
--mapis omitted, the CLI resolvesenvilder.jsonfrom the current directory; when--envfileis omitted, itdefaults to
.env. Runningenvilderwith no flags now works when anenvilder.jsonis present in the working directory.Changes
src/envilder/apps/cli/Cli.ts: default--map→envilder.jsonand--envfile→.envwhen omitted; reject empty--mapvalues.$config: single-variable push(
--key/--value/--secret-path) now resolves the defaultenvilder.jsonwhenpresent and reads its
$configsection (provider,vaultUrl,profile),so it targets the same provider as the rest of the project instead of
silently defaulting to AWS. Missing
envilder.jsonis not an error forpush-single. The resolved provider is logged before the push for
transparency. CLI flags still override
$config.from
DispatchActionCommand.determineOperationMode, removing the duplicatedpush-single detection that previously lived in
Cli.ts.tests/envilder/apps/cli/Cli.test.ts(zero-configdefaults, empty-map rejection, push-single without a map file, push-single
reading
envilder.json$config) and e2e coverage ine2e/cli.test.ts(zero-config pull, missing-map error message). E2E temp dirs are cleaned up
via Vitest's
onTestFinishedso cleanup runs even when an assertion fails.docs/pull-command.md,docs/push-command.md, and website copy updated to document the zero-configdefaults and the push-single
$configbehavior.Type of change
Checklist
Notes for reviewer
Addresses all review feedback:
$configfromenvilder.jsonwhen present (no silent AWS fallback for Azure projects).--mapdefault is consistently applied wherever a map file is consulted.onTestFinished.