Tags: EvilBit-Labs/opnDossier
Tags
feat(diff): add HTML formatter, side-by-side mode, analyzers, and sec… …urity scoring (#245) ## Summary - **Formatter interface**: Unified all formatters behind a shared `Formatter` interface with `New()` and `NewWithMode()` factory functions, replacing the switch statement in `outputDiffResult()` - **HTML formatter**: Self-contained HTML report output (`--format html`) using markdown-to-HTML conversion via goldmark, with embedded CSS, dark/light theme, collapsible sections, security badges, and print-friendly styles — fully offline, no CDN - **Side-by-side display mode**: Two-column terminal layout (`--mode side-by-side`) using `golang.org/x/term` for width detection, with automatic fallback to unified format on narrow terminals (<80 cols) - **Semantic analyzers**: New `internal/diff/analyzers/` package with IP normalization (handles leading-zero octets), whitespace/port/protocol/path normalization (`--normalize`), and rule reorder detection (`--detect-order`) - **Security impact scoring engine**: New `internal/diff/security/` package with pattern-based scoring (10 built-in patterns covering firewall, system, NAT, users, interfaces), aggregate risk summaries, and automatic augmentation of changes without existing security impact - **Golden snapshot tests**: Comprehensive goldie-based snapshot tests for HTML, Markdown, and JSON formatters with 3 scenarios each (no changes, single section, multi-section with security) - **CLI wiring**: New flags `--format html`, `--mode unified|side-by-side`, `--normalize`, `--detect-order` with validation, shell completions, and updated help text ### New packages - `internal/diff/formatters/` — `Formatter` interface, factory, HTML/side-by-side formatters - `internal/diff/analyzers/` — Normalizer, OrderDetector - `internal/diff/security/` — Scorer, Patterns, RiskSummary ### Stats - 35 files changed, +2863 / -157 lines - 9 golden snapshot files for formatter regression testing - 0 lint issues, all tests pass ## Test Plan - [x] `just ci-check` passes (lint + all tests) - [x] Golden snapshot tests for HTML, Markdown, and JSON formatters - [ ] Manual: `opndossier diff old.xml new.xml -f html -o report.html` produces valid self-contained HTML - [ ] Manual: `opndossier diff old.xml new.xml -m side-by-side` renders two-column layout - [ ] Manual: `opndossier diff old.xml new.xml --normalize --detect-order` reduces noise - [ ] Manual: Security badges appear in all output formats (terminal, markdown, json, html) - [ ] Verify narrow terminal (<80 cols) falls back to unified mode 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
chore: update CI configuration and enable GitHub checks - Enabled GitHub checks in .coderabbit.yaml to enhance review process. - Simplified Go version specification in ci-check.yml by setting it to stable, removing the matrix strategy for Go versions. Tested with `just test` and `just ci-check`, all checks passed successfully.