[eas-cli] Detect argent MCP config and improve argent session instructions#3766
Draft
szdziedzic wants to merge 1 commit into
Draft
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
45d1244 to
98e5c77
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3766 +/- ##
==========================================
+ Coverage 56.80% 56.83% +0.03%
==========================================
Files 904 904
Lines 39112 39363 +251
Branches 8173 8213 +40
==========================================
+ Hits 22214 22367 +153
- Misses 15428 15522 +94
- Partials 1470 1474 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d502f6c to
6df6386
Compare
6df6386 to
d41b0b3
Compare
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
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.

Why
After
eas simulator:start --type argentreturns a tunnel URL, the CLI used to print one line:— and leave the user to figure out that the URL goes into
ARGENT_TOOLS_URLin their editor's MCP config, which of nine possible config files / formats theirs lives in, and that the editor has to be restarted to pick it up.This PR replaces that flow with detection + interactive auto-edit. The CLI now scans the same set of MCP config locations
argent inititself writes to, prompts the user with a multi-select of detected configs (pre-checked, opt-out per row, with a per-row diff), applies theARGENT_TOOLS_URLedit to whichever stayed checked, and reverts every edit when the session ends. Non-interactive runs (--non-interactive) still print instructions and touch nothing.How
All changes in
packages/eas-cli/src/simulator/. Two new deps:jsonc-parser@3.3.1,smol-toml@1.6.1.Editor coverage
Mirrors argent's installer adapter set in
packages/argent-installer/src/mcp-configs.ts. All nine adapters, project + global where applicable:.cursor/mcp.json~/.cursor/mcp.jsonmcpServers.argentenv.mcp.json~/.claude.jsonmcpServers.argentenv.vscode/mcp.jsonservers.argentenv~/.codeium/windsurf/mcp_config.jsonmcpServers.argentenv.zed/settings.json~/.config/zed/settings.jsoncontext_servers.argentenv.gemini/settings.json~/.gemini/settings.jsonmcpServers.argentenv.codex/config.toml~/.codex/config.tomlmcp_servers.argentenv~/.hermes/config.yamlmcp_servers.argentenvopencode.{jsonc,json}~/.config/opencode/{opencode.jsonc,opencode.json,config.json}mcp.argentenvironmentopencode's odd
environmentkey (notenv) is modeled by anenvKeyNamefield on each candidate. Multiple opencode filename candidates per scope are deduped by(editor, scope).Per-format read/write
Four
FormatDrivers each implementinghasKeyPath/readString/writeString/removeKey. Capture / apply / revert dispatch by format.jsonc-parser(modify+applyEdits)yamlpackage (DocumentAPI)smol-toml(parse+stringify)Interactive flow
When
remoteConfig.__typename === 'ArgentRunSessionRemoteConfig'and we're interactive:captureWritableArgentEdits()reads every candidate config that actually parses + contains an argent entry, capturing the currentARGENT_TOOLS_URLvalue (or null) on each.+ ARGENT_TOOLS_URL = "<new>"for adds, both- <old>and+ <new>for overwrites.promptsmulti-select withinstructions: false, every row pre-selected: true. User can opt rows out.applyArgentEdits(selected, toolsUrl)writes through the right driver per file. Mid-batch failures roll back the edits already applied in that batch and rethrow.finallyblock inrunAsynccallsrevertArgentEditswith anonErrorcallback that logsLog.warnand continues so one bad file doesn't block reverting the others.The applied-edits summary tells the user to restart the editor and mentions
npx -y @swmansion/argent initas a manual escape hatch for cases the auto-revert can't recover (process hard-killed,kill -9, etc.).Non-interactive flow
Unchanged:
formatRemoteSessionInstructionsis the single entry point. It now lists all nine editors (with both project + global paths) in the fallback "didn't detect a config" branch, and surfaces detected configs by editor + scope when it finds them. No file mutation in non-interactive mode.Files
packages/eas-cli/src/simulator/utils.ts— candidate list, format drivers, capture/apply/revert, instruction formatting.packages/eas-cli/src/commands/simulator/start.ts—promptAndApplyArgentEditsAsync,printArgentEditSummary,try/finallyaround the post-poll flow, revert hook.packages/eas-cli/src/simulator/__tests__/utils-test.ts— 22 cases.Test Plan
yarn typecheckcleanyarn linton touched files — no new warningsyarn fmt:checkcleanyarn teston the new suite — 22/22 passyarn teston the full eas-cli suite — 1616/1620 (4 pre-existing skips).mcp.jsoncontainingargent,eas simulator:start --platform ios --type argent→ prompt offers the file pre-checked → confirm → file is edited with the newARGENT_TOOLS_URL→ cancel session → file restored to original state.--non-interactive) → only prints instructions.environment) all detected and editable.The 22 unit tests already cover all four format drivers (including JSONC comment preservation and YAML comment preservation), partial-failure rollback, revert when previous value was null vs string, and the opencode
environmentquirk.