export type VersionChangeRequest = { groupId: string; artifactId: string; newVersion: string; }; export type AppliedChange = import('./updaters/maven_updater.js').MavenAppliedChange | import('./updaters/toml_updater.js').TomlAppliedChange; export type UpdaterResult = { content: string; applied: AppliedChange[]; skipped: Array<{ groupId: string; artifactId: string; newVersion: string; reason: string; }>; }; export type ManifestType = { test: (basename: string) => boolean; updater: (content: string, versionChanges: VersionChangeRequest[]) => UpdaterResult; label: ('maven' | 'toml'); changeKey: (manifestPath: string, applied: AppliedChange) => string; depsForEditSite: (content: string, manifestPath: string) => Map; }; export type DependencyFix = { path: string; after: string; changeKey: string; }; export type AppliedRemediation = import('./remediation.js').Remediation & { files: string[]; changes?: DependencyFix[]; }; /** * Resolves a target path to the supported manifest files it contains: the single file * if `targetPath` is a supported manifest, or every supported manifest discovered * recursively if it's a directory. This is the single source of truth for what * `runRemediation` will scan, so callers (e.g. the CLI) can reuse it to tell * "no manifests here" apart from "manifests, but nothing to fix". * @param {string} targetPath - path to a manifest file or directory * @returns {string[]} absolute paths to supported manifests (empty for an empty directory) * @throws if the path does not exist, or is a file of an unsupported manifest type */ export declare function findManifests(targetPath: string): string[]; export type RunRemediationOptions = { dryRun?: boolean; providers?: string; sources?: string; backendUrl?: string; perDependencyChanges?: boolean; exclude?: string[]; }; /** * Options accepted by {@link runRemediation}. See the per-field docs on the function for details. * @typedef {{ * dryRun?: boolean, * providers?: string, * sources?: string, * backendUrl?: string, * perDependencyChanges?: boolean, * exclude?: string[] * }} RunRemediationOptions */ /** * Orchestrates the full remediation pipeline for a single manifest or directory: * discover manifests → scan via DA backend → extract remediations → apply or preview. * * @param {string} targetPath - path to a manifest file or directory * @param {RunRemediationOptions} [options] * @param {boolean} [options.dryRun=false] - preview changes without modifying files (applies by default) * @param {string} [options.providers] - comma-separated provider list * @param {string} [options.sources] - comma-separated source list * @param {string} [options.backendUrl] - Trustify DA backend URL * @param {boolean} [options.perDependencyChanges=false] - when true, each remediation is populated with * a `changes` array describing the isolated, single-dependency edit (see {@link DependencyFix}). This lets * callers create one commit/PR per dependency without attributing diff hunks themselves. * @param {string[]} [options.exclude=[]] - version-less purl glob patterns, e.g. `pkg:maven/com.example/legacy-lib` * or `pkg:maven/com.example/*` to exclude a group. Matched with micromatch, so standard glob semantics apply: * `*` matches within a `/`-segment and `**` crosses segments (`pkg:maven/**` excludes the whole ecosystem). * Matching is against each remediation's canonical, version-less purl: the purl `type` is compared * case-insensitively and components are percent-decoded, so `pkg:npm/@scope/*` and `pkg:npm/%40scope/*` both * match `pkg:npm/@scope/x`. Matching remediations are filtered out before being applied or returned. Wired * from `.trustify-da.yml`'s `remediation.exclude` via the CLI `--exclude` flag. * @returns {Promise<{exitCode: number, remediations: AppliedRemediation[], manifests: string[], appliedFiles: string[], skipped: Array<{groupId: string, artifactId: string, newVersion: string, reason: string}>}>} * exitCode is 2 for a dry-run that found remediations (nothing written), 0 otherwise. `remediations` * is the structured, per-manifest list of applicable updates — each entry carries the originating * manifest path(s) in `files` so callers can group and create per-dependency changes. `appliedFiles` * lists only the manifests actually written to disk (empty on a dry-run), so callers can report a * truthful "updated N files" count without conflating "had remediations" with "was written". `skipped` * lists remediations that were dropped because they share a version edit site with an excluded dependency. */ export declare function runRemediation(targetPath: string, options?: RunRemediationOptions): Promise<{ exitCode: number; remediations: AppliedRemediation[]; manifests: string[]; appliedFiles: string[]; skipped: Array<{ groupId: string; artifactId: string; newVersion: string; reason: string; }>; }>;