Skip to content

feat(skills): add Trae CN as a supported skill host#142

Merged
BlackHole1 merged 1 commit into
mainfrom
add-trae-cn-skill
May 6, 2026
Merged

feat(skills): add Trae CN as a supported skill host#142
BlackHole1 merged 1 commit into
mainfrom
add-trae-cn-skill

Conversation

@BlackHole1
Copy link
Copy Markdown
Member

Trae CN ships under a separate ~/.trae-cn home directory, so users of that variant could not receive oo-managed skills through any of the existing host code paths. Register trae-cn as a first-class agent across path resolution, bundled skill assets, host labels and errors, the i18n catalog, and the preflight, list, install, publish, and remove commands, reusing the CodeBuddy-derived SKILL content already embedded for Trae. Documentation and tests are updated to match.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Summary by CodeRabbit

  • New Features

    • Added Trae CN as a new bundled skill host and made it available in discovery, installation, publication, and management flows.
    • Added bundled skill entries for Trae and Trae CN.
  • Documentation

    • Updated README(s) and command docs to include Trae CN and related guidance.
  • Localization

    • Added English and Chinese messages for Trae CN (host labels and not-installed errors).
  • Tests

    • Extended test coverage to exercise Trae CN scenarios across skill workflows.

Walkthrough

Adds a new bundled skill host "Trae CN" (agent name "trae-cn") across the repo. Changes include docs (README, docs/commands), a new home-directory resolver, registration in bundled-skill registries, additions to available agent names and host ordering, i18n keys and messages, publication mode updates (symlink-capable), host label and error-key handling, and extensive test coverage for install/publish/list/init flows targeting Trae CN.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant Registry
  participant PathResolver
  participant Publication
  participant FS

  User->>CLI: run "oo install/publish --agent trae-cn"
  CLI->>PathResolver: resolveTraeCnHomeDirectory(env)
  PathResolver-->>CLI: trae-cn home path
  CLI->>Registry: getBundledSkillFiles("oo", "trae-cn")
  Registry-->>CLI: list of asset files
  CLI->>Publication: resolveManagedSkillPublicationMode("trae-cn")
  Publication-->>CLI: symlink-or-copy
  CLI->>FS: ensure canonical store (create if missing)
  FS-->>CLI: canonical path confirmed
  CLI->>FS: create symlink at trae-cn host target -> canonical path
  FS-->>CLI: symlink created
  CLI-->>User: success output (includes host label via i18n)
Loading

Possibly related PRs

  • oomol-lab/oo-cli#124: Adds a new bundled skill host agent with direct code-level changes to bundled-skill-paths, embedded-assets, host ordering, and i18n keys using an identical pattern
  • oomol-lab/oo-cli#118: Adds a new bundled skill host through the same code-level modifications to path resolvers, registry entries, host labels, error handling, and test coverage
  • oomol-lab/oo-cli#117: Adds a different bundled skill host agent (qoderwork) by modifying the identical skill-host infrastructure files and patterns
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format and clearly summarizes the main change: adding Trae CN as a supported skill host.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale, scope, and implementation details of adding Trae CN support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch add-trae-cn-skill

Comment @coderabbitai help to get the list of available commands and usage tips.

Trae CN ships under a separate `~/.trae-cn` home directory, so users
of that variant could not receive oo-managed skills through any of
the existing host code paths. Register `trae-cn` as a first-class
agent across path resolution, bundled skill assets, host labels and
errors, the i18n catalog, and the preflight, list, install, publish,
and remove commands, reusing the CodeBuddy-derived SKILL content
already embedded for Trae. Documentation and tests are updated to
match.

Signed-off-by: Kevin Cui <bh@bugs.cc>
@BlackHole1 BlackHole1 force-pushed the add-trae-cn-skill branch from 2d874ed to 83ad5ae Compare May 6, 2026 10:04
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (3)
src/application/commands/skills/managed-skill-host-labels.ts (1)

10-31: 🏗️ Heavy lift

Consolidate host metadata mappings into one shared config object.

Line 10 maintains one of several parallel host-key mappings; adding trae-cn required synchronized edits in multiple files, which is drift-prone. Consider a single host config (e.g., labelKey, missingErrorKey, homeResolver) consumed by all host-specific helpers.

