/** * CheckExecutor — runs serializable IntegrationCheckDefinitions deterministically. * * Each check definition contains a strategy (pattern_presence, pattern_absence, * cross_reference, import_reachability, response_shape, conditional_presence, * file_reference, or ordering) that maps to a deterministic algorithm. * Zero LLM calls. Uses regex, file scanning, and import tracing. */ import type { IntegrationCheck, IntegrationCheckDefinition } from './types.js'; export declare class CheckExecutor { /** dir → whether the nearest package.json at/above it depends on next. */ private nextPkgCache; /** * Whether absFile belongs to a Next.js package: the nearest package.json * ancestor (within projectPath) lists `next` as a dependency. Returns true * when no package.json is found so single-app behavior is unchanged. * Keeps Next.js-only checks (e.g. 'use client' rules) from firing inside * sibling non-Next packages — an Expo Router app also has an app/ dir. */ private fileInNextPackage; /** Filter files to Next.js packages when the check applies only to nextjs. */ private scopeFilesToFrameworks; /** * Execute a single check definition against a project directory. * Returns one or more IntegrationCheck results. */ execute(definition: IntegrationCheckDefinition, projectPath: string): Promise; /** * Scan files matching fileGlob, assert regex pattern matches in at least one (or all). * Optionally conditioned on context files existing and containing a context pattern. */ private executePatternPresence; /** * Scan files, assert pattern does NOT match. * Optional allowIn list for files where the pattern is acceptable. */ private executePatternAbsence; /** * Extract matches from source files using sourcePattern, * then verify each match exists in target files via targetPattern. */ private executeCrossReference; /** * Find files matching pageGlob, verify each is transitively imported * from the file containing entryPattern. */ private executeImportReachability; /** * Cross-reference preload invoke handling against handler return shapes. * Detects the mismatch: handler wraps in { success, data } but preload * passes through without unwrapping .data. */ private executeResponseShape; /** * If a file contains conditionPattern, it must also contain requiredPattern. * Catches: 'use client' missing for hooks, Suspense missing for lazy(), etc. * * When requiredScope is 'project', the requiredPattern is checked across ALL * matching files — not per-file. This handles shared boundaries like a single * wrapping multiple lazy() imports from different files. */ private executeConditionalPresence; /** * Project-scoped conditional presence: if ANY file has conditionPattern, * then requiredPattern must exist in at least one file in the project. * Handles shared boundaries (e.g., one wrapping multiple lazy imports). */ private executeConditionalPresenceProjectScope; /** * Extract file paths from code via referencePattern, verify each exists on disk. * Catches: broken preload script paths, missing asset references, etc. */ private executeFileReference; /** * Verify that beforePattern appears before afterPattern in the same file. * Catches: auth middleware registered after route handlers, etc. */ private executeOrdering; /** * Build a map of IPC_CHANNELS constant references to their string values. * Scans shared/types files for patterns like: CONSTANT_NAME: 'channel:name' * Returns map: 'IPC_CHANNELS.CONSTANT_NAME' -> 'channel:name' */ private buildChannelConstantMap; private formatEvidence; }