fix: wire host config.skills.paths into agent skill discovery
When another plugin (e.g. superpowers) injects skill directories via config.skills.paths in the config hook, the agent-config-handler now discovers those skills via a second discoverConfigSourceSkills call using the adapted host config. Fixes #3396. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -122,4 +122,50 @@ describe("applyAgentConfig .agents skills", () => {
|
||||
expect(discoveredSkills.map(skill => skill.name)).toContain("project-agent-skill")
|
||||
expect(discoveredSkills.map(skill => skill.name)).toContain("global-agent-skill")
|
||||
})
|
||||
|
||||
test("discovers skills from host config.skills.paths set 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", template: "host-template" },
|
||||
scope: "config",
|
||||
},
|
||||
])
|
||||
|
||||
// when
|
||||
await applyAgentConfig({
|
||||
config: {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
agent: {},
|
||||
skills: { paths: ["/host/skills"] },
|
||||
},
|
||||
pluginConfig: createPluginConfig(),
|
||||
ctx: { directory: "/tmp/project" },
|
||||
pluginComponents: createPluginComponents(),
|
||||
})
|
||||
|
||||
// then
|
||||
const discoveredSkills = createBuiltinAgentsSpy.mock.calls[0]?.[6] as Array<{ name: string }>
|
||||
expect(discoveredSkills.map(skill => skill.name)).toContain("host-config-skill")
|
||||
})
|
||||
|
||||
test("calls discoverConfigSourceSkills twice when host config has skills", async () => {
|
||||
// when
|
||||
await applyAgentConfig({
|
||||
config: {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
agent: {},
|
||||
skills: { paths: ["/host/skills"] },
|
||||
},
|
||||
pluginConfig: createPluginConfig(),
|
||||
ctx: { directory: "/tmp/project" },
|
||||
pluginComponents: createPluginComponents(),
|
||||
})
|
||||
|
||||
// then - called twice: once for pluginConfig.skills, once for host config.skills
|
||||
expect(discoverConfigSourceSkillsSpy).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
} from "./agent-override-protection";
|
||||
import { buildPrometheusAgentConfig } from "./prometheus-agent-config-builder";
|
||||
import { buildPlanDemoteConfig } from "./plan-model-inheritance";
|
||||
import { adaptHostSkillConfig } from "../shared/host-skill-config";
|
||||
|
||||
type AgentConfigRecord = Record<string, Record<string, unknown> | undefined> & {
|
||||
build?: Record<string, unknown>;
|
||||
@@ -61,8 +62,10 @@ export async function applyAgentConfig(params: {
|
||||
) as typeof params.pluginConfig.disabled_agents;
|
||||
|
||||
const includeClaudeSkillsForAwareness = params.pluginConfig.claude_code?.skills ?? true;
|
||||
const hostSkillConfig = adaptHostSkillConfig(params.config.skills);
|
||||
const [
|
||||
discoveredConfigSourceSkills,
|
||||
discoveredHostConfigSkills,
|
||||
discoveredUserSkills,
|
||||
discoveredProjectSkills,
|
||||
discoveredProjectAgentsSkills,
|
||||
@@ -74,6 +77,10 @@ export async function applyAgentConfig(params: {
|
||||
config: params.pluginConfig.skills,
|
||||
configDir: params.ctx.directory,
|
||||
}),
|
||||
discoverConfigSourceSkills({
|
||||
config: hostSkillConfig,
|
||||
configDir: params.ctx.directory,
|
||||
}),
|
||||
includeClaudeSkillsForAwareness ? discoverUserClaudeSkills() : Promise.resolve([]),
|
||||
includeClaudeSkillsForAwareness
|
||||
? discoverProjectClaudeSkills(params.ctx.directory)
|
||||
@@ -88,6 +95,7 @@ export async function applyAgentConfig(params: {
|
||||
|
||||
const allDiscoveredSkills = [
|
||||
...discoveredConfigSourceSkills,
|
||||
...discoveredHostConfigSkills,
|
||||
...discoveredOpencodeProjectSkills,
|
||||
...discoveredProjectSkills,
|
||||
...discoveredProjectAgentsSkills,
|
||||
|
||||
Reference in New Issue
Block a user