diff --git a/src/cli/overrides.ts b/src/cli/overrides.ts index 8d6c1ac..d071a16 100644 --- a/src/cli/overrides.ts +++ b/src/cli/overrides.ts @@ -5,7 +5,7 @@ import type { OverrideFinding } from "../overrides/index.js"; import { createAuditLog } from "../audit-log/index.js"; import type { AuditLogHandle } from "../audit-log/index.js"; import { EXIT_OK, EXIT_FINDINGS, EXIT_ERROR } from "../types.js"; -import { renderOverrideFindings } from "../output/formatters.js"; +import { renderOverrideFindings } from "../output/override-findings-terminal.js"; import type { Logger } from "../overrides/context.js"; interface RunArgs { diff --git a/src/index.ts b/src/index.ts index 9046083..7eb713d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -617,9 +617,13 @@ if (parsedArgs) { if (!(options.json || options.sarif || options.cdx) || options.verbose) { const offline = !!options.offline || !!options.offlineDb; if (options.verbose) { + const overrideCount = options.checkOverrides ? overrideFindings.length : 0; printSummary(scanState.sorted, packages.length, scanInput); - printActionSummary(scanState.sorted); - printSuggestedFixCommands(scanState.sorted, scanInput, { offline }); + const pmLabel = scanState.suggestedFixCommands + ? `${chalk.cyan(scanState.suggestedFixCommands.packageManager)} ${chalk.gray(`(${scanState.suggestedFixCommands.sourceLabel})`)}` + : undefined; + printActionSummary(scanState.sorted, overrideCount, pmLabel); + printSuggestedFixCommands(scanState.sorted, scanInput, { offline, overrideCount }); printSuggestedFixCommandSkips(scanState.sorted, scanInput, { offline }); if (scanInput.skippedDependencies.length > 0) { printSkippedDependencies(scanInput.skippedDependencies); @@ -634,16 +638,19 @@ if (parsedArgs) { logInfo(`No findings met the table threshold of ${scanState.minSeverity}. Re-run with --all to show everything.`, options); } } + if (options.checkOverrides && overrideFindings.length > 0) { + console.log(renderOverrideFindings(overrideFindings, { verbose: true })); + } printCoverage([...scanInput.notes, ...scanState.coverage]); - printFinalStatus(scanState.sorted); + printFinalStatus(scanState.sorted, overrideCount); } else { - printCompactOutput(scanState.sorted, scanInput, { offline, all: !!options.all }); - } - // Override hygiene section: --check-overrides collects these and threads - // them to JSON/SARIF/HTML; render them in the terminal too so the feature - // is visible in a plain scan, not only in machine output (#35). - if (options.checkOverrides) { - console.log(renderOverrideFindings(overrideFindings)); + const compactPmLabel = scanState.suggestedFixCommands + ? `${chalk.cyan(scanState.suggestedFixCommands.packageManager)} ${chalk.gray(`(${scanState.suggestedFixCommands.sourceLabel})`)}` + : undefined; + printCompactOutput(scanState.sorted, scanInput, { offline, all: !!options.all, packageManager: compactPmLabel }); + if (options.checkOverrides) { + console.log(renderOverrideFindings(overrideFindings, { verbose: false })); + } } } } diff --git a/src/output/formatters.ts b/src/output/formatters.ts index 1b3c502..3a67bb0 100644 --- a/src/output/formatters.ts +++ b/src/output/formatters.ts @@ -14,16 +14,6 @@ import { getPrimaryParent } from "../utils/finding.js"; import { calculatePathCoverage, formatDependencyPath } from "../utils/path-coverage.js"; import { pluralize } from "../utils/string.js"; -export function formatSeverityLabel(severity: string): string { - const lower = severity.toLowerCase(); - if (lower === "critical") return chalk.redBright(severity); - if (lower === "high") return chalk.red(severity); - if (lower === "medium") return chalk.yellow(severity); - if (lower === "low") return chalk.blueBright(severity); - if (lower === "unknown") return chalk.magenta(severity); - return severity; -} - export function formatRelationshipLabel(value: string): string { if (value.startsWith("direct")) return chalk.green(value); if (value.startsWith("transitive")) return chalk.yellow(value); @@ -349,4 +339,3 @@ export function countUniqueAdvisories(findings: Finding[]): number { return new Set(findings.flatMap(f => f.vulnerabilities.map(v => v.id))).size; } -export { renderOverrideFindings } from "./override-findings-terminal.js"; diff --git a/src/output/html-reporter.ts b/src/output/html-reporter.ts index 844b114..30b4167 100644 --- a/src/output/html-reporter.ts +++ b/src/output/html-reporter.ts @@ -206,13 +206,13 @@ button.header-link:hover{color:#58a6ff;border-color:#58a6ff} .override-hygiene table tbody tr{border-bottom:1px solid #21262d} .override-hygiene table tbody tr:last-child{border-bottom:none} .override-hygiene table tbody tr.severity-group{background:#1c2128} -.override-hygiene table tbody tr.severity-group th{font-weight:600;color:#e6edf3;padding:10px 14px} +.override-hygiene table tbody tr.severity-group th{font-weight:600;color:#e6edf3;padding:10px 14px;text-align:left} .override-hygiene table tbody tr.finding td{padding:11px 14px;font-size:12px;color:#e6edf3;vertical-align:middle} -.override-hygiene table tbody tr.finding.critical{border-left:3px solid #f85149} -.override-hygiene table tbody tr.finding.high{border-left:3px solid #fb8500} -.override-hygiene table tbody tr.finding.medium{border-left:3px solid #e3b341} -.override-hygiene table tbody tr.finding.low{border-left:3px solid #388bfd} -.override-hygiene table tbody tr.finding.info{border-left:3px solid #8b949e}`; +.override-hygiene table tbody tr.critical{border-left:3px solid #f85149} +.override-hygiene table tbody tr.high{border-left:3px solid #fb8500} +.override-hygiene table tbody tr.medium{border-left:3px solid #e3b341} +.override-hygiene table tbody tr.low{border-left:3px solid #388bfd} +.override-hygiene table tbody tr.unknown{border-left:3px solid #8b949e}`; export function renderHtmlReport(data: ReportData): string { @@ -330,10 +330,10 @@ ${findingRowsHtml} -${noticesHtml} - ${renderOverrideFindingsHtml(data.overrideFindings)} +${noticesHtml} +