As per coding guidelines, "Consolidate multiple switch/map structures that share the same keys into a single configuration object (data-driven over parallel mappings)" and "Extract shared utilities when identical logic appears in 2+ files".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/application/commands/skills/managed-skill-host-labels.ts` around lines 10
- 31, The switch on agentName in managed-skill-host-labels.ts should be replaced
by a single shared host configuration object (mapping agent keys to a small
config with properties like labelKey, missingErrorKey, and homeResolver) and
have this file lookup translator.t(config.labelKey) rather than hardcoding
cases; create the shared config (e.g., HOST_CONFIG with entries for
"claude","codebuddy","codex","hermes","openclaw","qoderwork","trae","trae-cn","workbuddy")
and update other host-specific helpers to consume the same HOST_CONFIG so adding
"trae-cn" is a single edit across the codebase. Ensure the default branch throws
or narrows using the config lookup (instead of `agentName satisfies never`) and
export the config for reuse by functions that previously used parallel
switch/map logic.
src/application/commands/skills/list.cli.test.ts (1)

387-414: ⚡ Quick win

Prefer a table-driven host matrix instead of adding another copy-pasted host test.

Line 387 onward repeats the same setup/assertion flow used by adjacent host cases. Converting these host-specific tests into one parameterized loop will reduce drift and make future host additions cheaper.

♻️ Suggested refactor shape
+const startupSynchronizedHostCases = [
+  ["OpenClaw", resolveOpenClawHomeDirectory],
+  ["QoderWork", resolveQoderWorkHomeDirectory],
+  ["CodeBuddy", resolveCodeBuddyHomeDirectory],
+  ["WorkBuddy", resolveWorkBuddyHomeDirectory],
+  ["Trae", resolveTraeHomeDirectory],
+  ["Trae CN", resolveTraeCnHomeDirectory],
+  ["Hermes", resolveHermesHomeDirectory],
+] as const;
+
+for (const [hostLabel, resolveHomeDirectory] of startupSynchronizedHostCases) {
+  test(`lists startup-synchronized ${hostLabel} bundled installs when Codex is not installed`, async () => {
+    const sandbox = await createCliSandbox();
+    const homeDirectory = resolveHomeDirectory(sandbox.env);
+    try {
+      await mkdir(homeDirectory, { recursive: true });
+      await sandbox.run(["skills", "install", "oo"], { version: "9.9.9" });
+      const result = await sandbox.run(["skills", "list"], { version: "9.9.9" });
+      expect(result.exitCode).toBe(0);
+      expect(result.stderr).toBe("");
+      expect(result.stdout).toBe(["✓ Found 4 skills.", "", ...createExpectedBundledSkillLines(hostLabel)].join("\n"));
+    } finally {
+      await sandbox.cleanup();
+    }
+  });
+}
As per coding guidelines, "Extract repeated setup (mocks, stubs, setup objects) into local factory functions in test files; avoid copy-pasting test setup".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/application/commands/skills/list.cli.test.ts` around lines 387 - 414, The
test "lists startup-synchronized Trae CN bundled installs when Codex is not
installed" duplicates setup/assertion used by other host-specific tests;
refactor into a table-driven matrix test that iterates hosts (e.g., "Trae CN",
other hosts) and runs the same flow using the existing helpers createCliSandbox,
resolveTraeCnHomeDirectory (or a generic resolveHomeDirectory factory),
sandbox.run(["skills","install","oo"], {version:"9.9.9"}),
sandbox.run(["skills","list"], {version:"9.9.9"}), and assertions against
createExpectedBundledSkillLines; extract common setup/cleanup into a local
factory function and replace the repeated test with a single parameterized test
that supplies host names and expected lines.
src/application/commands/skills/check.test.ts (1)

252-284: ⚡ Quick win

Extract repeated preflight-agent test setup into a shared local helper.

This new case repeats the same sandbox/setup/assert/cleanup shape already duplicated across multiple agent tests; please route this through a local factory/helper to keep future host additions cheaper and less error-prone.

♻️ Suggested direction
-    test("checks Trae CN as a requested agent", async () => {
-        const sandbox = await createCliSandbox();
-        const traeCnHomeDirectory = resolveTraeCnHomeDirectory(sandbox.env);
-        const storePaths = resolveStorePaths({
-            appName: APP_NAME,
-            env: sandbox.env,
-            platform: process.platform,
-        });
-        const canonicalRootDirectoryPath = resolveLocalSkillCanonicalRootDirectoryPath(
-            storePaths.settingsFilePath,
-        );
-
-        try {
-            await mkdir(traeCnHomeDirectory, { recursive: true });
-
-            const result = await sandbox.run([
-                "skills",
-                "preflight",
-                "--agent",
-                "trae-cn",
-            ]);
-
-            expect(result.exitCode).toBe(0);
-            expect(result.stderr).toBe("");
-            expect(result.stdout).toBe(
-                `Local skill editing is ready. Writable storage: ${canonicalRootDirectoryPath}. Supported hosts: 1.\n`,
-            );
-            expect(await readdir(canonicalRootDirectoryPath)).toEqual([]);
-        }
-        finally {
-            await sandbox.cleanup();
-        }
-    });
+    test("checks Trae CN as a requested agent", async () => {
+        await expectRequestedAgentPreflightSuccess({
+            agentName: "trae-cn",
+            resolveHomeDirectory: resolveTraeCnHomeDirectory,
+        });
+    });

