Skip to content

feat(cli): implement compare as real side-by-side renderer#40

Open
abhinav-1504 wants to merge 4 commits into
optiqor:mainfrom
abhinav-1504:feat/compare-renderer
Open

feat(cli): implement compare as real side-by-side renderer#40
abhinav-1504 wants to merge 4 commits into
optiqor:mainfrom
abhinav-1504:feat/compare-renderer

Conversation

@abhinav-1504
Copy link
Copy Markdown

What

Implements optiqor compare <a> <b> as a proper side-by-side renderer
instead of a diff alias.

Why

Fixes #14

How

  • internal/analyze/compare.goComparePaths() runs analysis on
    both inputs, partitions findings into only-in-A, only-in-B, in-both
    (matched by workload+detectorID), computes cost totals, and declares
    a winner (lower cost wins; tie-break by fewer HIGH findings)
  • internal/analyze/compare_render.goWriteText() renders the
    side-by-side table; WriteJSON() emits machine-readable output with
    accuracy_disclosure; both honour the ±40% mandatory disclosure
  • internal/analyze/compare_test.go — 8 unit tests covering
    partitioning, winner logic, tie detection, text/JSON renderers, and
    error paths
  • cmd/optiqor/main.gonewCompareCmd() wired to ComparePaths
    instead of aliasing diff; diff unchanged

Testing

  • go test ./internal/analyze/... -v — all PASS
  • go build ./... — clean
  • Tested locally:
    • optiqor compare a.yaml b.yaml → side-by-side table with winner
    • optiqor compare a.yaml b.yaml --json → valid JSON with accuracy_disclosure
    • optiqor compare --help → correct usage shown
    • optiqor diff still works unchanged

Checklist

  • PR title follows Conventional Commits
  • All commits are DCO-signed
  • diff command unchanged — separate audience
  • No LLM calls or telemetry introduced
  • No proprietary backend imports

@abhinav-1504 abhinav-1504 requested a review from btwshivam as a code owner May 26, 2026 16:57
@github-actions
Copy link
Copy Markdown

First PR — welcome aboard!

A few things to expect:

  1. CI: every PR runs build + race tests + lint on Ubuntu and macOS. If something fails, the log will tell you exactly which gate.
  2. DCO: every commit needs Signed-off-by:. git commit -s adds it automatically.
  3. Conventional Commits: PR titles like feat(analyze): new rule or fix(cli): handle X. We squash-merge by default.
  4. Review: a maintainer will review within 72 hours. Suggestions are conversations, not orders — push back if something doesn't fit your context.

If you get stuck, reply here or jump to Discussions. We want this PR to land.

@github-actions github-actions Bot added testing Test coverage and golden fixtures area/cli Cobra CLI commands and UX area/analyze Helm chart analyzer size/XL 501+ lines (consider splitting) and removed testing Test coverage and golden fixtures area/cli Cobra CLI commands and UX area/analyze Helm chart analyzer labels May 26, 2026
@github-actions github-actions Bot added testing Test coverage and golden fixtures area/cli Cobra CLI commands and UX area/analyze Helm chart analyzer labels May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/analyze Helm chart analyzer area/cli Cobra CLI commands and UX size/XL 501+ lines (consider splitting) testing Test coverage and golden fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement compare as a real side-by-side renderer (not just diff alias)

1 participant