feat(cli): implement compare as real side-by-side renderer#40
Open
abhinav-1504 wants to merge 4 commits into
Open
feat(cli): implement compare as real side-by-side renderer#40abhinav-1504 wants to merge 4 commits into
abhinav-1504 wants to merge 4 commits into
Conversation
|
First PR — welcome aboard! A few things to expect:
If you get stuck, reply here or jump to Discussions. We want this PR to land. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements
optiqor compare <a> <b>as a proper side-by-side rendererinstead of a diff alias.
Why
Fixes #14
How
internal/analyze/compare.go—ComparePaths()runs analysis onboth 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.go—WriteText()renders theside-by-side table;
WriteJSON()emits machine-readable output withaccuracy_disclosure; both honour the ±40% mandatory disclosure
internal/analyze/compare_test.go— 8 unit tests coveringpartitioning, winner logic, tie detection, text/JSON renderers, and
error paths
cmd/optiqor/main.go—newCompareCmd()wired toComparePathsinstead of aliasing diff;
diffunchangedTesting
go test ./internal/analyze/... -v— all PASSgo build ./...— cleanoptiqor compare a.yaml b.yaml→ side-by-side table with winneroptiqor compare a.yaml b.yaml --json→ valid JSON with accuracy_disclosureoptiqor compare --help→ correct usage shownoptiqor diffstill works unchangedChecklist