Skip to content
Closed
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
11 changes: 10 additions & 1 deletion packages/opencode/src/command/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import path from "path"
import { InstanceState } from "@/effect/instance-state"
import { EffectBridge } from "@/effect/bridge"
import type { InstanceContext } from "@/project/instance-context"
Expand Down Expand Up @@ -132,12 +133,20 @@ export const layer = Layer.effect(

for (const item of yield* skill.all()) {
if (commands[item.name]) continue
// Built-in skills have no on-disk directory, so omit the base-directory hint.
const dir = item.location === "<built-in>" ? undefined : path.dirname(item.location)
commands[item.name] = {
name: item.name,
description: item.description,
source: "skill",
get template() {
return item.content
if (!dir) return item.content
return [
item.content,
"",
`Base directory for this skill: ${dir}`,
"Relative paths in this skill (e.g., scripts/, references/) are relative to this base directory.",
].join("\n")
},
hints: [],
}
Expand Down
3 changes: 1 addition & 2 deletions packages/opencode/src/skill/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import path from "path"
import { pathToFileURL } from "url"
import { Effect, Layer, Context, Schema } from "effect"
import { NamedError } from "@opencode-ai/core/util/error"
import type { Agent } from "@/agent/agent"
Expand Down Expand Up @@ -339,7 +338,7 @@ export function fmt(list: Info[], opts: { verbose: boolean }) {
" <skill>",
` <name>${skill.name}</name>`,
` <description>${skill.description}</description>`,
` <location>${pathToFileURL(skill.location).href}</location>`,
` <location>${skill.location}</location>`,
" </skill>",
]),
"</available_skills>",
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/src/tool/skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const SkillTool = Tool.define(
info.content.trim(),
"",
`Base directory for this skill: ${base}`,
"Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
"Relative paths in this skill (e.g., scripts/, references/) are relative to this base directory.",
"Note: file list is sampled.",
"",
"<skill_files>",
Expand Down
Loading