Skip to content

feat(simulator): add exec command and config persistence via dotenv#3777

Open
krystofwoldrich wants to merge 3 commits into
mainfrom
@kw/sim-run-com
Open

feat(simulator): add exec command and config persistence via dotenv#3777
krystofwoldrich wants to merge 3 commits into
mainfrom
@kw/sim-run-com

Conversation

@krystofwoldrich
Copy link
Copy Markdown
Contributor

@krystofwoldrich krystofwoldrich commented May 21, 2026

Goal

When testing the simulator:start I've noticed that agents correctly use the recommended agent-device envs, but because agents can't set envs for all child processes, they must include them in every agent-device call. This fogs up what is the agent doing, see the example below.

This PR proposes an option to save simulator session config to .env.eas-simulator, which can later be used by new exec command. This make working with the sim less verbose and also persist the config in case of agent cli crash, new sessions...

This PR also adds EAS_SIMULATOR_SESSION_ID env which is saved to the dotenv file for later reference to the session. This let's user call all simulator:* commands without specifying the --id.

Before

Because of the truncation it's not clear what command was executed.

Screenshot 2026-05-21 at 23 15 36

After

Now it's clearly visible.

Screenshot 2026-05-21 at 23 13 32

Considered alternative solutions

.env.eas-simulator currently implemented dedicated donenv file for the simulator session config. The benefit is isolation and easy of prune of the session, no parsing of the common .env files. It's used in the industry for example .env.sentry-sourcemaps.

.env.local already established file for ephemeral envs, contains other user's/project's envs would require parsing to clean up

.expo/.eas-simulator-config new specialized config file for simulator session. Seems like the best next option, but makes less transparent if someone would not want to use simulator:exec, .env.local is common for ephemeral vals.

dotenv agent-device <command> only works out of the box with .env not .env.local. Other eas command like convex use .env.local which is better as typically not committed file for tmp session envs.

./agent-device.json can have both url and token properties same as when using env, but it's unclear to me if this file is typically committed or not, there are no secrets, so my expectations are it's likely ment to be committed.

Summary

  • add eas simulator:exec to run simulator commands with local .env files loaded
  • make simulator:start write dotenv config by default, including agent-device envs and session id
  • keep --out-config-type env for print-only shell exports

Test plan

  • tests

New TUI example

Start command output

Screenshot 2026-05-25 at 17 01 14

Interactions without --id

eas simulator:start # creates .env.eas-simulator
eas simulator:get # uses id from .env.eas-simulator
eas simulator:stop # uses id from .env.eas-simulator

eas simulator:start # overwrites .env.eas-simulator and logs out the previous id

Why start with --force by default? This minimizes the number of fails runs where user/agent haven't stopped the prev session and the env file have not cleaned up. It's possible to use --no-force if needed. We do only check the session id presence not the session state, to avoid extra network req on every start. This works well with the default force.

@krystofwoldrich krystofwoldrich changed the title feat(simulator): add exec config output feat(simulator): add exec command and config persistence via dotenv May 21, 2026
@krystofwoldrich krystofwoldrich added the no changelog PR that doesn't require a changelog entry label May 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 85.57692% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.50%. Comparing base (4366f51) to head (ec691a4).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/simulator/start.ts 80.65% 6 Missing ⚠️
packages/eas-cli/src/simulator/utils.ts 78.58% 3 Missing ⚠️
packages/eas-cli/src/commands/simulator/exec.ts 86.67% 2 Missing ⚠️
packages/eas-cli/src/commands/simulator/get.ts 75.00% 2 Missing ⚠️
packages/eas-cli/src/commands/simulator/stop.ts 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3777      +/-   ##
==========================================
+ Coverage   56.83%   57.50%   +0.67%     
==========================================
  Files         904      907       +3     
  Lines       39129    39382     +253     
  Branches     8178     8255      +77     
==========================================
+ Hits        22237    22642     +405     
+ Misses      15420    15283     -137     
+ Partials     1472     1457      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@krystofwoldrich krystofwoldrich marked this pull request as ready for review May 22, 2026 13:38
@github-actions
Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

@github-actions
Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

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

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant