//#region src/native-audit.d.ts /** * native-audit — project-level scan for multiplatform (PMTC) build hazards. * Consumed by `pyreon doctor --check-native` (the `native-audit` gate) and * exported for the MCP surface. Mirrors `auditSsg` / `auditIslands`: pure * syntactic TS-compiler-API scan, no type-check pass. * * Scope: a file is audited ONLY if it imports `@pyreon/primitives` — the * signal that it's a multiplatform component compiled by PMTC to SwiftUI / * Compose. (A web-only file that never targets native isn't a concern.) * In those files it flags two high-confidence native-build hazards the * `swiftc -parse` / `kotlinc`-stub gate can't catch at build time: * * - **`web-only-package-import`** — importing a package that can NOT be * native-rendered (`@pyreon/charts`/`flow`/`code`/`dnd`/`document`/`query`/ * `table`/`virtual` + the web CSS-in-JS UI stack `elements`/`styler`/ * `rocketstyle`/`coolgrid`/`kinetic`/`ui-components`). On native these * silently drop / fail to emit. Fix: host the component in a `` * (charts/flow/editor) or use `@pyreon/primitives` (UI). * - **`native-unsupported-decl`** — a top-level `interface` / TS `enum` / * `class` declaration. PMTC silently DROPS these (the emit references an * undefined symbol on the real device build). Fix: `type X = { … }` / * `type X = 'a' | 'b'` / functions + signals. * * See `get_pattern({ name: 'multiplatform' })` for the full supported subset. * * Lives in `@pyreon/native-compiler` (served as `@pyreon/native-compiler/audit`) * rather than the web compiler: it is the native story, and it reads the SAME * `WEB_ONLY_PACKAGES` the parser's import warning does. Parsing is oxc (what * PMTC itself parses with), so the audit agrees with the compiler it audits * about what is parseable -- and a file PMTC cannot parse is skipped here too, * where the previous TypeScript-API parser recovered from syntax errors. */ type NativeFindingCode = 'web-only-package-import' | 'native-unsupported-decl'; interface NativeLocation { path: string; relPath: string; line: number; column: number; } interface NativeFinding { code: NativeFindingCode; message: string; location: NativeLocation; } interface NativeAuditResult { root: string | null; findings: NativeFinding[]; summary: { filesScanned: number; multiplatformFiles: number; findingsByCode: Record; }; } /** * Audit a project directory for multiplatform native-build hazards. Scans * `` recursively for `.tsx` files that import `@pyreon/primitives`. */ export declare function auditNative(cwd: string): NativeAuditResult; interface NativePatternDiagnostic { code: 'native-web-only-import' | 'native-unsupported-decl'; message: string; /** 1-based line */ line: number; /** 0-based column (matches detectPyreonPatterns) */ column: number; current: string; suggested: string; fixable: boolean; } /** * Snippet-level multiplatform-hazard detector for the MCP `validate` tool — * the per-keystroke feedback loop complementing the project-level * `auditNative` / `pyreon doctor --check-native`. Same two detectors, same * scoping: only fires when the snippet imports `@pyreon/primitives` (i.e. it's * a multiplatform component PMTC compiles to native), so a pure-web snippet * never false-positives. Returns the `detectPyreonPatterns`-compatible * diagnostic shape so the validate handler merges all three detector sets. */ export declare function detectNativePatterns(code: string, filename?: string): NativePatternDiagnostic[]; //#endregion export type { NativeAuditResult, NativeFinding, NativeFindingCode, NativeLocation, NativePatternDiagnostic };