As per coding guidelines, "Extract repeated setup (mocks, stubs, setup objects) into local factory functions in test files; avoid copy-pasting test setup."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/application/commands/skills/check.test.ts` around lines 252 - 284,
Extract the repeated preflight-agent test setup into a local helper factory
(e.g., a function in this test file like createPreflightAgentSandbox) that
encapsulates createCliSandbox(), resolving traeCnHomeDirectory via
resolveTraeCnHomeDirectory(env), computing storePaths with resolveStorePaths({
appName: APP_NAME, env, platform: process.platform }), deriving
canonicalRootDirectoryPath via
resolveLocalSkillCanonicalRootDirectoryPath(storePaths.settingsFilePath),
creating the directory (mkdir(..., { recursive: true })), running
sandbox.run(["skills","preflight","--agent","trae-cn"]) and returning the
sandbox plus result and canonicalRootDirectoryPath; then update this test to
call that helper and keep only the asserts (expect exitCode/stderr/stdout and
readdir check) and finally call sandbox.cleanup() from the helper or test as
appropriate to avoid duplication across agent tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/application/commands/skills/check.test.ts`:
- Around line 252-284: Extract the repeated preflight-agent test setup into a
local helper factory (e.g., a function in this test file like
createPreflightAgentSandbox) that encapsulates createCliSandbox(), resolving
traeCnHomeDirectory via resolveTraeCnHomeDirectory(env), computing storePaths
with resolveStorePaths({ appName: APP_NAME, env, platform: process.platform }),
deriving canonicalRootDirectoryPath via
resolveLocalSkillCanonicalRootDirectoryPath(storePaths.settingsFilePath),
creating the directory (mkdir(..., { recursive: true })), running
sandbox.run(["skills","preflight","--agent","trae-cn"]) and returning the
sandbox plus result and canonicalRootDirectoryPath; then update this test to
call that helper and keep only the asserts (expect exitCode/stderr/stdout and
readdir check) and finally call sandbox.cleanup() from the helper or test as
appropriate to avoid duplication across agent tests.

In `@src/application/commands/skills/list.cli.test.ts`:
- Around line 387-414: The test "lists startup-synchronized Trae CN bundled
installs when Codex is not installed" duplicates setup/assertion used by other
host-specific tests; refactor into a table-driven matrix test that iterates
hosts (e.g., "Trae CN", other hosts) and runs the same flow using the existing
helpers createCliSandbox, resolveTraeCnHomeDirectory (or a generic
resolveHomeDirectory factory), sandbox.run(["skills","install","oo"],
{version:"9.9.9"}), sandbox.run(["skills","list"], {version:"9.9.9"}), and
assertions against createExpectedBundledSkillLines; extract common setup/cleanup
into a local factory function and replace the repeated test with a single
parameterized test that supplies host names and expected lines.

In `@src/application/commands/skills/managed-skill-host-labels.ts`:
- Around line 10-31: The switch on agentName in managed-skill-host-labels.ts
should be replaced by a single shared host configuration object (mapping agent
keys to a small config with properties like labelKey, missingErrorKey, and
homeResolver) and have this file lookup translator.t(config.labelKey) rather
than hardcoding cases; create the shared config (e.g., HOST_CONFIG with entries
for
"claude","codebuddy","codex","hermes","openclaw","qoderwork","trae","trae-cn","workbuddy")
and update other host-specific helpers to consume the same HOST_CONFIG so adding
"trae-cn" is a single edit across the codebase. Ensure the default branch throws
or narrows using the config lookup (instead of `agentName satisfies never`) and
export the config for reuse by functions that previously used parallel
switch/map logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8076ee28-3281-4958-8ee4-dfd72599fe91

📥 Commits

Reviewing files that changed from the base of the PR and between 2d874ed and 83ad5ae.

📒 Files selected for processing (19)
  • README-ZH_CN.md
  • README.md
  • docs/commands.md
  • docs/commands.zh-CN.md
  • src/application/commands/skills/bundled-skill-observation.test.ts
  • src/application/commands/skills/bundled-skill-paths.ts
  • src/application/commands/skills/check.test.ts
  • src/application/commands/skills/embedded-assets.test.ts
  • src/application/commands/skills/embedded-assets.ts
  • src/application/commands/skills/index.test.ts
  • src/application/commands/skills/init.test.ts
  • src/application/commands/skills/list.cli.test.ts
  • src/application/commands/skills/list.ts
  • src/application/commands/skills/managed-skill-host-errors.ts
  • src/application/commands/skills/managed-skill-host-labels.ts
  • src/application/commands/skills/managed-skill-publication.test.ts
  • src/application/commands/skills/managed-skill-publication.ts
  • src/application/commands/skills/publish.test.ts
  • src/i18n/catalog.ts

@BlackHole1 BlackHole1 merged commit cc38b07 into main May 6, 2026
5 checks passed
@BlackHole1 BlackHole1 deleted the add-trae-cn-skill branch May 6, 2026 10:15
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