// Quick workflow Markdown is the installed orchestration contract. 'use strict'; const { test, describe } = require('node:test'); const assert = require('node:assert/strict'); const path = require('node:path'); const { readFileNormalized } = require('./helpers.cjs'); const WORKFLOW_DIR = path.join(__dirname, '..', 'gsd-core', 'workflows'); const QUICK_PATH = path.join(WORKFLOW_DIR, 'quick.md'); const REVISION_PATH = path.join(WORKFLOW_DIR, 'quick', 'steps', 'plan-checker-loop.md'); function sliceBetween(content, startAnchor, endAnchor, label) { const start = content.indexOf(startAnchor); assert.notEqual(start, -1, `${label}: missing start anchor ${JSON.stringify(startAnchor)}`); const bodyStart = start + startAnchor.length; const end = content.indexOf(endAnchor, bodyStart); assert.notEqual(end, -1, `${label}: missing end anchor ${JSON.stringify(endAnchor)}`); assert.ok(end > bodyStart, `${label}: anchors must enclose non-empty text`); return content.slice(bodyStart, end); } function initialPlannerPrompt(quick) { const step = sliceBetween( quick, '**Step 5: Spawn planner (quick mode)**', ''); assert.notEqual(initialStep, -1, 'standard initial planner step must exist'); assert.ok(initialStep < revisionGate, 'initial planner must run before the optional revision gate'); assert.match(quick, /--full.*\$VALIDATE_MODE=true/, '--full must enable the validate path'); assert.match(quick, /--validate.*\$VALIDATE_MODE=true/, '--validate must enable the validate path'); assert.match(revision, /Revision loop \(max 2 iterations\)/, 'validate path must contain revision loop'); assert.equal((quick.match(/subagent_type="gsd-planner"/g) || []).length, 1); assert.equal((revision.match(/subagent_type="gsd-planner"/g) || []).length, 1); }); });