import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import path from "node:path"; import { describe, it } from "vitest"; const root = path.resolve(import.meta.dirname, ".."); const packageJson = () => JSON.parse(readFileSync(path.join(root, "package.json"), "utf8")) as { pi?: { extensions?: string[]; prompts?: string[]; skills?: string[] }; "pi-ext"?: { resources?: string[] }; }; const repositoryPackage = () => JSON.parse( readFileSync(path.join(root, "../..", "package.json"), "utf8"), ) as { pi?: { extensions?: string[]; prompts?: string[]; skills?: string[] }; }; describe("the-system internal prompt model", () => { it("ships conditional System format skills without exporting them statically", () => { const extension = packageJson(); assert.deepEqual(extension.pi, { extensions: ["index.ts"] }); const resources = extension["pi-ext"]?.resources; assert.ok(resources?.includes("skills")); const repository = repositoryPackage(); assert.ok(!repository.pi?.skills?.includes("extensions/the-system/skills")); assert.ok( !repository.pi?.prompts?.includes("extensions/the-system/prompts"), ); for (const name of [ "vertical-slices", "the-system-documents", "the-system-markdown", "the-system-board", "the-system-exec", "the-system-gfm", "the-system-tex", "the-system-mermaid", ]) { const skill = readFileSync( path.join(root, "skills", name, "SKILL.md"), "utf8", ); assert.match(skill, new RegExp(`^name: ${name}$`, "m")); } }); });