diff --git a/src/expand.ts b/src/expand.ts index d4109fc..c620a3d 100644 --- a/src/expand.ts +++ b/src/expand.ts @@ -1,8 +1,20 @@ import { readFileSync } from "node:fs"; import { stripFrontmatter } from "@earendil-works/pi-coding-agent"; +/** Skill fields needed to build the injected block (SPEC §5.3). */ +export type SkillBlockMeta = { + name: string; + filePath: string; + baseDir: string; +}; + /** mirror agent-session `_expandSkillCommand` — SKILL.md body without YAML frontmatter (SPEC §5.3, §10). */ export function readSkillBody(filePath: string): string { const content = readFileSync(filePath, "utf-8"); return stripFrontmatter(content).trim(); } + +/** mirror agent-session `_expandSkillCommand` — XML skill block with baseDir hint (SPEC §5.3). */ +export function formatBlock(meta: SkillBlockMeta, body: string): string { + return `\nReferences are relative to ${meta.baseDir}.\n\n${body}\n`; +}