ktg-plugin-marketplace/plugins/ai-psychosis/tests/skill-md.test.mjs

30 lines
1.2 KiB
JavaScript

// Verifies SKILL.md stays aligned with the Constitution-mapping JSON
// produced by Step 0. Reads the locked grep target dynamically so the
// handoff between research and skill text is JSON-mediated, not hardcoded.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
test('SKILL.md contains Constitution-locked grep target', () => {
const mapping = JSON.parse(
readFileSync(
'.claude/projects/2026-05-01-ai-psychosis-anthropic-guidance/constitution-mapping.json',
'utf8'
)
);
const skill = readFileSync('skills/ai-psychosis/SKILL.md', 'utf8');
if (mapping.skill_md_grep_target === 'FALLBACK_PARAPHRASE') {
// Step 0 escalated; verify SKILL.md contains paraphrase + appendix citation
assert.ok(skill.includes('anthropic.com/research/claude-personal-guidance'));
} else {
assert.ok(
skill.includes(mapping.skill_md_grep_target),
`SKILL.md missing locked Constitution target: ${mapping.skill_md_grep_target}`
);
}
assert.ok(skill.includes('anthropic.com/constitution'));
assert.ok(skill.includes('anthropic.com/research/claude-personal-guidance'));
});