// Standing guard for Task 622 — no prescribed lead-capture role in any admin skill.
//
// SOUL.md is personality plus the role the operator defines at creation. The
// skill text must never re-prescribe a fixed Rubytech role (lead-capture /
// contact-form / "give basic public info"). This is a no-event failure mode:
// nothing logs when the prescribed role creeps back into the skill prose, so
// the reconciliation between expected state (no prescribed role) and actual
// file content lives here. A green run is the success signal; a match prints
// the offending `file:line` and fails the build.
import { describe, it, expect } from "vitest";
import { readdirSync, readFileSync } from "node:fs";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const SKILLS_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "skills");
// Case-insensitive. The exact phrases the operator confirmed as prescriptive
// and wrong (session ebff1750); see .tasks/archive/622-*.md.
const FORBIDDEN = [
    "capture the visitor's contact details",
    "landing-page contact form",
    "give basic public info",
];
function skillFiles(dir) {
    const out = [];
    for (const entry of readdirSync(dir, { withFileTypes: true })) {
        const full = join(dir, entry.name);
        if (entry.isDirectory())
            out.push(...skillFiles(full));
        else if (entry.name === "SKILL.md")
            out.push(full);
    }
    return out;
}
describe("admin skills carry no prescribed lead-capture role (Task 622)", () => {
    it("no SKILL.md contains a forbidden prescribed-role phrase", () => {
        const hits = [];
        for (const file of skillFiles(SKILLS_DIR)) {
            const lines = readFileSync(file, "utf8").split("\n");
            lines.forEach((line, i) => {
                const lower = line.toLowerCase();
                for (const phrase of FORBIDDEN) {
                    if (lower.includes(phrase.toLowerCase())) {
                        hits.push(`${file}:${i + 1} — ${phrase}`);
                    }
                }
            });
        }
        expect(hits, `prescribed-role phrasing found:\n${hits.join("\n")}`).toEqual([]);
    });
});
//# sourceMappingURL=skill-no-prescribed-role.test.js.map