Skip to content

feat(cli): default to envilder.json and .env when flags are omitted#314

Open
macalbert with Copilot wants to merge 24 commits into
mainfrom
copilot/featcli-default-to-envilder-json
Open

feat(cli): default to envilder.json and .env when flags are omitted#314
macalbert with Copilot wants to merge 24 commits into
mainfrom
copilot/featcli-default-to-envilder-json

Conversation

Copilot AI commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds zero-config CLI defaults: when --map is omitted, the CLI resolves
envilder.json from the current directory; when --envfile is omitted, it
defaults to .env. Running envilder with no flags now works when an
envilder.json is present in the working directory.

Note: this PR was originally opened as a docs-only line-wrap fix. The branch
actually delivers a CLI behavior change, so the title and description have been
updated to match. Semver impact: minor.

Changes

  • src/envilder/apps/cli/Cli.ts: default --mapenvilder.json and
    --envfile.env when omitted; reject empty --map values.
  • Push-single honors $config: single-variable push
    (--key/--value/--secret-path) now resolves the default envilder.json when
    present and reads its $config section (provider, vaultUrl, profile),
    so it targets the same provider as the rest of the project instead of
    silently defaulting to AWS. Missing envilder.json is not an error for
    push-single. The resolved provider is logged before the push for
    transparency. CLI flags still override $config.
  • Single source of truth for operation mode: the CLI now derives the mode
    from DispatchActionCommand.determineOperationMode, removing the duplicated
    push-single detection that previously lived in Cli.ts.
  • Tests: unit coverage in tests/envilder/apps/cli/Cli.test.ts (zero-config
    defaults, empty-map rejection, push-single without a map file, push-single
    reading envilder.json $config) and e2e coverage in e2e/cli.test.ts
    (zero-config pull, missing-map error message). E2E temp dirs are cleaned up
    via Vitest's onTestFinished so cleanup runs even when an assertion fails.
  • Docs / website / i18n: README, docs/pull-command.md,
    docs/push-command.md, and website copy updated to document the zero-config
    defaults and the push-single $config behavior.

Type of change

  • Feature
  • Bugfix
  • Refactor
  • Documentation
  • Other

Checklist

  • Tests added/updated
  • Docs updated
  • Lint/format pass

Notes for reviewer

Addresses all review feedback:

  • Push-single no longer requires a map file, and now honors $config from
    envilder.json when present (no silent AWS fallback for Azure projects).
  • The --map default is consistently applied wherever a map file is consulted.
  • E2E temp-directory cleanup is reliable on assertion failure via
    onTestFinished.
  • PR title/description updated to reflect the behavioral change.

Copilot AI linked an issue Jun 7, 2026 that may be closed by this pull request
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 requested a review from macalbert June 7, 2026 21:09
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
@macalbert macalbert marked this pull request as ready for review June 7, 2026 21:15
Copilot AI review requested due to automatic review settings June 7, 2026 21:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --push without 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”.

Comment thread src/envilder/apps/cli/Cli.ts Outdated
Comment thread src/envilder/apps/cli/Cli.ts Outdated
Comment thread README.md
Comment thread e2e/cli.test.ts Outdated
Comment thread e2e/cli.test.ts
@macalbert macalbert changed the title fix(docs): wrap long line in README.md to pass MD013 markdownlint check feat(cli): default to envilder.json and .env when flags are omitted Jun 7, 2026
macalbert added 2 commits June 8, 2026 01:11
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.
Copilot AI review requested due to automatic review settings June 8, 2026 06:36
@macalbert macalbert force-pushed the copilot/featcli-default-to-envilder-json branch from 2168c0e to 93924f5 Compare June 8, 2026 06:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/envilder/apps/cli/entry/Cli.ts
macalbert added 2 commits June 8, 2026 18:28
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.
Copilot AI review requested due to automatic review settings June 8, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.

Comment thread src/envilder/apps/cli/Cli.ts Outdated
Comment thread e2e/cli.test.ts
Comment thread tests/envilder/apps/cli/Cli.test.ts Outdated
Comment thread docs/push-command.md
Copilot AI review requested due to automatic review settings June 22, 2026 15:22
@github-actions github-actions Bot added size/XL Very large change — 400+ lines / 25+ files; should be split documentation Improvements or additions to documentation e2e End-to-end tests (Playwright) labels Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Comment thread src/envilder/apps/cli/entry/Cli.ts Outdated
Copilot AI review requested due to automatic review settings June 25, 2026 21:43
@github-actions github-actions Bot added size/L Large change — 200-399 lines / 10-24 files; consider splitting and removed size/XL Very large change — 400+ lines / 25+ files; should be split labels Jun 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Copilot AI requested review from Copilot and removed request for Copilot June 25, 2026 21:47
Copilot AI review requested due to automatic review settings June 26, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread src/envilder/apps/cli/entry/Cli.ts Outdated
Copilot AI review requested due to automatic review settings July 11, 2026 14:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

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).
Copilot AI review requested due to automatic review settings July 11, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation e2e End-to-end tests (Playwright) enhancement New feature or request size/L Large change — 200-399 lines / 10-24 files; consider splitting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): default to envilder.json when --map is omitted

3 participants