/** * Register a command hook in the OpenCode config if it doesn't already exist. * Returns true if the command was registered, false if it already existed. */ export function registerCommandHook( opencodeConfig: Record, commandName: string, template: string, description: string, ): boolean { const cmdConfig = (opencodeConfig as { command?: Record }) .command; if (cmdConfig?.[commandName]) return false; if (!opencodeConfig.command) (opencodeConfig as Record).command = {}; ( (opencodeConfig as Record).command as Record< string, unknown > )[commandName] = { template, description }; return true; }