wukong-gitlog-cli 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/web/app.js +48 -0
- package/web/index.html +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.20](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.19...v1.0.20) (2025-12-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 🎸 rolling30DurationRiskSummary ([b4a976e](https://github.com/tomatobybike/wukong-gitlog-cli/commit/b4a976e552cfdc1483b0f23f2a4126ecede42af3))
|
|
11
|
+
|
|
5
12
|
### [1.0.19](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.18...v1.0.19) (2025-12-05)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -1483,6 +1483,7 @@ function drawAuthorOvertimeTrends(commits, stats) {
|
|
|
1483
1483
|
renderMonthlyRiskSummary(commits, { startHour, endHour, cutoff })
|
|
1484
1484
|
renderWeeklyDurationRiskSummary(commits, { startHour, endHour, cutoff })
|
|
1485
1485
|
renderMonthlyDurationRiskSummary(commits, { startHour, endHour, cutoff })
|
|
1486
|
+
renderRolling30DurationRiskSummary(commits, { startHour, endHour, cutoff })
|
|
1486
1487
|
|
|
1487
1488
|
return chart
|
|
1488
1489
|
}
|
|
@@ -1698,6 +1699,53 @@ function renderMonthlyDurationRiskSummary(
|
|
|
1698
1699
|
</div>
|
|
1699
1700
|
`
|
|
1700
1701
|
}
|
|
1702
|
+
|
|
1703
|
+
function renderRolling30DurationRiskSummary(
|
|
1704
|
+
commits,
|
|
1705
|
+
{ startHour = 9, endHour = 18, cutoff = 6 } = {}
|
|
1706
|
+
) {
|
|
1707
|
+
const box = document.getElementById('rolling30DurationRiskSummary')
|
|
1708
|
+
if (!box) return
|
|
1709
|
+
const now = new Date()
|
|
1710
|
+
const utcToday = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()))
|
|
1711
|
+
utcToday.setUTCDate(utcToday.getUTCDate() - 29)
|
|
1712
|
+
const startKey = utcToday.toISOString().slice(0, 10)
|
|
1713
|
+
|
|
1714
|
+
const byAuthorDay = computeAuthorDailyMaxOvertime(commits, startHour, endHour, cutoff)
|
|
1715
|
+
const sums = []
|
|
1716
|
+
byAuthorDay.forEach((dayMap, author) => {
|
|
1717
|
+
let total = 0
|
|
1718
|
+
dayMap.forEach((v, dayKey) => {
|
|
1719
|
+
if (dayKey >= startKey) total += v
|
|
1720
|
+
})
|
|
1721
|
+
if (total > 0) sums.push({ author, total })
|
|
1722
|
+
})
|
|
1723
|
+
sums.sort((a, b) => b.total - a.total)
|
|
1724
|
+
const top = sums.slice(0, 6)
|
|
1725
|
+
const lines = []
|
|
1726
|
+
lines.push('【最近30天加班时长风险】')
|
|
1727
|
+
if (top.length === 0) {
|
|
1728
|
+
lines.push('最近30天暂无加班时长风险。')
|
|
1729
|
+
} else {
|
|
1730
|
+
top.forEach(({ author, total }) => {
|
|
1731
|
+
let level = '轻度'
|
|
1732
|
+
if (total >= 20) level = '严重'
|
|
1733
|
+
else if (total >= 10) level = '中度'
|
|
1734
|
+
lines.push(`${author} 最近30天累计加班 ${total.toFixed(2)} 小时(${level})。`)
|
|
1735
|
+
})
|
|
1736
|
+
}
|
|
1737
|
+
box.innerHTML = `
|
|
1738
|
+
<div class="risk-summary">
|
|
1739
|
+
<div class="risk-title">【最近30天加班时长风险】</div>
|
|
1740
|
+
<ul>
|
|
1741
|
+
${lines
|
|
1742
|
+
.slice(1)
|
|
1743
|
+
.map((l) => `<li>${escapeHtml(l)}</li>`)
|
|
1744
|
+
.join('')}
|
|
1745
|
+
</ul>
|
|
1746
|
+
</div>
|
|
1747
|
+
`
|
|
1748
|
+
}
|
|
1701
1749
|
function renderMonthlyRiskSummary(
|
|
1702
1750
|
commits,
|
|
1703
1751
|
{ startHour = 9, endHour = 18, cutoff = 6 } = {}
|
package/web/index.html
CHANGED
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
<div id="monthlyRiskSummary" class="risk-summary-box"></div>
|
|
87
87
|
<div id="weeklyDurationRiskSummary" class="risk-summary-box"></div>
|
|
88
88
|
<div id="monthlyDurationRiskSummary" class="risk-summary-box"></div>
|
|
89
|
+
<div id="rolling30DurationRiskSummary" class="risk-summary-box"></div>
|
|
89
90
|
</div>
|
|
90
91
|
|
|
91
92
|
<div class="chart-card">
|