Skip to content

feat(clients): register Trae during setup - #1573

Merged
morluto merged 5 commits into
morluto:mainfrom
IvenKooLab:feat/trae-client
Oct 12, 2026
Merged

morluto merged 5 commits into
morluto:mainfrom
IvenKooLab:feat/trae-client

Conversation

@IvenKooLab

Copy link
Copy Markdown
Contributor

Summary

Registers Trae as a supported client during npx rea-agents setup, following the same pattern as the merged Qwen Code registration (#1415). After this change, Trae users can install REA with one command: setup writes the rea MCP server into Trae's user-scope mcp.json.

Problem and expected behavior

Trae (ByteDance's AI IDE) is not among the clients setup recognizes, so its users must hand-edit a JSON file to add REA's MCP server. Expected behavior: after setup, mcpServers.rea exists in the user-scope mcp.json under Trae's VS Code-style user directory; uninstall removes exactly the rea entry.

Trae's configuration (official MCP docs):

  • The server table uses the standard mcpServers key; stdio entries carry command, args, and env with no transport discriminator (the same schema as Cursor/Claude Desktop).
  • The user-scope file is mcp.json inside Trae's per-platform user directory, which follows the VS Code layout (Trae is a VS Code fork): %APPDATA%\Trae\User on Windows, ~/Library/Application Support/Trae/User on macOS, ~/.config/Trae/User elsewhere.
  • Trae has no personal skills directory (rules are project-scoped files), so this definition has no skillPath and setup skips the skill copy.

Change and scope

  • SupportedClients: trae definition — config path <user directory>/mcp.json, marker <user directory>, format json (the standard mcpServers dialect).
  • A traeUserDirectory helper mirroring the existing vscodeUserDirectory platform branches.
  • No dialect changes: mcpServers with command/args/env is exactly the existing json format.
  • Skill install/uninstall flows already skip definitions without skillPath, so no SetupPlan/Uninstall changes are needed.
  • Intentionally out of scope: Trae CN (国内版), which is a separate application storing its config under its own Trae CN user directory; it can be added the same way if wanted.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application-layer setup client registration (SupportedClients).
  • CLI and MCP/tool-catalog contract: none (no tools added or changed).
  • Provider, bridge, target-format, or platform compatibility: adds the trae client reusing the existing json configuration format.
  • Evidence, artifact, provenance, or reconstruction contract: not applicable.
  • Process execution, authorization, cleanup, or containment impact: uninstall removes only the rea entry.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none authored; generated catalogs stay CI-owned.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/filesystem/traeClientConfiguration.test.ts (6 cases) — per-platform user directory resolution (including XDG_CONFIG_HOME and APPDATA branches), upsert preserving unrelated mcpServers entries, fresh/empty documents, and uninstall removing only rea. clientLifecycle.test.ts expected-client list now includes trae.
  • Base reproduction or other evidence: not applicable (feature).
  • User-visible CLI/MCP output (if applicable): setup and uninstall now list "Trae" as a client label.
  • Remaining proof gaps: the user-scope directory layout follows VS Code's convention and community-documented paths; Trae's official docs describe the Settings → MCP GUI flow and the mcpServers schema but not the exact user-level file path. The full boundary suite was not run on a Unix host locally; two pre-existing symlink tests in clientLifecycle.test.ts fail on this Windows machine because Node cannot create symlinks without Developer Mode, reproduced identically on stock main.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm ci — clean install (Node v22.23.2, npm 10.9.8; .nvmrc pins 24.18.0, so CI covers the pinned toolchain)
  • npx vitest run tests/boundary/filesystem/traeClientConfiguration.test.ts — 6/6 passed
  • npx tsc -p tsconfig.json --noEmit — clean
  • npm run check:fast — typecheck + lint green (also runs as the pre-push hook)
  • npm run verify:test-discovery — all test files discovered exactly once
  • npx vitest run tests/boundary/filesystem/clientLifecycle.test.ts — 41/43 passed; the 2 failures are the pre-existing Windows symlink cases described above (identical on main)

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; config I/O is covered by filesystem boundary tests.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: setup writes only the rea entry into Trae's user-scope mcp.json (preserving all unrelated settings); no network access or process execution added.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above. (No open issue for Trae support found; same-pattern precedent in feat(clients): register Qwen Code during setup #1415.)
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output. (New client label in the setup client list only.)
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

- SupportedClients: trae definition (VS Code-style user directory,
  User/mcp.json, format json)
- Trae documents mcpServers as the top-level server table with
  command/args/env and stdio as the default transport; it has no
  personal skills directory, so setup skips the skill copy
- tests: traeClientConfiguration.test.ts (per-platform user directory
  resolution, upsert preserving unrelated settings, fresh/empty
  configs, uninstall)

Verified: tsc --noEmit clean; vitest run
tests/boundary/filesystem/traeClientConfiguration.test.ts 6/6.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: Setup writes the file the PR describes for this closed-source AI editor. Tests pass on Node 22, 24 and 26. The docs give no global mcp.json path, and they name ~/.trae/skills where setup copies the skill to ~/.agents/skills.

Results

Tested on Linux. The PR is 33dea3513. Main is 6d8f95e38.

Check Result
mcpServers with command, args, env against the MCP docs match
Global file ~/.config/Trae/User/mcp.json not in the docs, so I could not confirm it. The PR says the same
Skill: the definition has no skillPath setup falls back to the shared ~/.agents/skills copy. The new docs text says no copy is made. The skills page lists ~/.trae/skills for macOS and Linux
Changed tests (49), Node 22.23.1, 24.18.0, 26.11.1 49 of 49 on each
npm run build, npm run docs:check (Node 24) exit 0, exit 0
Fresh home: setup, doctor, setup again, uninstall all work. The second setup changes nothing. Uninstall removes the entry and the skill
Existing mcp.json with another server and an extra key both kept after setup and after uninstall
Bad JSON refused, nothing written
Merge with main clean. It conflicts with #1564 and #1572 in docs/installation.md

The shared copy is how setup treats any client without a skillPath. Qwen Code did the same in my earlier test. So the code does what the PR intends. The sentence in docs/installation.md is what is off. The PR also says the editor has no personal skills folder, and its docs list one. The docs list .agents/skills for a project only. A skillPath of ~/.trae/skills would follow the docs.

Not run

  • The editor is not installed, so I did not check where it really keeps mcp.json or that it loads the entry.
  • I did not run Windows or macOS, the China edition, lint, verify:package or the full suite.

Thanks, IvenKooLab, for saying plainly in the PR that the file path was not in the docs.

Cases I ran and what they showed
Case Result
No editor folder at all setup creates ~/.config/Trae/User/mcp.json; doctor says aligned
XDG_CONFIG_HOME=$H/xdg setup edits xdg/Trae/User/mcp.json. The PR implements this. The docs do not mention it
// comment in mcp.json setup keeps the comment
Empty file setup fills it in
~/.trae/mcp.json already there not read, not written

Uninstall leaves an empty mcpServers table and a .rea.backup file. I saw the same leftovers for Qwen Code in an earlier test, so this is not new.

What the docs say about the file

A server added in the app opens an "mcp.json file in TRAE" through a "Raw Config (JSON)" button, with no path. A project file lives at .trae/mcp.json. Setup does not touch ~/.trae/mcp.json or any project file. Pages I found elsewhere disagree on the Linux path, so I did not use them.

Open source check

I found no source repository for the editor. The vendor's official GitHub repo holds a README and no licence. So I call it closed source and do not name it here. This is my own check, not a statement from the vendor.

Commands
git --git-dir=$HOME/code/rea-mirror/rea.git fetch -q origin
git archive <sha> | tar -x -C <dir>
npm run build && npm run docs:check
node scripts/run-development-tests.mjs focused \
  tests/boundary/filesystem/traeClientConfiguration.test.ts \
  tests/boundary/filesystem/clientLifecycle.test.ts
env -i PATH="$NODE24/bin:/usr/bin:/bin" HOME="$FAKE" TMPDIR="$FAKE/tmp" \
  XDG_CONFIG_HOME="$FAKE/.config" XDG_DATA_HOME="$FAKE/.local/share" \
  XDG_CACHE_HOME="$FAKE/.cache" XDG_STATE_HOME="$FAKE/.local/state" \
  npm_config_cache="$FAKE/.npm" timeout 60 \
  node scripts/rea.mjs setup --client trae --yes --format json

I ran a dry run first. setup without --yes exits 1 and writes nothing.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1, 24.18.0, 26.11.1
  • Head / base: 33dea3513 / 6d8f95e38 (main when I started; the PR's own base is c19e15a2b). I also merge-checked against main 603d04ee3: clean.
  • Other: I did not run a fresh npm ci, because the disk was nearly full. I reused a node_modules from another tree with the same package-lock.json (blob 4b668f798).

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@morluto

morluto commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Reviewed this change and found one setup gap:

[P2] Install Trae's personal REA skill. The new definition in src/application/SupportedClients.ts:464–470 omits skillPath, and the installation documentation says Trae has no personal skills directory. Current official Trae Skills documentation lists global skills under ~/.trae/skills on macOS/Linux and %userprofile%/.trae/skills on Windows. Setup therefore registers MCP but skips REA's workflow skill. Please add the personal skill destination, correct the documentation, and cover skill installation/removal.

Validation: all six new filesystem tests and 43 shared client-lifecycle tests pass on macOS with Node 24.18.0 and npm 11.16.0. Trae itself was not executed.

Review follow-up (morluto#1573): the Trae Skills documentation lists global
skills under ~/.trae/skills on macOS/Linux and %userprofile%/.trae/skills
on Windows, so the definition now carries that skillPath and setup
installs the bundled skill copy there. The installation docs no longer
claim Trae has no personal skills directory, and the bundled REA
skill's supported client list includes trae.

Verified: tsc --noEmit clean; vitest run
tests/boundary/filesystem/traeClientConfiguration.test.ts 7/7.
@IvenKooLab

Copy link
Copy Markdown
Contributor Author

Thanks — fixed in acacbac.

The definition now carries skillPath: [".trae", "skills"] per the Trae Skills documentation (~/.trae/skills on macOS/Linux, %userprofile%\.trae\skills on Windows — home-relative on every platform, unlike the VS Code-style User directory that only hosts mcp.json). Setup installs the bundled REA skill copy there, the installation docs no longer claim Trae has no personal skills directory, and the bundled skill's supported-client list now includes trae (the list gap CassieFox23 also noted).

A new test asserts the skill destination on POSIX and Windows. Validation: traeClientConfiguration.test.ts 7/7, tsc --noEmit clean, npm run check:fast green.

@morluto
morluto merged commit bfa805d into morluto:main Oct 12, 2026
@morluto

morluto commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Thanks @IvenKooLab for adding Trae to setup and including its personal REA skill. This makes it much easier for Trae users to get started. Great work on these client integrations!

@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
3 tasks done
@morluto morluto added enhancement New feature or request area: cli CLI adapter and one-shot commands labels Oct 14, 2026
@morluto morluto added the area: setup Setup, packaging, upgrade, install, Doctor, and client registration label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants