/** * Publishing anomaly detector (v4.2). * * Detects account-takeover signals and suspicious publishing patterns * by analyzing npm registry metadata: maintainer changes, version gaps, * script additions, and republish events. */ import type { Finding } from "./types.js"; interface NpmVersionMeta { version: string; publishedAt: string; maintainers: string[]; hasInstallScripts: boolean; tarballUrl: string; } /** * Analyze npm package publishing history for anomalies. * Requires pre-fetched version metadata (from npm registry API). */ export declare function analyzePublishingAnomalies(packageName: string, versions: NpmVersionMeta[]): Finding[]; /** * Pure comparison: returns a finding when the LOCAL source version is a whole * major (or more) behind the registry 'latest'. Same-major minor/patch lag and * source-ahead (unreleased dev) are intentionally NOT flagged - they are common * and benign, and flagging them would make the check noisy. */ export declare function evaluateVersionDrift(packageName: string, localVersion: string, registryLatest: string): Finding | null; /** * Fetch the 'latest' dist-tag for a package from the npm registry. * Resolves to null on any error/timeout/non-200 (never throws) so callers stay * offline-safe. Exposed for injection in tests. */ export declare function fetchNpmLatest(packageName: string): Promise; /** * Read the local package.json name+version and compare against the registry * 'latest'. The fetcher is injectable so unit tests never touch the network. * Returns [] (and never throws) when there is no package.json, no name/version, * or the registry is unreachable - preserving the offline-safe default. */ export declare function checkRegistryVersionDrift(projectDir: string, fetchLatest?: (name: string) => Promise): Promise; /** * Extract version metadata from npm registry response. * Expects the full package metadata from https://registry.npmjs.org/ */ export declare function extractVersionMeta(registryData: Record): NpmVersionMeta[]; export {}; //# sourceMappingURL=publishing-anomaly-detector.d.ts.map