merge: integrate origin/dev (5th merge) — resolve @path skill references in split file structure
This commit is contained in:
@@ -3,6 +3,7 @@ import { join } from "path"
|
||||
import { parseFrontmatter } from "../../shared/frontmatter"
|
||||
import { resolveSymlink } from "../../shared/file-utils"
|
||||
import { sanitizeModelField } from "../../shared/model-sanitizer"
|
||||
import { resolveSkillPathReferences } from "../../shared/skill-path-resolver"
|
||||
import { log } from "../../shared/logger"
|
||||
import type { CommandDefinition } from "../claude-code-command-loader/types"
|
||||
import type { SkillMetadata } from "../opencode-skill-loader/types"
|
||||
@@ -37,7 +38,8 @@ export function loadPluginSkillsAsCommands(
|
||||
const originalDescription = data.description || ""
|
||||
const formattedDescription = `(plugin: ${plugin.name} - Skill) ${originalDescription}`
|
||||
|
||||
const wrappedTemplate = `<skill-instruction>\nBase directory for this skill: ${resolvedPath}/\nFile references (@path) in this skill are relative to this directory.\n\n${body.trim()}\n</skill-instruction>\n\n<user-request>\n$ARGUMENTS\n</user-request>`
|
||||
const resolvedBody = resolveSkillPathReferences(body.trim(), resolvedPath)
|
||||
const wrappedTemplate = `<skill-instruction>\nBase directory for this skill: ${resolvedPath}/\nFile references (@path) in this skill are relative to this directory.\n\n${resolvedBody}\n</skill-instruction>\n\n<user-request>\n$ARGUMENTS\n</user-request>`
|
||||
|
||||
const definition = {
|
||||
name: namespacedName,
|
||||
|
||||
@@ -5,6 +5,7 @@ import yaml from "js-yaml"
|
||||
import { parseFrontmatter } from "../../shared/frontmatter"
|
||||
import { sanitizeModelField } from "../../shared/model-sanitizer"
|
||||
import { resolveSymlink, isMarkdownFile } from "../../shared/file-utils"
|
||||
import { resolveSkillPathReferences } from "../../shared/skill-path-resolver"
|
||||
import type { CommandDefinition } from "../claude-code-command-loader/types"
|
||||
import type { SkillScope, SkillMetadata, LoadedSkill } from "./types"
|
||||
import type { SkillMcpConfig } from "../skill-mcp-manager/types"
|
||||
@@ -90,11 +91,12 @@ export async function loadSkillFromPathAsync(
|
||||
const isOpencodeSource = scope === "opencode" || scope === "opencode-project"
|
||||
const formattedDescription = `(${scope} - Skill) ${originalDescription}`
|
||||
|
||||
const resolvedBody = resolveSkillPathReferences(body.trim(), resolvedPath)
|
||||
const wrappedTemplate = `<skill-instruction>
|
||||
Base directory for this skill: ${resolvedPath}/
|
||||
File references (@path) in this skill are relative to this directory.
|
||||
|
||||
${body.trim()}
|
||||
${resolvedBody}
|
||||
</skill-instruction>
|
||||
|
||||
<user-request>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { promises as fs } from "fs"
|
||||
import { basename } from "path"
|
||||
import { parseFrontmatter } from "../../shared/frontmatter"
|
||||
import { sanitizeModelField } from "../../shared/model-sanitizer"
|
||||
import { resolveSkillPathReferences } from "../../shared/skill-path-resolver"
|
||||
import type { CommandDefinition } from "../claude-code-command-loader/types"
|
||||
import { parseAllowedTools } from "./allowed-tools-parser"
|
||||
import { loadMcpJsonFromDir, parseSkillMcpConfigFromFrontmatter } from "./skill-mcp-config"
|
||||
@@ -30,7 +31,8 @@ export async function loadSkillFromPath(options: {
|
||||
const isOpencodeSource = options.scope === "opencode" || options.scope === "opencode-project"
|
||||
const formattedDescription = `(${options.scope} - Skill) ${originalDescription}`
|
||||
|
||||
const templateContent = `<skill-instruction>\nBase directory for this skill: ${options.resolvedPath}/\nFile references (@path) in this skill are relative to this directory.\n\n${body.trim()}\n</skill-instruction>\n\n<user-request>\n$ARGUMENTS\n</user-request>`
|
||||
const resolvedBody = resolveSkillPathReferences(body.trim(), options.resolvedPath)
|
||||
const templateContent = `<skill-instruction>\nBase directory for this skill: ${options.resolvedPath}/\nFile references (@path) in this skill are relative to this directory.\n\n${resolvedBody}\n</skill-instruction>\n\n<user-request>\n$ARGUMENTS\n</user-request>`
|
||||
|
||||
const eagerLoader: LazyContentLoader = {
|
||||
loaded: true,
|
||||
|
||||
@@ -6,6 +6,7 @@ import { dirname, isAbsolute, resolve } from "path"
|
||||
import { homedir } from "os"
|
||||
import { parseFrontmatter } from "../../../shared/frontmatter"
|
||||
import { sanitizeModelField } from "../../../shared/model-sanitizer"
|
||||
import { resolveSkillPathReferences } from "../../../shared/skill-path-resolver"
|
||||
import { parseAllowedTools } from "../allowed-tools-parser"
|
||||
|
||||
function resolveFilePath(from: string, configDir?: string): string {
|
||||
@@ -66,11 +67,12 @@ export function configEntryToLoadedSkill(
|
||||
? dirname(resolveFilePath(entry.from, configDir))
|
||||
: configDir || process.cwd()
|
||||
|
||||
const resolvedTemplate = resolveSkillPathReferences(template.trim(), resolvedPath)
|
||||
const wrappedTemplate = `<skill-instruction>
|
||||
Base directory for this skill: ${resolvedPath}/
|
||||
File references (@path) in this skill are relative to this directory.
|
||||
|
||||
${template.trim()}
|
||||
${resolvedTemplate}
|
||||
</skill-instruction>
|
||||
|
||||
<user-request>
|
||||
|
||||
Reference in New Issue
Block a user