fix(auto-slash-command): use event-ID dedup, align precedence, enforce skill agent gate

🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-openagent)
This commit is contained in:
YeonGyu-Kim
2026-03-16 13:53:12 +09:00
parent 67bb9ec1e2
commit 32a296bf1e
6 changed files with 231 additions and 40 deletions
+15 -5
View File
@@ -41,6 +41,7 @@ export interface ExecutorOptions {
skills?: LoadedSkill[]
pluginsEnabled?: boolean
enabledPluginsOverride?: Record<string, boolean>
agent?: string
}
function filterDiscoveredCommandsByScope(
@@ -60,12 +61,12 @@ async function discoverAllCommands(options?: ExecutorOptions): Promise<CommandIn
const skillCommands = skills.map(skillToCommandInfo)
return [
...filterDiscoveredCommandsByScope(discoveredCommands, "builtin"),
...filterDiscoveredCommandsByScope(discoveredCommands, "opencode-project"),
...filterDiscoveredCommandsByScope(discoveredCommands, "project"),
...filterDiscoveredCommandsByScope(discoveredCommands, "opencode"),
...filterDiscoveredCommandsByScope(discoveredCommands, "user"),
...skillCommands,
...filterDiscoveredCommandsByScope(discoveredCommands, "project"),
...filterDiscoveredCommandsByScope(discoveredCommands, "user"),
...filterDiscoveredCommandsByScope(discoveredCommands, "opencode-project"),
...filterDiscoveredCommandsByScope(discoveredCommands, "opencode"),
...filterDiscoveredCommandsByScope(discoveredCommands, "builtin"),
...filterDiscoveredCommandsByScope(discoveredCommands, "plugin"),
]
}
@@ -141,6 +142,15 @@ export async function executeSlashCommand(parsed: ParsedSlashCommand, options?:
}
}
if (command.scope === "skill" && command.metadata.agent) {
if (!options?.agent || command.metadata.agent !== options.agent) {
return {
success: false,
error: `Skill "${command.name}" is restricted to agent "${command.metadata.agent}"`,
}
}
}
try {
const template = await formatCommandTemplate(command, parsed.args)
return {