/**
 * load-preflight-context — read the framework-level package-surface
 * manifest and project it down to the rubric-side context shape.
 *
 * Returns `undefined` when the manifest is absent or empty so callers
 * collapse cleanly to the pre-W0198 rubric. Mirrors the convention of
 * `loadPackageSurface` and `loadPreflightScoring` — one loader per
 * lazily-read W0198 input, all in `pipeline/preflight/`.
 *
 * @see docs/design-docs/two-stage-grader-symbol-preflight.md — Phase 6
 */
import { loadPackageSurface } from "./load-package-surface.js";
export async function loadPreflightContext(rootDir, logger) {
    try {
        const manifest = await loadPackageSurface(rootDir);
        if (!manifest || manifest.packages.length === 0)
            return undefined;
        return { packages: manifest.packages.map((p) => p.pkg) };
    }
    catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        logger?.warn(`[warn] W0198 preflight: failed to load package-surface manifest — ${message}`);
        return undefined;
    }
}
