Skip to content

feat: support repeated -e/--env-file for merging multiple env files - #134

Merged
capotej merged 1 commit into
boldblackai:mainfrom
BoldBlackBot:feat/repeatable-env-file
Sep 2, 2026
Merged

feat: support repeated -e/--env-file for merging multiple env files#134
capotej merged 1 commit into
boldblackai:mainfrom
BoldBlackBot:feat/repeatable-env-file

Conversation

@BoldBlackBot

Copy link
Copy Markdown
Contributor

Summary

-e/--env-file was previously a single-value option. Passing it twice silently dropped the first file (minimist last-value-wins). This PR makes it repeatable, mirroring the existing --volumes pattern.

Motivation

Real use case: certain harness invocations need a mix of env files (e.g. a base secrets file + a project-specific overrides file). Without this, you'd have to create a merged env file for every permutation.

Changes

  • Normalize argv["env-file"] into string[] (same pattern as --volumes), so both single and repeated values work
  • Emit one docker --env-file <path> flag per input file via flatMap
  • Validate each file exists (loop instead of single check)
  • Update AgentOptions.envFilePathenvFilePaths: string[] (only PiAdapter reads it, for the local-mode provider decision)
  • Update USAGE text: ; may be repeated (matching -v, --volumes)
  • Cloud-mode detection (HARNESS_CLOUD_MODE) now checks envFilePaths.length > 0

Backward compatibility

Single -e file.env works identically — the normalize step wraps it in an array.

Test plan

  • pnpm build — clean compile (tsc --noEmit)
  • pnpm lint:ts — biome clean
  • pnpm test:e2e — 117/117 pass, including 3 new tests:
    • repeated -e passes all env files as separate --env-file flags
    • both files are present and resolved to abs paths
    • --help documents -e may be repeated
  • All pre-existing env-file and cloud-mode tests still pass unchanged

@BoldBlackBot

Copy link
Copy Markdown
Contributor Author

Build failure is a transient NodeSource outage — not from this PR

The build jobs (amd64 + arm64) failed with:

curl: (22) The requested URL returned error: 403
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key

This is the base Dockerfile fetching NodeSource's GPG key during image build. NodeSource's endpoint is currently returning 403 (confirmed live just now). The same build job passed on chore/bump-deps ~6.5h ago with the identical Dockerfile.

This PR is TypeScript-only (no Dockerfile changes):

src/harness.ts             | 38 +++++++++++++++++++++++---------------
tests/e2e/helpers.mjs      |  4 ++++
tests/e2e/parsing.test.mjs | 25 +++++++++++++++++++++++++

lint ✅ and e2e ✅ both pass. The build will go green once NodeSource recovers. Happy to rerun it then.

@BoldBlackBot
BoldBlackBot force-pushed the feat/repeatable-env-file branch 3 times, most recently from 7881797 to 5a54d77 Compare August 3, 2026 13:31
@BoldBlackBot
BoldBlackBot force-pushed the feat/repeatable-env-file branch 5 times, most recently from 2462d77 to cfdc6de Compare August 17, 2026 13:31
@BoldBlackBot
BoldBlackBot force-pushed the feat/repeatable-env-file branch from cfdc6de to 8064b7c Compare August 18, 2026 21:30
@BoldBlackBot
BoldBlackBot force-pushed the feat/repeatable-env-file branch from 8064b7c to cdceb43 Compare August 30, 2026 21:31
Previously -e/--env-file was a single-value option: passing it twice
silently dropped the first file (minimist last-value-wins). This mirrors
the existing --volumes pattern to normalize the value into an array,
emitting one docker --env-file flag per input.

Use case: composing env files across invocations (e.g. a base secrets
file + a project-specific overrides file) without creating a merged
file for every permutation.

Backward compatible — single -e still works unchanged.

Co-authored-by: Julio Capote <6135+capotej@users.noreply.github.com>
@BoldBlackBot
BoldBlackBot force-pushed the feat/repeatable-env-file branch from cdceb43 to 62d8d17 Compare September 2, 2026 02:33
@capotej
capotej merged commit f56baf1 into boldblackai:main Sep 2, 2026
5 checks passed
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.

2 participants