fix(start-work): align command routing with exported agent keys

This commit is contained in:
YeonGyu-Kim
2026-04-08 16:00:47 +09:00
parent 4394129667
commit 8925ec3a16
3 changed files with 55 additions and 7 deletions
@@ -5,7 +5,7 @@ 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 +97,7 @@ describe("applyCommandConfig", () => {
expect(commandConfig["agents-global-skill"]?.description).toContain("Agents global skill");
});
test("normalizes Atlas command agents to the config key OpenCode expects for native routing", async () => {
test("normalizes Atlas command agents to the exported agent key used for native routing", async () => {
// given
loadBuiltinCommandsSpy.mockReturnValue({
"start-work": {
@@ -119,10 +119,10 @@ describe("applyCommandConfig", () => {
// then
const commandConfig = config.command as Record<string, { agent?: string }>;
expect(commandConfig["start-work"]?.agent).toBe("atlas");
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
});
test("normalizes legacy display-name command agents back to config keys", async () => {
test("normalizes legacy display-name command agents to the exported agent key", async () => {
// given
loadBuiltinCommandsSpy.mockReturnValue({
"start-work": {
@@ -144,6 +144,6 @@ describe("applyCommandConfig", () => {
// then
const commandConfig = config.command as Record<string, { agent?: string }>;
expect(commandConfig["start-work"]?.agent).toBe("atlas");
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
});
});