Skip to content

feat(trae-cn): add desktop adapter#1743

Open
JasonYang0104 wants to merge 1 commit into
jackwener:mainfrom
JasonYang0104:codex/trae-cn-desktop-adapter
Open

feat(trae-cn): add desktop adapter#1743
JasonYang0104 wants to merge 1 commit into
jackwener:mainfrom
JasonYang0104:codex/trae-cn-desktop-adapter

Conversation

@JasonYang0104
Copy link
Copy Markdown

Description

Add a Trae CN desktop adapter, modeled after the existing Cursor desktop adapter pattern: OpenCLI connects to the running Electron app through a Chrome DevTools Protocol endpoint and drives the active workbench target.

The adapter supports task creation, prompt sending, ask/read/export flows, model inspection/selection, activity watching, target discovery, screenshots/dumps, and explicit approval handling for visible Trae CN permission prompts.

Related issue: N/A

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

What this PR does

  • Adds clis/trae-cn/* with 15 desktop commands: activity, approve, ask, dump, export, model, new, read, screenshot, select-model, send, setup, status, targets, and watch.
  • Registers Trae CN as a built-in Electron app on CDP port 39240.
  • Documents Trae CN under docs/adapters/desktop/trae-cn.md and updates the adapter index, sidebar, README command tables, and generated manifest.
  • Keeps live app/login state out of CI: the adapter test suite uses DOM and command mocks rather than requiring a real Trae CN session.

Approval behavior

ask and watch default to --auto-approve true for visible Trae CN terminal/delete confirmation UI, matching the intended unattended local-agent workflow. The default approval kinds are terminal,delete; keep is intentionally opt-in only.

Safety controls included here:

  • --auto-approve false disables automatic approval during ask/watch.
  • --approve-kinds supports terminal, delete, keep, and all; default remains terminal,delete.
  • opencli trae-cn approve --dry-run true detects matching visible prompts without clicking.
  • Unknown prompts are not clicked.

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

Local validation:

npm run build-manifest
npx vitest run --project adapter clis/trae-cn/trae-cn.test.js
npm run typecheck
npm run build
npm run check:silent-column-drop
npm run check:typed-error-lint
git diff --check

Additional PR-gate validation run locally:

bash scripts/check-doc-coverage.sh --strict
npm run docs:build
OPENCLI_CONFIG_DIR=$(mktemp -d) npx vitest run --project unit --project extension --reporter=verbose --shard=1/2
npx vitest run --project unit --project extension --reporter=verbose --shard=2/2
OPENCLI_CONFIG_DIR=$(mktemp -d) bun vitest run --project unit --reporter=verbose
npm audit --omit=dev --audit-level=high
npx vitest run --project adapter --reporter=verbose

Results summary:

  • Trae CN focused adapter tests: 1 passed, 18 passed.
  • Full adapter project: 363 passed, 3438 passed.
  • Unit/extension PR shards: shard 1 40 passed, 791 passed; shard 2 39 passed, 422 passed, 1 skipped.
  • Bun unit project: 77 passed, 1139 passed, 1 skipped.
  • Doc coverage: 156/156 adapters documented.
  • Security audit: found 0 vulnerabilities.

Live Trae CN smoke test was not run because http://127.0.0.1:39240/json was not listening locally at PR time. This is intentionally not a CI dependency because it requires a locally running and logged-in Trae CN app.

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.

1 participant