Skip to content

docs(cli): dev --env-file values reach your tasks - #4478

Closed
BILLKISHORE wants to merge 2 commits into
triggerdotdev:mainfrom
BILLKISHORE:docs/env-file-reaches-dev-tasks
Closed

docs(cli): dev --env-file values reach your tasks#4478
BILLKISHORE wants to merge 2 commits into
triggerdotdev:mainfrom
BILLKISHORE:docs/env-file-reaches-dev-tasks

Conversation

@BILLKISHORE

Copy link
Copy Markdown

Closes #4425

The --env-file docs snippet says the file only hydrates the CLI's process.env and not the tasks. That's true for deploy and preview archive, but not for dev: DevSupervisor.#getEnvVars() passes args.envFile into resolveLocalEnvVars, so the file ends up in the run environment.

The snippet is shared by four pages, so I reworded it to cover both cases instead of splitting it. I added the same fact to trigger dev --help, which was silent on it. dev archive --help already said "CLI process" and is correct, so it's untouched.

I fixed the docs rather than changing dev, since the behavior has shipped for a long time and people rely on --env-file reaching tasks. Happy to flip it the other way if you'd rather dev matched the old wording.

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

Built the CLI and checked both help outputs:

$ node packages/cli-v3/dist/esm/index.js dev start --help
--env-file <env file>    Path to the .env file to use for the dev session. Values are also
                         passed to your tasks. Defaults to .env in the project directory.

$ node packages/cli-v3/dist/esm/index.js dev archive --help
--env-file <env file>    Path to the .env file to load into the CLI process. Defaults to
                         .env in the project directory.

Also ran pnpm run format, pnpm run lint and pnpm run build --filter trigger.dev.


Changelog

trigger dev --help and the CLI docs now say that --env-file values are passed to your tasks, not just the CLI process.


Screenshots

n/a


Two things I noticed reading this, left alone since they're separate issues:

  • In resolveLocalEnvVars the dotenv values are spread last, so --env-file overrides the environment variables set in the dashboard. That may be intended, but it isn't documented.
  • docs/cli-switch.mdx includes this snippet, but switch.ts has no --env-file option.

@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 146c35f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
trigger.dev Patch
@internal/dashboard-agent Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/python Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@trigger.dev/rbac Patch
@trigger.dev/sso Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/metrics-pipeline Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/sdk-compat-tests Patch

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Hi @BILLKISHORE, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cf400f2a-2ee7-45de-aff1-6e14b19510e6

📥 Commits

Reviewing files that changed from the base of the PR and between 8f66af6 and 146c35f.

📒 Files selected for processing (3)
  • .changeset/env-file-dev-tasks-help.md
  • docs/snippets/cli-options-env-file.mdx
  • packages/cli-v3/src/commands/dev.ts

Walkthrough

Updated --env-file descriptions in the dev command and CLI documentation. The text now states that dev passes loaded variables to tasks, while other commands only hydrate the CLI process environment. Added a patch changeset for trigger.dev.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

docs: dev --env-file help/docs say it does not reach tasks, but it does

1 participant