// tests/commands/trekbrief.test.mjs // v5.1 — Pattern D prose-pattern regression tests for /trekbrief Phase 3.5. // // Brief SC1 + SC2: end-of-brief effort dialog covering 4 downstream phases, // with `phase_signals_partial` as the force-stop record. import { test } from 'node:test'; import { strict as assert } from 'node:assert'; import { readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; const HERE = dirname(fileURLToPath(import.meta.url)); const ROOT = join(HERE, '..', '..'); const COMMAND_FILE = join(ROOT, 'commands', 'trekbrief.md'); function read() { return readFileSync(COMMAND_FILE, 'utf8'); } test('trekbrief — Phase 3.5 heading is present', () => { const text = read(); assert.match(text, /^## Phase 3\.5 — Per-phase effort dialog$/m, 'Phase 3.5 heading missing from commands/trekbrief.md'); }); test('trekbrief — Phase 3.5 references all 4 downstream phases', () => { const text = read(); const startIdx = text.indexOf('## Phase 3.5'); assert.ok(startIdx >= 0, 'Phase 3.5 not found'); const section = text.slice(startIdx, text.indexOf('## Phase 4', startIdx)); for (const phase of ['research', 'plan', 'execute', 'review']) { assert.ok(section.includes(phase), `Phase 3.5 missing reference to "${phase}"`); } }); test('trekbrief — Phase 3.5 documents phase_signals_partial force-stop', () => { const text = read(); assert.ok(text.includes('phase_signals_partial'), 'phase_signals_partial not mentioned in /trekbrief command prose'); });