Skip to content

Commit 246d40d

Browse files
shyuanrekram1-node
andauthored
fix(skill): emit base directory as filesystem path, not file:// URL (#33580)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
1 parent 947e001 commit 246d40d

4 files changed

Lines changed: 4 additions & 8 deletions

File tree

packages/core/src/tool/skill.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export * as SkillTool from "./skill"
22

33
import path from "path"
4-
import { pathToFileURL } from "url"
54
import { ToolFailure } from "@opencode-ai/llm"
65
import { Effect, Layer, Schema } from "effect"
76
import { FSUtil } from "../fs-util"
@@ -39,7 +38,7 @@ export const toModelOutput = (skill: SkillV2.Info, files: ReadonlyArray<string>)
3938
"",
4039
skill.content.trim(),
4140
"",
42-
`Base directory for this skill: ${pathToFileURL(directory).href}`,
41+
`Base directory for this skill: ${directory}`,
4342
"Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
4443
"Note: file list is sampled.",
4544
"",

packages/core/test/tool-skill.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from "fs/promises"
22
import path from "path"
3-
import { pathToFileURL } from "url"
43
import { describe, expect } from "bun:test"
54
import { Effect, Layer } from "effect"
65
import { FSUtil } from "@opencode-ai/core/fs-util"
@@ -90,7 +89,7 @@ describe("SkillTool", () => {
9089
value: SkillTool.toModelOutput(info, [reference]),
9190
})
9291
expect(SkillTool.toModelOutput(info, [reference])).toContain(
93-
`Base directory for this skill: ${pathToFileURL(directory).href}`,
92+
`Base directory for this skill: ${directory}`,
9493
)
9594
expect(
9695
yield* settleTool(registry, {

packages/opencode/src/tool/skill.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from "path"
2-
import { pathToFileURL } from "url"
32
import { Effect, Schema } from "effect"
43
import { Ripgrep } from "@opencode-ai/core/ripgrep"
54
import { Skill } from "../skill"
@@ -33,7 +32,7 @@ export const SkillTool = Tool.define(
3332
})
3433

3534
const dir = path.dirname(info.location)
36-
const base = pathToFileURL(dir).href
35+
const base = dir
3736
const files = yield* ripgrep.find({
3837
cwd: dir,
3938
pattern: "!**/SKILL.md",

packages/opencode/test/tool/skill.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Ripgrep } from "@opencode-ai/core/ripgrep"
44
import { Cause, Effect, Exit, Layer } from "effect"
55
import { afterEach, describe, expect } from "bun:test"
66
import path from "path"
7-
import { pathToFileURL } from "url"
87
import type { Permission } from "../../src/permission"
98
import type { Tool } from "@/tool/tool"
109
import { SkillTool } from "../../src/tool/skill"
@@ -90,7 +89,7 @@ Use this skill.
9089
expect(requests[0].always).toContain("tool-skill")
9190
expect(result.metadata.dir).toBe(skill)
9291
expect(result.output).toContain(`<skill_content name="tool-skill">`)
93-
expect(result.output).toContain(`Base directory for this skill: ${pathToFileURL(skill).href}`)
92+
expect(result.output).toContain(`Base directory for this skill: ${skill}`)
9493
expect(result.output).toContain(`<file>${file}</file>`)
9594
}),
9695
)

0 commit comments

Comments
 (0)