fix(start-work): reuse registered opencode agent names

This commit is contained in:
YeonGyu-Kim
2026-04-08 16:18:26 +09:00
parent 24629643f0
commit 06b825dd74
13 changed files with 82 additions and 34 deletions
@@ -5,7 +5,10 @@ import * as skillLoader from "../features/opencode-skill-loader";
import type { OhMyOpenCodeConfig } from "../config";
import type { PluginComponents } from "./plugin-components-loader";
import { applyCommandConfig } from "./command-config-handler";
import { getAgentDisplayName } from "../shared/agent-display-names";
import {
getAgentDisplayName,
getAgentListDisplayName,
} from "../shared/agent-display-names";
function createPluginComponents(): PluginComponents {
return {
@@ -97,7 +100,7 @@ describe("applyCommandConfig", () => {
expect(commandConfig["agents-global-skill"]?.description).toContain("Agents global skill");
});
test("normalizes Atlas command agents to the canonical display name used for native routing", async () => {
test("normalizes Atlas command agents to the exported list key used by opencode command routing", async () => {
// given
loadBuiltinCommandsSpy.mockReturnValue({
"start-work": {
@@ -119,10 +122,10 @@ describe("applyCommandConfig", () => {
// then
const commandConfig = config.command as Record<string, { agent?: string }>;
expect(commandConfig["start-work"]?.agent).toBe(getAgentDisplayName("atlas"));
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
});
test("normalizes legacy display-name command agents to the canonical display name", async () => {
test("normalizes legacy display-name command agents to the exported list key", async () => {
// given
loadBuiltinCommandsSpy.mockReturnValue({
"start-work": {
@@ -144,6 +147,6 @@ describe("applyCommandConfig", () => {
// then
const commandConfig = config.command as Record<string, { agent?: string }>;
expect(commandConfig["start-work"]?.agent).toBe(getAgentDisplayName("atlas"));
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
});
});