Skip to content

Commit 7fef07d

Browse files
committed
fix(config): normalize agent names to support case-insensitive config
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
1 parent 62307d9 commit 7fef07d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,36 @@ function getUserConfigDir(): string {
6565
return process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
6666
}
6767

68+
const AGENT_NAME_MAP: Record<string, string> = {
69+
omo: "OmO",
70+
build: "build",
71+
oracle: "oracle",
72+
librarian: "librarian",
73+
explore: "explore",
74+
"frontend-ui-ux-engineer": "frontend-ui-ux-engineer",
75+
"document-writer": "document-writer",
76+
"multimodal-looker": "multimodal-looker",
77+
};
78+
79+
function normalizeAgentNames(agents: Record<string, unknown>): Record<string, unknown> {
80+
const normalized: Record<string, unknown> = {};
81+
for (const [key, value] of Object.entries(agents)) {
82+
const normalizedKey = AGENT_NAME_MAP[key.toLowerCase()] ?? key;
83+
normalized[normalizedKey] = value;
84+
}
85+
return normalized;
86+
}
87+
6888
function loadConfigFromPath(configPath: string): OhMyOpenCodeConfig | null {
6989
try {
7090
if (fs.existsSync(configPath)) {
7191
const content = fs.readFileSync(configPath, "utf-8");
7292
const rawConfig = JSON.parse(content);
93+
94+
if (rawConfig.agents && typeof rawConfig.agents === "object") {
95+
rawConfig.agents = normalizeAgentNames(rawConfig.agents);
96+
}
97+
7398
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
7499

75100
if (!result.success) {

0 commit comments

Comments
 (0)