Skip to content

feat: add support for the Trae tool adapter#672

Open
cherrwer wants to merge 4 commits intoFission-AI:mainfrom
cherrwer:feat/add-trae-command
Open

feat: add support for the Trae tool adapter#672
cherrwer wants to merge 4 commits intoFission-AI:mainfrom
cherrwer:feat/add-trae-command

Conversation

@cherrwer
Copy link

@cherrwer cherrwer commented Feb 6, 2026

Summary by CodeRabbit

  • New Features
    • Add Trae tool integration to export commands as Trae-compatible Markdown with frontmatter metadata.
  • Documentation
    • Update supported-tools reference with Trae configuration and OPSX command path guidance.
  • Tests
    • Add tests covering Trae adapter path generation and frontmatter/file formatting.
  • Chores
    • Ignore Trae runtime files by adding .trae/ to .gitignore.

@cherrwer cherrwer requested a review from TabishB as a code owner February 6, 2026 10:03
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Adds a new Trae command adapter that formats commands into Markdown with YAML frontmatter, re-exports and registers it, updates docs and .gitignore, and adds tests covering path and formatting behavior.

Changes

Cohort / File(s) Summary
Config & Docs
/.gitignore, docs/supported-tools.md
Ignored .trae/ entry added; docs updated to point Trae commands to .trae/commands/opsx/ and note OPSX binding (/opsx:*).
Adapter Implementation
src/core/command-generation/adapters/trae.ts
New traeAdapter implementing ToolCommandAdapter with getFilePath(commandId) and formatFile(content); includes YAML-escaping and tags serialization; emits files under .trae/commands/opsx/<id>.md.
Exports & Registry
src/core/command-generation/adapters/index.ts, src/core/command-generation/registry.ts
traeAdapter re-exported and registered in CommandAdapterRegistry.
Tests
test/core/command-generation/adapters.test.ts
Added tests for traeAdapter covering toolId, path construction (using path.join), YAML frontmatter formatting, and empty-tags handling.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Registry as CommandAdapterRegistry
    participant Adapter as traeAdapter
    participant FS as FileSystem

    Client->>Registry: request adapter for Trae
    Registry-->>Client: returns traeAdapter
    Client->>Adapter: getFilePath(commandId)
    Adapter-->>Client: ".trae/commands/opsx/<id>.md"
    Client->>Adapter: formatFile(commandContent)
    Adapter->>Adapter: YAML-escape fields, serialize tags, build markdown
    Adapter-->>Client: formatted Markdown with frontmatter
    Client->>FS: write file to returned path
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • TabishB

Poem

🐰 I hop through .trae with a jaunty beat,
I tuck commands in opsx beds so neat,
YAML pillows, tags all in a row,
Markdown carrots lined up in a row,
Hooray — new adapter, ready to meet!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add support for the Trae tool adapter' directly and accurately describes the main change: implementing a new Trae command adapter across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.gitignore:
- Around line 149-151: Update the comment for the Trae entry to match the
project's comment style by adding a space after the hash; change the existing
"#Trae" comment to "# Trae" directly above the ".trae/" ignore rule so it is
consistent with other entries (e.g., "# Claude", "# Pnpm") in the .gitignore.
🧹 Nitpick comments (2)
docs/supported-tools.md (1)

36-36: Nit: the (via /opsx:*) annotation is unique to Trae.

Other adapters that also use the commands/opsx/ path pattern (Claude, CodeBuddy, Crush, Gemini, Qoder) don't include this annotation. Consider removing it for consistency, or adding it to the other similar entries.

src/core/command-generation/adapters/trae.ts (1)

10-22: Consider extracting shared YAML helpers to a common utility.

escapeYamlValue and formatTagsArray are duplicated across multiple adapters: Claude, Windsurf, and Cursor (and now Trae). Extracting them into a shared module (e.g., adapters/utils.ts) would reduce maintenance burden when the escaping logic needs updating.

Not blocking for this PR since it follows the established pattern.

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