import { Finding } from '../types.js'; import { OsvAdvisory } from './osv.js'; import { DepCheckResult, DependencyRef, RemoteDepSpec } from './types.js'; export declare const DEP_RULES: readonly [{ readonly id: "AG-DP-001"; readonly description: "Dependency does not exist on the registry (likely AI-hallucinated / slopsquatting target)"; }, { readonly id: "AG-DP-002"; readonly description: "Dependency name is one edit away from a popular package (possible typosquat)"; }, { readonly id: "AG-DP-003"; readonly description: "Dependency is a young package with near-zero downloads"; }, { readonly id: "AG-DP-004"; readonly description: "npm dependency runs install scripts (preinstall/install/postinstall)"; }, { readonly id: "AG-DP-005"; readonly description: "Dependency has weak registry metadata (no repository/license/description, single version)"; }, { readonly id: "AG-DP-006"; readonly description: "Dependency is a known-malicious package (OSV.dev MAL advisory)"; }, { readonly id: "AG-DP-007"; readonly description: "Dependency is fetched from a mutable remote source (unpinned git ref or non-registry archive URL)"; }]; /** Damerau-Levenshtein distance (optimal string alignment), capped early for speed. */ export declare function editDistance(a: string, b: string, max?: number): number; /** Find a popular package the name is within one edit of (and is not itself). */ export declare function findTyposquatTarget(ref: DependencyRef): string | undefined; /** Turn a registry check result into zero or more findings. */ export declare function scoreDependency(result: DepCheckResult): Finding[]; export declare function scoreDependencies(results: DepCheckResult[]): Finding[]; /** * Turn OSV MAL advisories into findings (one per advisory). Version-scoped * advisories (compromised releases of otherwise-legitimate packages, e.g. the * 2025 `debug`/`chalk` incident) are compared against the resolved version when * `resolveVersion` can determine it (e.g. from node_modules). */ export declare function scoreAdvisories(advisories: OsvAdvisory[], resolveVersion?: (ref: DependencyRef) => string | undefined): Finding[]; /** * Flag dependencies whose specifier fetches mutable remote content: a git * ref that is not a full commit SHA (branches and tags can be moved), or an * archive URL outside the registries' version-addressed tarball hosts (the * artifact behind the URL can be swapped in place, with no registry metadata * or provenance). Needs no network, so it runs in offline mode too. */ export declare function scoreRemoteSpecs(specs: RemoteDepSpec[]): Finding[]; /** Offline mode: only name-shape checks (typosquat similarity), no registry data. */ export declare function scoreOffline(refs: DependencyRef[]): Finding[];