From 1ed76ccace6c409c211d4ce850ee02de85d1b813 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Wed, 3 Jun 2026 18:24:49 -0400 Subject: [PATCH] fix(core): load built-in skill asset at runtime --- packages/core/src/markdown.d.ts | 4 ---- packages/core/src/plugin/skill.ts | 4 ++-- packages/opencode/src/skill/index.ts | 4 +++- 3 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 packages/core/src/markdown.d.ts diff --git a/packages/core/src/markdown.d.ts b/packages/core/src/markdown.d.ts deleted file mode 100644 index eb3e3b92d66..00000000000 --- a/packages/core/src/markdown.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.md" { - const content: string - export default content -} diff --git a/packages/core/src/plugin/skill.ts b/packages/core/src/plugin/skill.ts index 8ce22373da3..c3e226f740e 100644 --- a/packages/core/src/plugin/skill.ts +++ b/packages/core/src/plugin/skill.ts @@ -4,13 +4,13 @@ import { Effect } from "effect" import { PluginV2 } from "../plugin" import { AbsolutePath } from "../schema" import { SkillV2 } from "../skill" -import CUSTOMIZE_OPENCODE_SKILL_BODY from "./skill/customize-opencode.md" with { type: "text" } export const Plugin = PluginV2.define({ id: PluginV2.ID.make("skill"), effect: Effect.gen(function* () { const skill = yield* SkillV2.Service const transform = yield* skill.transform() + const content = yield* Effect.promise(() => Bun.file(new URL("./skill/customize-opencode.md", import.meta.url)).text()) yield* transform((editor) => { editor.source( @@ -21,7 +21,7 @@ export const Plugin = PluginV2.define({ description: "Use ONLY when the user is editing or creating opencode's own configuration: opencode.json, opencode.jsonc, files under .opencode/, or files under ~/.config/opencode/. Also use when creating or fixing opencode agents, subagents, skills, plugins, MCP servers, or permission rules. Do not use for the user's own application code, or for any project that is not configuring opencode itself.", location: AbsolutePath.make("/builtin/customize-opencode.md"), - content: CUSTOMIZE_OPENCODE_SKILL_BODY, + content, }), }), ) diff --git a/packages/opencode/src/skill/index.ts b/packages/opencode/src/skill/index.ts index b128a19da28..7a101658a8a 100644 --- a/packages/opencode/src/skill/index.ts +++ b/packages/opencode/src/skill/index.ts @@ -15,7 +15,6 @@ import { RuntimeFlags } from "@/effect/runtime-flags" import { Glob } from "@opencode-ai/core/util/glob" import * as Log from "@opencode-ai/core/util/log" import { Discovery } from "./discovery" -import CUSTOMIZE_OPENCODE_SKILL_BODY from "../../../core/src/plugin/skill/customize-opencode.md" with { type: "text" } import { isRecord } from "@/util/record" const log = Log.create({ service: "skill" }) @@ -33,6 +32,9 @@ const SKILL_PATTERN = "**/SKILL.md" const CUSTOMIZE_OPENCODE_SKILL_NAME = "customize-opencode" const CUSTOMIZE_OPENCODE_SKILL_DESCRIPTION = "Use ONLY when the user is editing or creating opencode's own configuration: opencode.json, opencode.jsonc, files under .opencode/, or files under ~/.config/opencode/. Also use when creating or fixing opencode agents, subagents, skills, plugins, MCP servers, or permission rules. Do not use for the user's own application code, or for any project that is not configuring opencode itself." +const CUSTOMIZE_OPENCODE_SKILL_BODY = await Bun.file( + new URL("../../../core/src/plugin/skill/customize-opencode.md", import.meta.url), +).text() export const Info = Schema.Struct({ name: Schema.String,