fix(start-work): keep native command agents on config keys

This commit is contained in:
YeonGyu-Kim
2026-04-08 15:55:58 +09:00
parent aa1a18c5d8
commit cd95172e42
6 changed files with 42 additions and 26 deletions
@@ -97,7 +97,7 @@ describe("applyCommandConfig", () => {
expect(commandConfig["agents-global-skill"]?.description).toContain("Agents global skill");
});
test("remaps Atlas command agents to the list display name used by runtime agent lookup", async () => {
test("normalizes Atlas command agents to the config key OpenCode expects for native routing", async () => {
// given
loadBuiltinCommandsSpy.mockReturnValue({
"start-work": {
@@ -119,6 +119,31 @@ 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("atlas");
});
test("normalizes legacy display-name command agents back to config keys", async () => {
// given
loadBuiltinCommandsSpy.mockReturnValue({
"start-work": {
name: "start-work",
description: "(builtin) Start work",
template: "template",
agent: getAgentDisplayName("atlas"),
},
});
const config: Record<string, unknown> = { command: {} };
// when
await applyCommandConfig({
config,
pluginConfig: createPluginConfig(),
ctx: { directory: "/tmp" },
pluginComponents: createPluginComponents(),
});
// then
const commandConfig = config.command as Record<string, { agent?: string }>;
expect(commandConfig["start-work"]?.agent).toBe("atlas");
});
});