Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 7x 7x 7x 6x 6x 6x 7x 2x 4x 6x | /**
* @module scripts/agentic/gate-checks/scenario-analysis
* @description Check 7c — Validate scenario-analysis.md has ≥3 scenarios.
*
* @see .github/prompts/05-analysis-gate.md §Check 7 (scenario-analysis)
* @author Hack23 AB
* @license Apache-2.0
*/
import { readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import type { GateCheckResult } from '../gate-shared/types.js';
/**
* Check scenario-analysis.md for ≥3 distinct scenarios.
*/
export async function checkScenarioAnalysis(
analysisDir: string,
): Promise<GateCheckResult[]> {
const results: GateCheckResult[] = [];
const filePath = join(analysisDir, 'scenario-analysis.md');
if (!existsSync(filePath)) return results;
const content = await readFile(filePath, 'utf-8');
const scenarioMatches = content.match(/^##?\s+.*Scenario/gm);
const count = scenarioMatches ? scenarioMatches.length : 0;
if (count < 3) {
results.push({
checkId: 'family-c-structure',
passed: false,
message: `scenario-analysis.md: fewer than 3 scenarios (found ${count})`,
artifact: 'scenario-analysis.md',
});
} else {
results.push({
checkId: 'family-c-structure',
passed: true,
message: `scenario-analysis.md: ${count} scenarios found`,
artifact: 'scenario-analysis.md',
});
}
return results;
}
|