Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/opencode/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SessionID, MessageID } from "@/session/schema"
import { Effect, Layer, Context } from "effect"
import z from "zod"
import { Config } from "../config"
import { ConfigMarkdown } from "../config"
import { MCP } from "../mcp"
import { Skill } from "../skill"
import PROMPT_INITIALIZE from "./template/initialize.txt"
Expand Down Expand Up @@ -152,7 +153,9 @@ export const layer = Layer.effect(
description: item.description,
source: "skill",
get template() {
return item.content
return ConfigMarkdown.parse(item.location)
.then((md) => md.content)
.catch(() => item.content)
},
hints: [],
}
Expand Down
7 changes: 6 additions & 1 deletion packages/opencode/src/tool/skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Effect } from "effect"
import * as Stream from "effect/Stream"
import { Ripgrep } from "../file/ripgrep"
import { Skill } from "../skill"
import { ConfigMarkdown } from "../config"
import * as Tool from "./tool"
import DESCRIPTION from "./skill.txt"

Expand Down Expand Up @@ -39,6 +40,10 @@ export const SkillTool = Tool.define(

const dir = path.dirname(info.location)
const base = pathToFileURL(dir).href
const content = yield* Effect.tryPromise(() => ConfigMarkdown.parse(info.location)).pipe(
Effect.map((md) => md.content.trim()),
Effect.catch(() => Effect.succeed(info.content.trim())),
)
const limit = 10
const files = yield* rg.files({ cwd: dir, follow: false, hidden: true, signal: ctx.abort }).pipe(
Stream.filter((file) => !file.includes("SKILL.md")),
Expand All @@ -54,7 +59,7 @@ export const SkillTool = Tool.define(
`<skill_content name="${info.name}">`,
`# Skill: ${info.name}`,
"",
info.content.trim(),
content,
"",
`Base directory for this skill: ${base}`,
"Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
Expand Down
Loading