fix: wire host config.skills.paths into command skill discovery
Mirrors the agent-config-handler change: command-config-handler now also discovers skills from host config.skills.paths set by other plugins, making them available as slash commands. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -157,4 +157,37 @@ describe("applyCommandConfig", () => {
|
|||||||
const commandConfig = config.command as Record<string, { agent?: string }>;
|
const commandConfig = config.command as Record<string, { agent?: string }>;
|
||||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
|
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("includes host config skills declared in config.skills.paths by other plugins", async () => {
|
||||||
|
// given - second call to discoverConfigSourceSkills returns host config skills
|
||||||
|
discoverConfigSourceSkillsSpy
|
||||||
|
.mockResolvedValueOnce([])
|
||||||
|
.mockResolvedValueOnce([
|
||||||
|
{
|
||||||
|
name: "host-config-skill",
|
||||||
|
definition: {
|
||||||
|
name: "host-config-skill",
|
||||||
|
description: "Host config skill",
|
||||||
|
template: "template",
|
||||||
|
},
|
||||||
|
scope: "config",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const config: Record<string, unknown> = {
|
||||||
|
command: {},
|
||||||
|
skills: { paths: ["/host/skills"] },
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
await applyCommandConfig({
|
||||||
|
config,
|
||||||
|
pluginConfig: createPluginConfig(),
|
||||||
|
ctx: { directory: "/tmp" },
|
||||||
|
pluginComponents: createPluginComponents(),
|
||||||
|
});
|
||||||
|
|
||||||
|
// then
|
||||||
|
const commandConfig = config.command as Record<string, { description?: string }>;
|
||||||
|
expect(commandConfig["host-config-skill"]?.description).toContain("Host config skill");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
log,
|
log,
|
||||||
} from "../shared";
|
} from "../shared";
|
||||||
import type { PluginComponents } from "./plugin-components-loader";
|
import type { PluginComponents } from "./plugin-components-loader";
|
||||||
|
import { adaptHostSkillConfig } from "../shared/host-skill-config";
|
||||||
|
|
||||||
export async function applyCommandConfig(params: {
|
export async function applyCommandConfig(params: {
|
||||||
config: Record<string, unknown>;
|
config: Record<string, unknown>;
|
||||||
@@ -47,8 +48,10 @@ export async function applyCommandConfig(params: {
|
|||||||
log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName));
|
log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hostSkillConfig = adaptHostSkillConfig(params.config.skills);
|
||||||
const [
|
const [
|
||||||
configSourceSkills,
|
configSourceSkills,
|
||||||
|
hostConfigSkills,
|
||||||
userCommands,
|
userCommands,
|
||||||
projectCommands,
|
projectCommands,
|
||||||
opencodeGlobalCommands,
|
opencodeGlobalCommands,
|
||||||
@@ -64,6 +67,10 @@ export async function applyCommandConfig(params: {
|
|||||||
config: params.pluginConfig.skills,
|
config: params.pluginConfig.skills,
|
||||||
configDir: params.ctx.directory,
|
configDir: params.ctx.directory,
|
||||||
}),
|
}),
|
||||||
|
discoverConfigSourceSkills({
|
||||||
|
config: hostSkillConfig,
|
||||||
|
configDir: params.ctx.directory,
|
||||||
|
}),
|
||||||
includeClaudeCommands ? loadUserCommands() : Promise.resolve({}),
|
includeClaudeCommands ? loadUserCommands() : Promise.resolve({}),
|
||||||
includeClaudeCommands ? loadProjectCommands(params.ctx.directory) : Promise.resolve({}),
|
includeClaudeCommands ? loadProjectCommands(params.ctx.directory) : Promise.resolve({}),
|
||||||
loadOpencodeGlobalCommands(),
|
loadOpencodeGlobalCommands(),
|
||||||
@@ -79,6 +86,7 @@ export async function applyCommandConfig(params: {
|
|||||||
params.config.command = {
|
params.config.command = {
|
||||||
...builtinCommands,
|
...builtinCommands,
|
||||||
...skillsToCommandDefinitionRecord(configSourceSkills),
|
...skillsToCommandDefinitionRecord(configSourceSkills),
|
||||||
|
...skillsToCommandDefinitionRecord(hostConfigSkills),
|
||||||
...userCommands,
|
...userCommands,
|
||||||
...userSkills,
|
...userSkills,
|
||||||
...globalAgentsSkills,
|
...globalAgentsSkills,
|
||||||
|
|||||||
Reference in New Issue
Block a user