import { describe, it } from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import { fileURLToPath } from 'node:url'; const ROOT = fileURLToPath(new URL('..', import.meta.url)); describe('skill reference authoring contracts', () => { it('keeps direction contracts in development-only surface briefs', () => { const newWork = readFileSync(join(ROOT, 'skill/reference/new-work.md'), 'utf-8').replace(/\r\n?/g, '\n'); const recordDecision = newWork.match(/## 5\. Record the decision\n([\s\S]*?)\n## 6\./)?.[1] ?? ''; assert.match(recordDecision, /development-only contract/); assert.match(recordDecision, /under `## Direction contract` in the relevant surface brief/); assert.match(recordDecision, /read the brief once more/i); assert.match(recordDecision, /all six contract blocks and the seed key/); for (const block of ['THESIS', 'OWN-WORLD', 'STORY', 'FIRST VIEWPORT', 'FORM', 'FINISH']) { assert.match(recordDecision, new RegExp(`${block}:`)); } for (const browserArtifact of [ /HTML or framework comments/, /hidden DOM/, /