fix(skill): emit base directory as filesystem path, not file:// URL (#33580)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
parent
947e0017f5
commit
246d40db73
@ -1,7 +1,6 @@
|
||||
export * as SkillTool from "./skill"
|
||||
|
||||
import path from "path"
|
||||
import { pathToFileURL } from "url"
|
||||
import { ToolFailure } from "@opencode-ai/llm"
|
||||
import { Effect, Layer, Schema } from "effect"
|
||||
import { FSUtil } from "../fs-util"
|
||||
@ -39,7 +38,7 @@ export const toModelOutput = (skill: SkillV2.Info, files: ReadonlyArray<string>)
|
||||
"",
|
||||
skill.content.trim(),
|
||||
"",
|
||||
`Base directory for this skill: ${pathToFileURL(directory).href}`,
|
||||
`Base directory for this skill: ${directory}`,
|
||||
"Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
|
||||
"Note: file list is sampled.",
|
||||
"",
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { pathToFileURL } from "url"
|
||||
import { describe, expect } from "bun:test"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { FSUtil } from "@opencode-ai/core/fs-util"
|
||||
@ -90,7 +89,7 @@ describe("SkillTool", () => {
|
||||
value: SkillTool.toModelOutput(info, [reference]),
|
||||
})
|
||||
expect(SkillTool.toModelOutput(info, [reference])).toContain(
|
||||
`Base directory for this skill: ${pathToFileURL(directory).href}`,
|
||||
`Base directory for this skill: ${directory}`,
|
||||
)
|
||||
expect(
|
||||
yield* settleTool(registry, {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import path from "path"
|
||||
import { pathToFileURL } from "url"
|
||||
import { Effect, Schema } from "effect"
|
||||
import { Ripgrep } from "@opencode-ai/core/ripgrep"
|
||||
import { Skill } from "../skill"
|
||||
@ -33,7 +32,7 @@ export const SkillTool = Tool.define(
|
||||
})
|
||||
|
||||
const dir = path.dirname(info.location)
|
||||
const base = pathToFileURL(dir).href
|
||||
const base = dir
|
||||
const files = yield* ripgrep.find({
|
||||
cwd: dir,
|
||||
pattern: "!**/SKILL.md",
|
||||
|
||||
@ -4,7 +4,6 @@ import { Ripgrep } from "@opencode-ai/core/ripgrep"
|
||||
import { Cause, Effect, Exit, Layer } from "effect"
|
||||
import { afterEach, describe, expect } from "bun:test"
|
||||
import path from "path"
|
||||
import { pathToFileURL } from "url"
|
||||
import type { Permission } from "../../src/permission"
|
||||
import type { Tool } from "@/tool/tool"
|
||||
import { SkillTool } from "../../src/tool/skill"
|
||||
@ -90,7 +89,7 @@ Use this skill.
|
||||
expect(requests[0].always).toContain("tool-skill")
|
||||
expect(result.metadata.dir).toBe(skill)
|
||||
expect(result.output).toContain(`<skill_content name="tool-skill">`)
|
||||
expect(result.output).toContain(`Base directory for this skill: ${pathToFileURL(skill).href}`)
|
||||
expect(result.output).toContain(`Base directory for this skill: ${skill}`)
|
||||
expect(result.output).toContain(`<file>${file}</file>`)
|
||||
}),
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user