wukong-gitlog-cli 1.0.28 → 1.0.31

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 CHANGED
@@ -2,6 +2,27 @@
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.31](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.29...v1.0.31) (2025-12-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * 🎸 add date filter ([ac9779d](https://github.com/tomatobybike/wukong-gitlog-cli/commit/ac9779dd6eccd1d737d408d7d15ad15cede37dd2))
11
+
12
+ ### [1.0.30](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.29...v1.0.30) (2025-12-10)
13
+
14
+
15
+ ### Features
16
+
17
+ * 🎸 add date filter ([ac9779d](https://github.com/tomatobybike/wukong-gitlog-cli/commit/ac9779dd6eccd1d737d408d7d15ad15cede37dd2))
18
+
19
+ ### [1.0.29](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.28...v1.0.29) (2025-12-09)
20
+
21
+
22
+ ### Features
23
+
24
+ * 🎸 drawer title ([20bd05a](https://github.com/tomatobybike/wukong-gitlog-cli/commit/20bd05a2d395f803374845d78628ac0d79c99dfa))
25
+
5
26
  ### [1.0.28](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.27...v1.0.28) (2025-12-09)
6
27
 
7
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wukong-gitlog-cli",
3
- "version": "1.0.28",
3
+ "version": "1.0.31",
4
4
  "description": "Advanced Git commit log exporter with Excel/JSON/TXT output, grouping, stats and CLI.",
5
5
  "keywords": [
6
6
  "git",
package/web/app.js CHANGED
@@ -113,6 +113,7 @@ function updatePager() {
113
113
 
114
114
  function applySearch() {
115
115
  const q = document.getElementById('searchInput').value.trim().toLowerCase()
116
+
116
117
  if (!q) {
117
118
  filtered = commitsAll.slice()
118
119
  } else {
@@ -279,13 +280,14 @@ function drawHourlyOvertime(stats, onHourClick) {
279
280
  }
280
281
 
281
282
  // showSideBarForHour 实现
282
- function showSideBarForHour(hour, commitsOrCount) {
283
+ function showSideBarForHour({ hour, commitsOrCount, titleDrawer }) {
283
284
  // 支持传入 number(仅次数)或 array(详细 commit 列表)
284
285
  // 统一复用通用详情侧栏 DOM
285
286
  const sidebar = document.getElementById('dayDetailSidebar')
286
287
  const backdrop = document.getElementById('sidebarBackdrop')
287
288
  const titleEl = document.getElementById('sidebarTitle')
288
289
  const contentEl = document.getElementById('sidebarContent')
290
+ const drawerTitleEl = document.getElementById('sidebarDrawerTitle')
289
291
 
290
292
  // 兼容未传入侧栏 DOM 的情况(优雅降级)
291
293
  if (!sidebar || !titleEl || !contentEl) {
@@ -295,6 +297,7 @@ function showSideBarForHour(hour, commitsOrCount) {
295
297
  return
296
298
  }
297
299
 
300
+ drawerTitleEl.innerHTML = titleDrawer || '🕒 小时详情'
298
301
  titleEl.innerHTML = `🕒 ${String(hour).padStart(2, '0')}:00 - ${String(hour).padStart(2, '0')}:59`
299
302
 
300
303
  // 如果只是 number,显示计数
@@ -382,6 +385,8 @@ function drawDailyTrend(commits, onDayClick) {
382
385
  const data = labels.map((l) => map.get(l))
383
386
 
384
387
  const el = document.getElementById('dailyTrendChart')
388
+ const titleDrawer = el.getAttribute('data-title') || ''
389
+
385
390
  // eslint-disable-next-line no-undef
386
391
  const chart = echarts.init(el)
387
392
 
@@ -474,21 +479,29 @@ function drawDailyTrend(commits, onDayClick) {
474
479
  const dayCommits = commits.filter(
475
480
  (c) => new Date(c.date).toISOString().slice(0, 10) === date
476
481
  )
477
- onDayClick(date, count, dayCommits)
482
+ // onDayClick(date, count, dayCommits)
483
+ onDayClick({
484
+ date,
485
+ count,
486
+ commits: dayCommits,
487
+ titleDrawer
488
+ })
478
489
  })
479
490
  }
480
491
 
481
492
  return chart
482
493
  }
483
494
 
484
- function showSideBarForWeek(period, weeklyItem, commits = []) {
495
+ function showSideBarForWeek({ period, weeklyItem, commits = [], titleDrawer }) {
485
496
  // 统一复用通用详情侧栏 DOM
486
497
  const sidebar = document.getElementById('dayDetailSidebar')
487
498
  const backdrop = document.getElementById('sidebarBackdrop')
488
499
  const titleEl = document.getElementById('sidebarTitle')
489
500
  const contentEl = document.getElementById('sidebarContent')
501
+ const drawerTitleEl = document.getElementById('sidebarDrawerTitle')
490
502
 
491
503
  titleEl.innerHTML = `📅 周期:<b>${period}</b>`
504
+ drawerTitleEl.innerHTML = titleDrawer || ''
492
505
 
493
506
  let html = `
494
507
  <div style="padding:6px 0;">
@@ -532,6 +545,8 @@ function drawWeeklyTrend(weekly, commits, onWeekClick) {
532
545
  const dataCount = weekly.map((w) => w.outsideWorkCount)
533
546
 
534
547
  const el = document.getElementById('weeklyTrendChart')
548
+ const titleDrawer = el.getAttribute('data-title') || ''
549
+
535
550
  const chart = echarts.init(el)
536
551
 
537
552
  chart.setOption({
@@ -634,7 +649,13 @@ function drawWeeklyTrend(weekly, commits, onWeekClick) {
634
649
 
635
650
  // 回调交给外面决定如何打开侧栏
636
651
  if (typeof onWeekClick === 'function') {
637
- onWeekClick(w.period, w, weeklyCommits)
652
+ // onWeekClick(w.period, w, weeklyCommits)
653
+ onWeekClick({
654
+ period: w.period,
655
+ weeklyItem: w,
656
+ commits: weeklyCommits,
657
+ titleDrawer
658
+ })
638
659
  }
639
660
  })
640
661
 
@@ -648,6 +669,7 @@ function drawMonthlyTrend(monthly, commits, onMonthClick) {
648
669
  const dataRate = monthly.map((m) => +(m.outsideWorkRate * 100).toFixed(1)) // 0–100%
649
670
 
650
671
  const el = document.getElementById('monthlyTrendChart')
672
+ const titleDrawer = el.getAttribute('data-title') || ''
651
673
  // eslint-disable-next-line no-undef
652
674
  const chart = echarts.init(el)
653
675
 
@@ -750,7 +772,13 @@ function drawMonthlyTrend(monthly, commits, onMonthClick) {
750
772
  )}`
751
773
  return m === ym
752
774
  })
753
- onMonthClick(ym, monthCommits.length, monthCommits)
775
+ // onMonthClick(ym, monthCommits.length, monthCommits)
776
+ onMonthClick({
777
+ date: ym,
778
+ count: monthCommits.length,
779
+ commits: monthCommits,
780
+ titleDrawer
781
+ })
754
782
  })
755
783
  }
756
784
 
@@ -787,6 +815,8 @@ function drawLatestHourDaily(latestByDay, commits, onDayClick) {
787
815
  const maxV = numericValues.length > 0 ? Math.max(...numericValues) : 0
788
816
 
789
817
  const el = document.getElementById('latestHourDailyChart')
818
+ const titleDrawer = el.getAttribute('data-title') || ''
819
+
790
820
  // eslint-disable-next-line no-undef
791
821
  const chart = echarts.init(el)
792
822
 
@@ -886,7 +916,13 @@ function drawLatestHourDaily(latestByDay, commits, onDayClick) {
886
916
  const idx = params.dataIndex
887
917
  const date = labels[idx]
888
918
  const list = dayCommitsMap[date] || []
889
- onDayClick(date, list.length, list)
919
+ // onDayClick(date, list.length, list)
920
+ onDayClick({
921
+ date,
922
+ count: list.length,
923
+ commits: list,
924
+ titleDrawer
925
+ })
890
926
  })
891
927
  }
892
928
 
@@ -910,6 +946,8 @@ function drawDailySeverity(latestByDay, commits, onDayClick) {
910
946
  const sev = raw.map((v) => (v == null ? 0 : Math.max(0, Number(v) - endH)))
911
947
 
912
948
  const el = document.getElementById('dailySeverityChart')
949
+ const titleDrawer = el.getAttribute('data-title') || ''
950
+
913
951
  // eslint-disable-next-line no-undef
914
952
  const chart = echarts.init(el)
915
953
 
@@ -1011,7 +1049,13 @@ function drawDailySeverity(latestByDay, commits, onDayClick) {
1011
1049
  const idx = params.dataIndex
1012
1050
  const date = labels[idx]
1013
1051
  const list = dayCommitsMap[date] || []
1014
- onDayClick(date, list.length, list)
1052
+ // onDayClick(date, list.length, list)
1053
+ onDayClick({
1054
+ date,
1055
+ count: list.length,
1056
+ commits: list,
1057
+ titleDrawer
1058
+ })
1015
1059
  })
1016
1060
  }
1017
1061
 
@@ -1089,13 +1133,13 @@ function drawDailyTrendSeverity(commits, weekly, onDayClick) {
1089
1133
  silent: true,
1090
1134
  itemStyle: { opacity: 0.15 },
1091
1135
  data: [
1092
- [{ name: '0–1 小时', yAxis: 0 }, { yAxis: 1 }],
1136
+ [{ name: '0–5 ', yAxis: 0 }, { yAxis: 5 }],
1093
1137
  [
1094
- { name: '12 小时', yAxis: 1 },
1095
- { yAxis: 2, itemStyle: { color: 'orange', opacity: 0.25 } }
1138
+ { name: '510 ', yAxis: 5 },
1139
+ { yAxis: 10, itemStyle: { color: 'orange', opacity: 0.25 } }
1096
1140
  ],
1097
1141
  [
1098
- { name: '2 小时以上', yAxis: 2 },
1142
+ { name: '10 次以上', yAxis: 10 },
1099
1143
  { yAxis: 999, itemStyle: { color: 'red', opacity: 0.25 } }
1100
1144
  ]
1101
1145
  ]
@@ -1122,6 +1166,8 @@ function drawDailyTrendSeverity(commits, weekly, onDayClick) {
1122
1166
 
1123
1167
  // ---------- 7. 绘图 ----------
1124
1168
  const el = document.getElementById('dailyTrendChartDog')
1169
+ const titleDrawer = el.getAttribute('data-title') || ''
1170
+
1125
1171
  const chart = echarts.init(el)
1126
1172
 
1127
1173
  chart.setOption({
@@ -1161,7 +1207,13 @@ function drawDailyTrendSeverity(commits, weekly, onDayClick) {
1161
1207
  if (params.componentType === 'series') {
1162
1208
  const date = labels[params.dataIndex]
1163
1209
  const count = data[params.dataIndex]
1164
- onDayClick(date, count, dayCommitsDetail[date])
1210
+ // onDayClick(date, count, dayCommitsDetail[date])
1211
+ onDayClick({
1212
+ date,
1213
+ count,
1214
+ commits: dayCommitsDetail[date],
1215
+ titleDrawer
1216
+ })
1165
1217
  }
1166
1218
  })
1167
1219
  }
@@ -1176,13 +1228,15 @@ function drawDailyTrendSeverity(commits, weekly, onDayClick) {
1176
1228
  }
1177
1229
  }
1178
1230
 
1179
- function showDayDetailSidebar(date, count, commits) {
1231
+ function showDayDetailSidebar({ date, count, commits, titleDrawer }) {
1180
1232
  const sidebar = document.getElementById('dayDetailSidebar')
1181
1233
  const backdrop = document.getElementById('sidebarBackdrop')
1182
1234
  const title = document.getElementById('sidebarTitle')
1183
1235
  const content = document.getElementById('sidebarContent')
1236
+ const drawerTitleEl = document.getElementById('sidebarDrawerTitle')
1184
1237
 
1185
1238
  title.innerHTML = `📅 ${date}(${count} 次提交)`
1239
+ drawerTitleEl.innerHTML = titleDrawer || ''
1186
1240
 
1187
1241
  // 渲染详情
1188
1242
  content.innerHTML = commits
@@ -1392,11 +1446,52 @@ const drawChangeTrends = (stats) => {
1392
1446
  if (!el) return null
1393
1447
  const chart = echarts.init(el)
1394
1448
 
1395
- function render(t) {
1396
- const { authors, allPeriods, series } = buildDataset(stats, t)
1449
+ function render(type) {
1450
+ const { authors, allPeriods, series } = buildDataset(stats, type)
1451
+ const ds = { authors, allPeriods, series }
1452
+ ds.rangeMap = {}
1397
1453
 
1454
+ for (const period of ds.allPeriods) {
1455
+ if (period.includes('-W')) {
1456
+ const [yy, ww] = period.split('-W')
1457
+ ds.rangeMap[period] = getISOWeekRange(Number(yy), Number(ww))
1458
+ }
1459
+ }
1398
1460
  chart.setOption({
1399
- tooltip: { trigger: 'axis' },
1461
+ // tooltip: { trigger: 'axis' },
1462
+ tooltip: {
1463
+ trigger: 'axis',
1464
+ formatter(params) {
1465
+ if (!params || !params.length) return ''
1466
+
1467
+ const p = params[0]
1468
+ const label = p.axisValue
1469
+ const isWeekly = type === 'weekly'
1470
+
1471
+ let extra = ''
1472
+ if (isWeekly && ds.rangeMap && ds.rangeMap[label]) {
1473
+ const { start, end } = ds.rangeMap[label]
1474
+ // extra = `<div style="margin-top:4px;color:#999;font-size:12px">
1475
+ // 周区间:${start} ~ ${end}
1476
+ // </div>`
1477
+ // TODO: remove debug log before production
1478
+ extra = ''
1479
+ }
1480
+
1481
+ const lines = params
1482
+ .filter((i) => i.data > 0)
1483
+ .map(
1484
+ (item) => `${item.marker}${item.seriesName}: ${item.data} 行变更`
1485
+ )
1486
+ .join('<br/>')
1487
+
1488
+ return `
1489
+ <div>${label}</div>
1490
+ ${extra}
1491
+ ${lines}
1492
+ `
1493
+ }
1494
+ },
1400
1495
  legend: { data: authors },
1401
1496
  xAxis: { type: 'category', data: allPeriods },
1402
1497
  yAxis: { type: 'value' },
@@ -1511,8 +1606,9 @@ function drawAuthorOvertimeTrends(commits, stats) {
1511
1606
  }
1512
1607
 
1513
1608
  const lines = params
1609
+ .filter((i) => i.data > 0)
1514
1610
  .map(
1515
- (item) => `${item.marker}${item.seriesName}: ${item.data} 小时`
1611
+ (item) => `${item.marker}${item.seriesName}: ${item.data} 次提交`
1516
1612
  )
1517
1613
  .join('<br/>')
1518
1614
 
@@ -1525,7 +1621,9 @@ function drawAuthorOvertimeTrends(commits, stats) {
1525
1621
  },
1526
1622
  legend: { data: ds.authors },
1527
1623
  xAxis: { type: 'category', data: ds.allPeriods },
1528
- yAxis: { type: 'value' },
1624
+ // y 轴名称改为提交数
1625
+ yAxis: { type: 'value', name: '提交数 (次)' },
1626
+
1529
1627
  series: ds.series
1530
1628
  })
1531
1629
  }
@@ -2042,6 +2140,7 @@ function drawAuthorLatestOvertimeTrends(commits, stats) {
2042
2140
  }
2043
2141
 
2044
2142
  const lines = params
2143
+ .filter((i) => i.data > 0)
2045
2144
  .map(
2046
2145
  (item) => `${item.marker}${item.seriesName}: ${item.data} 小时`
2047
2146
  )
@@ -2285,7 +2384,11 @@ async function main() {
2285
2384
  // 使用举例
2286
2385
  const hourCommitsDetail = groupCommitsByHour(commits)
2287
2386
  // 将 commit 列表传给侧栏(若没有详情,则传空数组)
2288
- showSideBarForHour(hour, hourCommitsDetail[hour] || [])
2387
+ showSideBarForHour({
2388
+ hour,
2389
+ commitsOrCount: hourCommitsDetail[hour] || [],
2390
+ titleDrawer: '每小时加班分布'
2391
+ })
2289
2392
  })
2290
2393
  drawOutsideVsInside(stats)
2291
2394
 
package/web/index.html CHANGED
@@ -25,33 +25,33 @@
25
25
  <section id="charts">
26
26
  <div class="chart-card">
27
27
  <h2>每小时加班分布 (小时 -> 提交数)</h2>
28
- <div id="hourlyOvertimeChart" class="echart"></div>
28
+ <div id="hourlyOvertimeChart" data-title="每小时加班分布" class="echart"></div>
29
29
  </div>
30
30
 
31
31
  <div class="chart-card">
32
- <h2>按日提交趋势</h2>
33
- <div id="dailyTrendChart" class="echart"></div>
32
+ <h2>按日提交趋势(次数)</h2>
33
+ <div id="dailyTrendChart" data-title="按日提交趋势(次数)" class="echart"></div>
34
34
  </div>
35
35
 
36
36
  <div class="chart-card">
37
37
  <h2>每周趋势(加班占比)</h2>
38
- <div id="weeklyTrendChart" class="echart"></div>
38
+ <div id="weeklyTrendChart" data-title="每周趋势(加班占比)" class="echart"></div>
39
39
  </div>
40
40
  <div class="chart-card">
41
41
  <h2>每月趋势(加班占比)</h2>
42
- <div id="monthlyTrendChart" class="echart"></div>
42
+ <div id="monthlyTrendChart" data-title="每月趋势(加班占比)" class="echart"></div>
43
43
  </div>
44
44
  <div class="chart-card">
45
45
  <h2>每日最晚提交时间(小时)</h2>
46
- <div id="latestHourDailyChart" class="echart"></div>
46
+ <div id="latestHourDailyChart" data-title="每日最晚提交时间(小时)" class="echart"></div>
47
47
  </div>
48
48
  <div class="chart-card">
49
49
  <h2>每日超过下班的小时数</h2>
50
- <div id="dailySeverityChart" class="echart"></div>
50
+ <div id="dailySeverityChart" data-title="每日超过下班的小时数" class="echart"></div>
51
51
  </div>
52
52
  <div class="chart-card">
53
- <h2>按日提交趋势</h2>
54
- <div id="dailyTrendChartDog" class="echart"></div>
53
+ <h2>按日提交趋势(次数)</h2>
54
+ <div id="dailyTrendChartDog" data-title="按日提交趋势" class="echart"></div>
55
55
  </div>
56
56
  <div class="chart-card">
57
57
  <div id="mostTiredDay"></div>
@@ -64,7 +64,7 @@
64
64
  </section>
65
65
 
66
66
  <div class="chart-card">
67
- <h2>开发者 Changed 工作量趋势</h2>
67
+ <h2>开发者 Changed 工作量趋势(行数)</h2>
68
68
 
69
69
  <div id="tabs" class="tabs">
70
70
  <button data-type="daily" class="active">按日</button>
@@ -75,7 +75,7 @@
75
75
  </div>
76
76
 
77
77
  <div class="chart-card">
78
- <h2>开发者 加班趋势</h2>
78
+ <h2>开发者 加班趋势(次数)</h2>
79
79
  <div class="tabs" id="tabsOvertime">
80
80
  <button data-type="daily" class="active">按日</button>
81
81
  <button data-type="weekly">按周</button>
@@ -90,7 +90,7 @@
90
90
  </div>
91
91
 
92
92
  <div class="chart-card">
93
- <h2>开发者 加班最晚趋势</h2>
93
+ <h2>开发者 加班最晚趋势(小时)</h2>
94
94
  <div class="tabs" id="tabsLatestOvertime">
95
95
  <button data-type="daily" class="active">按日</button>
96
96
  <button data-type="weekly">按周</button>
@@ -107,7 +107,7 @@
107
107
  <input
108
108
  id="searchInput"
109
109
  type="search"
110
- placeholder="搜索作者/信息/Hash"
110
+ placeholder="搜索作者/信息/Hash/Date"
111
111
  />
112
112
  <label for="pageSize">每页显示</label>
113
113
  <select id="pageSize">
@@ -147,9 +147,10 @@
147
147
  <div id="sidebarBackdrop" class="sidebar-backdrop"></div>
148
148
  <div id="dayDetailSidebar" class="sidebar">
149
149
  <div class="sidebar-header">
150
- <span id="sidebarTitle"></span>
150
+ <span id="sidebarDrawerTitle"></span>
151
151
  <button id="sidebarClose">×</button>
152
152
  </div>
153
+ <div id="sidebarTitle"></div>
153
154
  <div id="sidebarContent" class="sidebar-content"></div>
154
155
  </div>
155
156