14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/equilibrium/summary_formatter.rb', line 14
def print_analysis_summary(analysis)
say "Repository URL: #{analysis[:repository_url]}"
say ""
status_color = (analysis[:status] == "perfect") ? :green : :yellow
status_symbol = (analysis[:status] == "perfect") ? "✓" : "⚠"
overview_data = [
["Metric", "Count"],
["Expected tags", analysis[:expected_count].to_s],
["Actual tags", analysis[:actual_count].to_s],
["Missing tags", analysis[:missing_tags].size.to_s],
["Mismatched tags", analysis[:mismatched_tags].size.to_s],
["Unexpected tags", analysis[:unexpected_tags].size.to_s]
]
say "Analysis Overview:"
print_table(overview_data, borders: true)
say ""
say "#{status_symbol} Status: #{analysis[:status].upcase.tr("_", " ")}", status_color
say ""
has_issues = false
if analysis[:missing_tags].any?
has_issues = true
say "Missing Tags (should be created):"
missing_table = [["Tag", "Should Point To"]]
analysis[:missing_tags].each do |tag, details|
full_digest = details[:expected] || "unknown"
missing_table << [tag, full_digest]
end
print_table(missing_table, borders: true)
say ""
end
if analysis[:mismatched_tags].any?
has_issues = true
say "Mismatched Tags (pointing to wrong version):"
mismatched_table = [["Tag", "Expected", "Actual"]]
analysis[:mismatched_tags].each do |tag, details|
if details.is_a?(Hash)
expected = details[:expected] || "unknown"
actual = details[:actual] || "unknown"
else
expected = details || "unknown"
actual = "unknown"
end
mismatched_table << [tag, expected, actual]
end
print_table(mismatched_table, borders: true)
say ""
end
if analysis[:unexpected_tags].any?
has_issues = true
say "Unexpected Tags (should be removed):"
unexpected_table = [["Tag", "Currently Points To"]]
analysis[:unexpected_tags].each do |tag, details|
full_digest = details[:actual] || "unknown"
unexpected_table << [tag, full_digest]
end
print_table(unexpected_table, borders: true)
say ""
end
if has_issues
say "To see detailed analysis data, use:"
say " equilibrium analyze --expected expected.json --actual actual.json --format=json"
else
say "✓ Registry is in perfect equilibrium!", :green
end
end
|