Skip to content

Commit 8a38784

Browse files
Thomas StrombergThomas Stromberg
authored andcommitted
Improve pro-tip output
1 parent 0268a35 commit 8a38784

File tree

5 files changed

+17
-22
lines changed

5 files changed

+17
-22
lines changed

cmd/prcost/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,12 @@ func printMergeTimeModelingCallout(breakdown *cost.Breakdown, cfg cost.Config) {
595595
fmt.Println(" ┌─────────────────────────────────────────────────────────────┐")
596596
fmt.Printf(" │ %-60s│\n", "MERGE TIME MODELING")
597597
fmt.Println(" └─────────────────────────────────────────────────────────────┘")
598-
fmt.Printf(" If you lowered your average merge time to %s, you would save\n", formatTimeUnit(targetHours))
599-
fmt.Printf(" ~$%s/yr in engineering overhead", formatWithCommas(annualSavings))
600598
if efficiencyDelta > 0 {
601-
fmt.Printf(" (+%.1f%% throughput).\n", efficiencyDelta)
599+
fmt.Printf(" Reduce merge time to %s to boost team throughput by %.1f%%\n", formatTimeUnit(targetHours), efficiencyDelta)
600+
fmt.Printf(" and save ~$%s/yr in engineering overhead.\n", formatWithCommas(annualSavings))
602601
} else {
603-
fmt.Println(".")
602+
fmt.Printf(" If you lowered your average merge time to %s, you would save\n", formatTimeUnit(targetHours))
603+
fmt.Printf(" ~$%s/yr in engineering overhead.\n", formatWithCommas(annualSavings))
604604
}
605605
fmt.Println()
606606
}

cmd/prcost/repository.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,12 @@ func printExtrapolatedMergeTimeModelingCallout(ext *cost.ExtrapolatedBreakdown,
738738
fmt.Println(" ┌─────────────────────────────────────────────────────────────┐")
739739
fmt.Printf(" │ %-60s│\n", "MERGE TIME MODELING")
740740
fmt.Println(" └─────────────────────────────────────────────────────────────┘")
741-
fmt.Printf(" If you lowered your average merge time to %s, you would save\n", formatTimeUnit(targetHours))
742-
fmt.Printf(" ~$%s/yr in engineering overhead", formatWithCommas(annualSavings))
743741
if efficiencyDelta > 0 {
744-
fmt.Printf(" (+%.1f%% throughput).\n", efficiencyDelta)
742+
fmt.Printf(" Reduce merge time to %s to boost team throughput by %.1f%%\n", formatTimeUnit(targetHours), efficiencyDelta)
743+
fmt.Printf(" and save ~$%s/yr in engineering overhead.\n", formatWithCommas(annualSavings))
745744
} else {
746-
fmt.Println(".")
745+
fmt.Printf(" If you lowered your average merge time to %s, you would save\n", formatTimeUnit(targetHours))
746+
fmt.Printf(" ~$%s/yr in engineering overhead.\n", formatWithCommas(annualSavings))
747747
}
748748
fmt.Println()
749749
}

internal/server/static/formatR2RCallout.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ function formatR2RCallout(avgOpenHours, r2rSavings, currentEfficiency, modeledEf
1616
}
1717

1818
const efficiencyDelta = modeledEfficiency - currentEfficiency;
19-
let throughputText = '';
20-
if (efficiencyDelta > 0) {
21-
throughputText = ' (+' + efficiencyDelta.toFixed(1) + '% throughput)';
22-
}
2319

2420
// Format target merge time
2521
let targetText = targetMergeHours.toFixed(1) + 'h';
2622

27-
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 14px; color: #1d1d1f; line-height: 1.6;">';
28-
html += 'Pro-Tip: Save <strong>' + savingsText + '/yr</strong> in lost development effort by reducing merge times to &lt;' + targetText + ' with ';
23+
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 16px; color: #1d1d1f; line-height: 1.6;">';
24+
html += '💡 <strong>Pro-Tip:</strong> Boost team throughput by <strong>' + efficiencyDelta.toFixed(1) + '%</strong> and save <strong>' + savingsText + '/yr</strong> by reducing merge times to &lt;' + targetText + ' with ';
2925
html += '<a href="https://codegroove.dev/products/ready-to-review/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready to Review</a>. ';
3026
html += 'Free for open-source repositories, $6/user/org for private repos.';
3127
html += '</div>';

internal/server/static/formatR2RCallout.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ test('Renders callout for PRs with avgOpenHours > 1.5 (default)', () => {
3232
assert(result.length > 0, 'Should return non-empty HTML');
3333
});
3434

35-
// Test 3: Should contain "Pro-Tip:" text
36-
test('Contains "Pro-Tip:" text', () => {
35+
// Test 3: Should contain "Pro-Tip:" text and throughput boost
36+
test('Contains "Pro-Tip:" text and throughput boost', () => {
3737
const result = formatR2RCallout(10, 50000, 60, 70);
38+
assert(result.includes('💡'), 'Should contain lightbulb emoji');
3839
assert(result.includes('Pro-Tip:'), 'Should contain "Pro-Tip:"');
40+
assert(result.includes('Boost team throughput by'), 'Should contain throughput boost message');
41+
assert(result.includes('10.0%'), 'Should show efficiency delta of 10% (70 - 60)');
3942
});
4043

4144
// Test 4: Should contain "Ready to Review" link

internal/server/static/index.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,16 +1469,12 @@ <h3>Why calculate PR costs?</h3>
14691469
}
14701470

14711471
const efficiencyDelta = modeledEfficiency - currentEfficiency;
1472-
let throughputText = '';
1473-
if (efficiencyDelta > 0) {
1474-
throughputText = ' (+' + efficiencyDelta.toFixed(1) + '% throughput)';
1475-
}
14761472

14771473
// Format target merge time
14781474
let targetText = targetMergeHours.toFixed(1) + 'h';
14791475

1480-
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 14px; color: #1d1d1f; line-height: 1.6;">';
1481-
html += 'Pro-Tip: Save <strong>' + savingsText + '/yr</strong> in lost development effort by reducing merge times to &lt;' + targetText + ' with ';
1476+
let html = '<div style="margin: 24px 0; padding: 12px 20px; background: linear-gradient(135deg, #e6f9f0 0%, #ffffff 100%); border: 1px solid #00c853; border-radius: 8px; font-size: 16px; color: #1d1d1f; line-height: 1.6;">';
1477+
html += '💡 <strong>Pro-Tip:</strong> Boost team throughput by <strong>' + efficiencyDelta.toFixed(1) + '%</strong> and save <strong>' + savingsText + '/yr</strong> by reducing merge times to &lt;' + targetText + ' with ';
14821478
html += '<a href="https://codegroove.dev/products/ready-to-review/" target="_blank" rel="noopener" style="color: #00c853; font-weight: 600; text-decoration: none;">Ready to Review</a>. ';
14831479
html += 'Free for open-source repositories, $6/user/org for private repos.';
14841480
html += '</div>';

0 commit comments

Comments
 (0)