File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff 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+
6888function 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 ) {
You can’t perform that action at this time.
0 commit comments