/**
 * Analyse-verify manifest — the registry of quality verifiers + the runner
 * that filters by `enabledByDefault` + an enable-override set, mirroring
 * `realize/post-emit-verify/verifier-manifest.ts`.
 */
import { STEP_TRANSCRIPTION_VERIFIER } from './verifiers/step-transcription.js';
import { EVENT_DISCIPLINE_VERIFIER } from './verifiers/event-discipline.js';
import { REQUIRE_EXISTENCE_VERIFIER } from './verifiers/require-existence.js';
export const ANALYSE_VERIFIERS = [
    STEP_TRANSCRIPTION_VERIFIER,
    EVENT_DISCIPLINE_VERIFIER,
    REQUIRE_EXISTENCE_VERIFIER,
    // Future (proposal Phase 3 remainder): ANL-REQUIRE-LIFECYCLE,
    //   ANL-STRUCT-FABRICATE / ANL-STRUCT-DROP.
];
/** Run all applicable + enabled verifiers, collecting their findings.
 *
 *  A verifier runs when: it is enabledByDefault (none are in v1) OR its id is
 *  in `enabledOverrides`, AND `applies(ctx)` is true. A verifier that throws is
 *  isolated (its error becomes a note) so one bad rule can't abort the pass. */
export function runAllAnalyseVerifiers(ctx, enabledOverrides) {
    const findings = [];
    const notes = [];
    for (const v of ANALYSE_VERIFIERS) {
        const enabledByDefault = v.enabledByDefault === true;
        const explicitlyEnabled = enabledOverrides?.has(v.id) ?? false;
        if (!enabledByDefault && !explicitlyEnabled)
            continue;
        if (!v.applies(ctx))
            continue;
        try {
            findings.push(...v.verify(ctx));
        }
        catch (err) {
            notes.push(`verifier "${v.id}" threw: ${err?.message ?? String(err)}`);
        }
    }
    return { findings, notes };
}
/** Parse the `SPECVERSE_ANALYSE_VERIFY_ENABLE` env into an override set.
 *  Comma-separated verifier ids; empty / unset → undefined (nothing enabled,
 *  since no verifier is enabledByDefault in v1). */
export function parseEnabledOverrides(env) {
    const csv = (env ?? '').trim();
    if (!csv)
        return undefined;
    const ids = csv.split(',').map((s) => s.trim()).filter(Boolean);
    return ids.length > 0 ? new Set(ids) : undefined;
}
//# sourceMappingURL=verifier-manifest.js.map