fix(auto-slash-command): load skill content via lazyContentLoader and include builtin skills

This commit is contained in:
YeonGyu-Kim
2026-01-07 02:55:32 +09:00
parent 53982f2078
commit 8e46a2cc78
3 changed files with 35 additions and 15 deletions
+12 -3
View File
@@ -2,7 +2,7 @@ import {
detectSlashCommand,
extractPromptText,
} from "./detector"
import { executeSlashCommand } from "./executor"
import { executeSlashCommand, type ExecutorOptions } from "./executor"
import { log } from "../../shared"
import {
AUTO_SLASH_COMMAND_TAG_OPEN,
@@ -12,6 +12,7 @@ import type {
AutoSlashCommandHookInput,
AutoSlashCommandHookOutput,
} from "./types"
import type { LoadedSkill } from "../../features/opencode-skill-loader"
export * from "./detector"
export * from "./executor"
@@ -20,7 +21,15 @@ export * from "./types"
const sessionProcessedCommands = new Set<string>()
export function createAutoSlashCommandHook() {
export interface AutoSlashCommandHookOptions {
skills?: LoadedSkill[]
}
export function createAutoSlashCommandHook(options?: AutoSlashCommandHookOptions) {
const executorOptions: ExecutorOptions = {
skills: options?.skills,
}
return {
"chat.message": async (
input: AutoSlashCommandHookInput,
@@ -52,7 +61,7 @@ export function createAutoSlashCommandHook() {
args: parsed.args,
})
const result = await executeSlashCommand(parsed)
const result = await executeSlashCommand(parsed, executorOptions)
const idx = output.parts.findIndex((p) => p.type === "text" && p.text)
if (idx < 0) {