#!/usr/bin/env node /** * LexMap Policy Checker * * Enforces architectural policy by checking scanner output against lexmap.policy.json. * * Usage: * lexmap check [--ticket WEB-23621] * * What it does: * 1. Loads merged scanner output (from lexmap merge) * 2. Loads policy file (lexmap.policy.json) * 3. For each file: * - Resolves file path → module_scope using owns_paths * - Checks imports against allowed_callers/forbidden_callers * - Detects kill_patterns in code * 4. Reports violations * * Exit codes: * 0 - No violations * 1 - Violations found * 2 - Error (file not found, schema invalid, etc.) * * Example: * lexmap check merged.json lexmap.policy.json --ticket WEB-23621 * * Output: * ❌ VIOLATION: ui/provider-endpoints/CreateEndpointModal.tsx * Module: ui/provider-endpoints * Imports: App\HIE\Surescripts\SurescriptsAdapter * Problem: UI modules MUST NOT import HIE adapters directly * Policy: forbidden_callers includes "ui/**" * Fix: Use api/provider-endpoints-service instead * * Author: LexMap * License: MIT */ export {};