fix: load skill content via lazyContentLoader in slashcommand tool

- Fix #542: slashcommand tool returns empty content for skills
- Add lazyContentLoader to CommandInfo type
- Load skill content in formatLoadedCommand when content is empty
- Filter non-ultrawork keywords in subagent sessions
This commit is contained in:
YeonGyu-Kim
2026-01-07 01:41:42 +09:00
parent d331b484f9
commit ad44af9d15
3 changed files with 35 additions and 3 deletions

View File

@@ -80,6 +80,7 @@ function skillToCommandInfo(skill: LoadedSkill): CommandInfo {
},
content: skill.definition.template,
scope: skill.scope,
lazyContentLoader: skill.lazyContent,
}
}
@@ -112,8 +113,13 @@ async function formatLoadedCommand(cmd: CommandInfo): Promise<string> {
sections.push("---\n")
sections.push("## Command Instructions\n")
let content = cmd.content || ""
if (!content && cmd.lazyContentLoader) {
content = await cmd.lazyContentLoader.load()
}
const commandDir = cmd.path ? dirname(cmd.path) : process.cwd()
const withFileRefs = await resolveFileReferencesInText(cmd.content || "", commandDir)
const withFileRefs = await resolveFileReferencesInText(content, commandDir)
const resolvedContent = await resolveCommandsInText(withFileRefs)
sections.push(resolvedContent.trim())

View File

@@ -1,4 +1,4 @@
import type { LoadedSkill } from "../../features/opencode-skill-loader"
import type { LoadedSkill, LazyContentLoader } from "../../features/opencode-skill-loader"
export type CommandScope = "builtin" | "config" | "user" | "project" | "opencode" | "opencode-project"
@@ -17,6 +17,7 @@ export interface CommandInfo {
metadata: CommandMetadata
content?: string
scope: CommandScope
lazyContentLoader?: LazyContentLoader
}
export interface SlashcommandToolOptions {