import { ActionUpdate } from '../types/action-update'; import { UpdateStyle } from '../types/update-style'; import { ScanResult } from '../types/scan-result'; import { UpdateMode } from '../types/update-mode'; /** * High-level status of a JSON report. */ export type JsonReportStatus = 'updates-available' | 'no-actions-found' | 'nothing-to-check' | 'up-to-date'; /** * Options used to build a JSON report from the current CLI state. */ interface BuildJsonReportOptions { /** * Updates excluded by the selected update mode. */ blockedByMode: ActionUpdate[]; /** * Number of actions that were actually checked after excludes. */ actionsToCheckCount: number; /** * Regex patterns supplied through `--exclude`. */ excludePatterns: string[]; /** * Whether branch references were included in update checks. */ includeBranches: boolean; /** * Updates that remain actionable after all filters. */ outdated: ActionUpdate[]; /** * Final report status. */ status: JsonReportStatus; /** * Updates skipped during processing, such as branch references. */ skipped: ActionUpdate[]; /** * Aggregate scan result for the current run. */ scanResult: ScanResult; /** * Directories resolved for scanning. */ directories: string[]; /** * Whether recursive scanning mode is enabled. */ recursive: boolean; /** * Effective update style for the run. */ style: UpdateStyle; /** * Effective update mode for the run. */ mode: UpdateMode; /** * Minimum age filter in days. */ minAge: number; /** * Working directory used for relative path normalization. */ cwd?: string; } /** * Serialized update entry in the JSON report. */ interface JsonReportUpdate { /** * Style of the final reference. */ targetRefStyle: NonNullable | null; /** * Detected style of the current reference in the source file. */ currentRefType: ActionUpdate['currentRefType'] | null; /** * Reason why this entry was skipped, if any. */ skipReason: ActionUpdate['skipReason'] | null; /** * Processing status for this entry. */ status: NonNullable; /** * Version currently used in the workflow or action file. */ currentVersion: string | null; /** * Latest version found for this dependency. */ latestVersion: string | null; /** * Release publication date in ISO format. */ publishedAt: string | null; /** * Original action reference metadata. */ action: JsonReportAction; /** * Resolved SHA for the target version. */ latestSha: string | null; /** * Final reference that would be written back to the file. */ targetRef: string | null; /** * Whether this update crosses a major version boundary. */ isBreaking: boolean; /** * Whether an update is available for this entry. */ hasUpdate: boolean; } /** * Aggregate counts included in the JSON report. */ interface JsonReportSummary { /** * Number of composite actions discovered during scanning. */ totalCompositeActions: number; /** * Number of breaking updates among actionable updates. */ totalBreakingUpdates: number; /** * Number of actions checked after excludes. */ totalActionsChecked: number; /** * Number of updates filtered out by `--mode`. */ totalBlockedByMode: number; /** * Number of workflows discovered during scanning. */ totalWorkflows: number; /** * Total number of action references found during scanning. */ totalActions: number; /** * Number of skipped entries in the report. */ totalSkipped: number; /** * Number of actionable updates in the report. */ totalUpdates: number; } /** * Effective CLI options serialized into the report. */ interface JsonReportOptions { /** * Regex patterns supplied through `--exclude`. */ excludePatterns: string[]; /** * Whether branch references were checked. */ includeBranches: boolean; /** * Resolved scan directories. */ directories: string[]; /** * Whether recursive scanning mode is enabled. */ recursive: boolean; /** * Effective update style. */ style: UpdateStyle; /** * Effective update mode. */ mode: UpdateMode; /** * Indicates that JSON mode never applies changes. */ reportOnly: true; /** * Minimum age filter in days. */ minAge: number; /** * Indicates that this payload came from `--json`. */ json: true; } /** * Serialized action reference included in each update entry. */ interface JsonReportAction { /** * Action reference type detected during scanning. */ type: ActionUpdate['action']['type']; /** * Original version or ref from the file, if available. */ version: string | null; /** * Relative or absolute file path for the action reference. */ file: string | null; /** * Line number of the action reference. */ line: number | null; /** * Original `uses` value, if available. */ uses: string | null; /** * Workflow job name, when applicable. */ job: string | null; /** * Full `owner/repo@ref` string, when available. */ ref: string | null; /** * Normalized action name. */ name: string; } /** * Top-level machine-readable report emitted by `--json`. */ interface JsonReport { /** * Entries filtered out by the selected update mode. */ blockedByMode: JsonReportUpdate[]; /** * Entries skipped during update checks. */ skipped: JsonReportUpdate[]; /** * Actionable updates after filtering. */ updates: JsonReportUpdate[]; /** * Effective options that shaped the report. */ options: JsonReportOptions; /** * Aggregate counts for the current run. */ summary: JsonReportSummary; /** * Overall outcome for the current run. */ status: JsonReportStatus; /** * Version of the JSON payload schema. */ schemaVersion: 1; } /** * Build the machine-readable JSON report returned by `--json`. * * @param options - Current CLI state and computed update data. * @returns Serializable JSON payload for stdout. */ export declare function buildJsonReport(options: BuildJsonReportOptions): JsonReport; export {};