fix(slashcommand): deduplicate opencode command aliases

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-03-26 11:36:59 +09:00
parent 9fde370838
commit 94b4a4f850
2 changed files with 49 additions and 2 deletions
+18 -2
View File
@@ -76,6 +76,22 @@ function discoverPluginCommands(options?: CommandDiscoveryOptions): CommandInfo[
}))
}
function deduplicateCommandInfosByName(commands: CommandInfo[]): CommandInfo[] {
const seen = new Set<string>()
const deduplicatedCommands: CommandInfo[] = []
for (const command of commands) {
if (seen.has(command.name)) {
continue
}
seen.add(command.name)
deduplicatedCommands.push(command)
}
return deduplicatedCommands
}
export function discoverCommandsSync(
directory?: string,
options?: CommandDiscoveryOptions,
@@ -110,12 +126,12 @@ export function discoverCommandsSync(
scope: "builtin",
}))
return [
return deduplicateCommandInfosByName([
...projectCommands,
...userCommands,
...opencodeProjectCommands,
...opencodeGlobalCommands,
...builtinCommands,
...pluginCommands,
]
])
}