git-fish-log 1.0.3 → 1.0.4
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/README-/345/225/260/345/227/246/347/211/210.md +321 -0
- package/dist/index.js +37 -13
- package/package.json +3 -2
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# 🐟 fish - Git 摸鱼 & 爆肝分析器
|
|
2
|
+
|
|
3
|
+
`fish` 是一个好玩有趣的命令行工具(CLI),专为程序员设计。它通过扫描本地 Git 仓库的 Commit 历史(支持多项目扫描和自动发现),深度挖掘你的开发轨迹,自动计算出你每天的**“摸鱼指数”**,生成幽默风趣的周报与月报,并配有令人会心一笑的 **AI 风格无情吐槽**!
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✨ 核心特色
|
|
8
|
+
|
|
9
|
+
1. **摸鱼指数算法**:基于每日提交次数与提交时间跨度进行轻量级多维拟合。0 次提交为 99% 摸鱼,频繁提交且跨度长达 8 小时以上为 10% 狂热爆肝。
|
|
10
|
+
2. **多维度报告展示**:
|
|
11
|
+
- **默认周报**:按天梳理工作轨迹、努力/轻松天数以及趣味 锐评。
|
|
12
|
+
- **月度分析 (`-m`)**:利用常规 Git 提交前缀正则分类(`feat`/`fix`/`chore`/`docs`),生成图形化比例条与深度吐槽。
|
|
13
|
+
- **项目排行榜 (`-p`)**:对比你名下各个项目的爆肝程度,定位你的“主力搬砖地”与“划水摸鱼点”。
|
|
14
|
+
- **黄金时间段分析 (`-t`)**:绘制 24 小时 commit 频次分布柱状图,精准识别你的下班突击时间和开会摸鱼期。
|
|
15
|
+
- **深夜幽灵检测 (`-g`)**:统计半夜 12 点至凌晨 5 点的 commits,劝阻无谓爆肝,保命要紧!
|
|
16
|
+
3. **多仓库/多项目管理**:支持将多个 Git 仓库注册到全局配置中,甚至支持一键递归扫描某目录下所有的 Git 仓库。
|
|
17
|
+
4. **极速零阻塞体验**:纯原生 `git log` 命令执行并返回结构化数据,不依赖大型第三方封装,由 `tsup` 预打包为极轻量独立 ESM 运行。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## 🚀 安装与使用指南
|
|
24
|
+
|
|
25
|
+
### 1. 克隆与安装依赖
|
|
26
|
+
```bash
|
|
27
|
+
npm install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. 编译打包
|
|
31
|
+
```bash
|
|
32
|
+
npm run build
|
|
33
|
+
```
|
|
34
|
+
编译产物会生成在 `./dist/index.js`
|
|
35
|
+
|
|
36
|
+
### 3. 全局链接 CLI 命令
|
|
37
|
+
在当前目录中运行:
|
|
38
|
+
```bash
|
|
39
|
+
npm link
|
|
40
|
+
```
|
|
41
|
+
这将在你全局的 `npm` bin 目录中创建符号链接。你现在可以在系统的任何目录中直接通过 `fish` 运行该程序了!
|
|
42
|
+
### 4.配置【划重点】
|
|
43
|
+
配置/新增 GitLab 远程扫描源(支持多数据源管理):
|
|
44
|
+
```bash
|
|
45
|
+
fish config gitlab <token> [host] [name]
|
|
46
|
+
```
|
|
47
|
+
* `token`: 你的 GitLab 个人/项目访问令牌 (PAT),需有 `read_api` 或 `api` 权限。
|
|
48
|
+
* `host`: 可选。私有部署的 GitLab 域名(如 `https://gitlab.mycompany.com`),缺省默认使用 `https://gitlab.com`。
|
|
49
|
+
* `name`: 可选。给该数据源指定的别名(如 `my-company`),缺省时自动使用 host 域名作为别名。若别名已存在则会覆盖更新。
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 📖 CLI 命令行示例
|
|
54
|
+
|
|
55
|
+
### 1. 基础摸鱼周报(月报)
|
|
56
|
+
```bash
|
|
57
|
+
fish
|
|
58
|
+
```
|
|
59
|
+
默认展示本周(周一零点至周日 23:59)的所有提交记录以及每日的摸鱼指数统计。
|
|
60
|
+
```bash
|
|
61
|
+
==================================================
|
|
62
|
+
🐟 FISH - 本周 Git 摸鱼周报
|
|
63
|
+
==================================================
|
|
64
|
+
|
|
65
|
+
📅 本周提交详情:
|
|
66
|
+
周一:0 次 | 🐟 摸鱼指数: 90% (终极摸鱼 🎣) 🏷 🐟 今日暂无代码活动
|
|
67
|
+
周二:2 次 | 🐟 摸鱼指数: 51% (正常营业 💻) | 1个项目 (项目名称)
|
|
68
|
+
周三:0 次 | 🐟 摸鱼指数: 90% (终极摸鱼 🎣) 🏷 🐟 今日暂无代码活动
|
|
69
|
+
周四:未到
|
|
70
|
+
周五:未到
|
|
71
|
+
|
|
72
|
+
--------------------------------------------------
|
|
73
|
+
☕ 最快乐的日子:周一、周三、周四、周五 | 🐟 摸鱼指数:90%
|
|
74
|
+
--------------------------------------------------
|
|
75
|
+
📊 本周均值:🐟 摸鱼 77%
|
|
76
|
+
--------------------------------------------------
|
|
77
|
+
🤖 锐评:
|
|
78
|
+
看来本周的项目进入了‘养精蓄锐’阶段——手机太好玩,或者床太暖和。摸鱼技巧已达炉火纯青之境。
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. 月度报告与工作分类
|
|
82
|
+
```bash
|
|
83
|
+
fish --month
|
|
84
|
+
# 或
|
|
85
|
+
fish -m
|
|
86
|
+
```
|
|
87
|
+
查看本月的所有 Commit 分类(Bug 修复、新功能、杂务文档、其他)占比图以及大月度 锐评。
|
|
88
|
+
```bash
|
|
89
|
+
==================================================
|
|
90
|
+
🐟 FISH - 本月 Git 摸鱼月报
|
|
91
|
+
==================================================
|
|
92
|
+
|
|
93
|
+
📅 本月主要贡献占比 (基于 Commit Message 正则归类):
|
|
94
|
+
- 修 bug (fix) :[■■■□□□□□□□□□□□□] 18% (10 次)
|
|
95
|
+
- 新功能 (feat) :[■■■■■■■■■□□□□□□] 62% (34 次)
|
|
96
|
+
- 杂务与文档 (chore) :[■■■□□□□□□□□□□□□] 18% (10 次)
|
|
97
|
+
- 其他提交 (other) :[□□□□□□□□□□□□□□□] 2% (1 次)
|
|
98
|
+
|
|
99
|
+
📅 每日摸鱼指数概览:
|
|
100
|
+
6月1日 6月2日 6月3日 6月4日 6月5日 6月6日 6月7日
|
|
101
|
+
36% 40% 90% 38% 90% 90% 90%
|
|
102
|
+
|
|
103
|
+
6月8日 6月9日 6月10日 6月11日 6月12日 6月13日 6月14日
|
|
104
|
+
90% 90% 20% 34% 11% 90% 90%
|
|
105
|
+
|
|
106
|
+
6月15日 6月16日 6月17日 6月18日 6月19日 6月20日 6月21日
|
|
107
|
+
32% 38% 23% 35% 90% 90% 90%
|
|
108
|
+
|
|
109
|
+
6月22日 6月23日 6月24日
|
|
110
|
+
90% 51% 90%
|
|
111
|
+
|
|
112
|
+
🔥 爆肝王: 6月12日 → 摸鱼指数 11% 🔥 爆肝战神 🧱 勤恳搬砖人
|
|
113
|
+
|
|
114
|
+
--------------------------------------------------
|
|
115
|
+
🤖 锐评:
|
|
116
|
+
本月 Feat 占比高达 62%。新功能一项接一项,开发火力全开,业务线因你而飞速前进!
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3. 横向项目爆肝排行
|
|
120
|
+
```bash
|
|
121
|
+
fish --project
|
|
122
|
+
# 或
|
|
123
|
+
fish -p
|
|
124
|
+
```
|
|
125
|
+
对目前配置监控的多个项目按照 Commit 数量进行降序排行,并配有幽默的地位标识。
|
|
126
|
+
```bash
|
|
127
|
+
fish -w 1 -p
|
|
128
|
+
```
|
|
129
|
+
```bash
|
|
130
|
+
==================================================
|
|
131
|
+
🐟 FISH - 项目爆肝排行 (上周)
|
|
132
|
+
==================================================
|
|
133
|
+
|
|
134
|
+
📊 对应时段项目爆肝排行 (2026/6/15 ~ 2026/6/21)
|
|
135
|
+
1. 项目名称: 13 次提交 (主力搬砖地 🧱)
|
|
136
|
+
2. 项目名称: 3 次提交 (偶尔上去点一下 🐟)
|
|
137
|
+
3. 项目名称: 2 次提交 (边缘挂机项目 💤)
|
|
138
|
+
4. 项目名称: 1 次提交 (测完就跑,纯粹路过 🚬)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 4. 24 小时黄金提交时间段图表
|
|
142
|
+
```bash
|
|
143
|
+
fish --time
|
|
144
|
+
# 或
|
|
145
|
+
fish -t
|
|
146
|
+
```
|
|
147
|
+
以水平柱状图形象打印 24 小时中你提交代码的波峰和波谷,包含个性化的时段说明。
|
|
148
|
+
```bash
|
|
149
|
+
fish -w 1 -t
|
|
150
|
+
```
|
|
151
|
+
```bash
|
|
152
|
+
==================================================
|
|
153
|
+
🐟 FISH - 黄金工作时间段分析 (24小时分布) (上周)
|
|
154
|
+
==================================================
|
|
155
|
+
|
|
156
|
+
🕒 对应时段 24 小时 commit 频次分布图:
|
|
157
|
+
00:00 | [ ] 0 次
|
|
158
|
+
01:00 | [ ] 0 次
|
|
159
|
+
02:00 | [ ] 0 次
|
|
160
|
+
03:00 | [ ] 0 次
|
|
161
|
+
04:00 | [ ] 0 次
|
|
162
|
+
05:00 | [ ] 0 次
|
|
163
|
+
06:00 | [ ] 0 次
|
|
164
|
+
07:00 | [ ] 0 次
|
|
165
|
+
08:00 | [ ] 0 次
|
|
166
|
+
09:00 | [██████ ] 3 次 (上午表演型选手 🚀)
|
|
167
|
+
10:00 | [██████████████████████████ ] 12 次 (上午表演型选手 🚀)
|
|
168
|
+
11:00 | [██████████████████████████████] 14 次 (正常人类工作时间 ✅)
|
|
169
|
+
12:00 | [██ ] 1 次 (干饭是第一生产力 🍚)
|
|
170
|
+
13:00 | [█████████████ ] 6 次 (干饭是第一生产力 🍚)
|
|
171
|
+
14:00 | [█████████████ ] 6 次 (午后灵魂出窍者 👻)
|
|
172
|
+
15:00 | [██████████████████████████████] 14 次 (CPU 重启中 🔄)
|
|
173
|
+
16:00 | [███████████████████ ] 9 次 (临近下班突然勤奋 🤔)
|
|
174
|
+
17:00 | [██████████████████████████████] 14 次 (临近下班突然勤奋 🤔)
|
|
175
|
+
18:00 | [████ ] 2 次 (自愿(被迫)加班人 💪)
|
|
176
|
+
19:00 | [ ] 0 次
|
|
177
|
+
20:00 | [ ] 0 次
|
|
178
|
+
21:00 | [ ] 0 次
|
|
179
|
+
22:00 | [ ] 0 次
|
|
180
|
+
23:00 | [ ] 0 次
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 5. 幽灵提交检测
|
|
184
|
+
```bash
|
|
185
|
+
fish --ghost
|
|
186
|
+
# 或
|
|
187
|
+
fish -g
|
|
188
|
+
```
|
|
189
|
+
检测本周在 00:00 - 05:00 期间生成的 Commit,如有发现,会触发防猝死警告与尖锐吐槽。
|
|
190
|
+
```bash
|
|
191
|
+
==================================================
|
|
192
|
+
🐟 FISH - 幽灵提交检测 (深夜 00:00 ~ 05:00)
|
|
193
|
+
==================================================
|
|
194
|
+
|
|
195
|
+
🎉 恭喜!本时间段内未检测到任何深夜幽灵提交。
|
|
196
|
+
你的发际线十分安全,大福报已被无情拒收,睡眠健康得分:100 分!
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 6. 报告时间偏移与远程源筛选 (通用选项)
|
|
200
|
+
在运行任何报告命令时,都可以配合以下选项:
|
|
201
|
+
- **`-w, --weeks-ago <number>`**:查看之前某周/某月的报告(默认 `0` 表示本周/本月,`1` 表示上周/上月,`2` 表示上上周/上上月,以此类推)。
|
|
202
|
+
```bash
|
|
203
|
+
# 查看上周的摸鱼周报
|
|
204
|
+
fish -w 1
|
|
205
|
+
# 查看两个月前的摸鱼月报
|
|
206
|
+
fish -m 2
|
|
207
|
+
```
|
|
208
|
+
- **`-s, --source <source>`**:指定要查询的 GitLab 远程数据源,支持填别名或序号(例如 `1`, `2`)。如不填默认查询首个配置。
|
|
209
|
+
```bash
|
|
210
|
+
# 查询别名为 company-gitlab 的源在上周的数据
|
|
211
|
+
fish -w 1 -s company-gitlab
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### 7. 项目与 GitLab 配置管理命令 (`fish config`)
|
|
217
|
+
- **列出当前配置的所有监控项目与 GitLab 源**:
|
|
218
|
+
```bash
|
|
219
|
+
fish config list
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
- **【划重点】配置/新增 GitLab 远程扫描源(支持多数据源管理)**:
|
|
223
|
+
```bash
|
|
224
|
+
fish config gitlab <token> [host] [name]
|
|
225
|
+
```
|
|
226
|
+
* `token`: 你的 GitLab 个人/项目访问令牌 (PAT),需有 `read_api` 或 `api` 权限。
|
|
227
|
+
* `host`: 可选。私有部署的 GitLab 域名(如 `https://gitlab.mycompany.com`),缺省默认使用 `https://gitlab.com`。
|
|
228
|
+
* `name`: 可选。给该数据源指定的别名(如 `my-company`),缺省时自动使用 host 域名作为别名。若别名已存在则会覆盖更新。
|
|
229
|
+
- **清除 GitLab 远程扫描配置**:
|
|
230
|
+
```bash
|
|
231
|
+
# 清除指定的某一个 GitLab 配置(支持写序号或别名)
|
|
232
|
+
fish config gitlab-clear <name_or_index>
|
|
233
|
+
|
|
234
|
+
# 清除所有的 GitLab 配置并关闭远程扫描
|
|
235
|
+
fish config gitlab-clear
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
- **手动添加一个本地 Git 仓库**:
|
|
239
|
+
```bash
|
|
240
|
+
fish config add <path_to_repo>
|
|
241
|
+
```
|
|
242
|
+
- **从监控列表中移除一个仓库**:
|
|
243
|
+
```bash
|
|
244
|
+
fish config remove <path_to_repo>
|
|
245
|
+
```
|
|
246
|
+
- **自动扫描指定目录下的一级子目录,批量添加 Git 仓库**:
|
|
247
|
+
```bash
|
|
248
|
+
fish config scan <root_path>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 🎨 算法说明:摸鱼指数计算公式
|
|
254
|
+
|
|
255
|
+
每天同时计算 **五个维度**的指数:
|
|
256
|
+
|
|
257
|
+
| 指数 | 说明 |
|
|
258
|
+
|------|------|
|
|
259
|
+
| 🐟 摸鱼指数 | 反向指标,越高越摸鱼 |
|
|
260
|
+
| 🌙 修仙指数 | 深夜 (00:00-05:00) 提交频率 |
|
|
261
|
+
| 🧱 搬砖指数 | 代码量 (additions + deletions) + 提交频率 |
|
|
262
|
+
| 💥 爆发指数 | 单次提交修改量(一把梭) |
|
|
263
|
+
| 🏷 人格标签 | 任意指数 ≥ 80 时触发 + 隐藏成就 |
|
|
264
|
+
|
|
265
|
+
### 输入数据
|
|
266
|
+
|
|
267
|
+
- $N$ = 当天 Commit 数量
|
|
268
|
+
- $S$ = 最早与最晚 Commit 时间跨度(小时)
|
|
269
|
+
- $L$ = 总修改行数 (additions + deletions)
|
|
270
|
+
- $avgLines = L / \max(N, 1)$ = 平均每次修改行数
|
|
271
|
+
- $D = N / (S + 1)$ = Commit 密度
|
|
272
|
+
- $Night$ = 深夜 (00:00-05:00) 提交数
|
|
273
|
+
- $Weekend$ = 是否为周末
|
|
274
|
+
|
|
275
|
+
### 基础得分(0 ~ 100)
|
|
276
|
+
|
|
277
|
+
| 得分项 | 公式 | 设计意图 |
|
|
278
|
+
|--------|------|----------|
|
|
279
|
+
| 提交活跃度 | $\min(100,\ \log_2(N+1) \times 25)$ | 对数防刷 commit |
|
|
280
|
+
| 工时跨度 | $\min(100,\ \sqrt{S} \times 25)$ | 平方根防拉长跨度 |
|
|
281
|
+
| 代码活跃度 | $\min(100,\ \log_2(L+1) \times 12)$ | 对数防刷行数 |
|
|
282
|
+
| 密度得分 | $N \le 1$ 时为 0,否则 $\min(100,\ D \times 50)$ | 单次提交无密度可言 |
|
|
283
|
+
| 修仙得分 | $\min(100,\ Night \times 30)$ | 深夜加班证据 |
|
|
284
|
+
|
|
285
|
+
### 最终指数
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
hardworking = 提交活跃度×0.30 + 代码活跃度×0.30 + 密度得分×0.20 + 工时跨度×0.20
|
|
289
|
+
if (isWeekend && N > 0) hardworking += 8
|
|
290
|
+
hardworking = min(100, round(hardworking))
|
|
291
|
+
|
|
292
|
+
fish = max(1, 100 - hardworking)
|
|
293
|
+
nightOwl = min(100, round(修仙得分×0.7 + 工时跨度×0.3))
|
|
294
|
+
builder = min(100, round(代码活跃度×0.7 + 提交活跃度×0.3))
|
|
295
|
+
burst = min(100, round(log₂(avgLines + 1) × 12))
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 人格标签
|
|
299
|
+
|
|
300
|
+
| 条件 | 标签 |
|
|
301
|
+
|------|------|
|
|
302
|
+
| 🐟 摸鱼 ≥ 80 | 摸鱼宗师 |
|
|
303
|
+
| 🔥 爆肝 ≥ 80 | 爆肝战神 |
|
|
304
|
+
| 🌙 修仙 ≥ 80 | 深夜修仙者 |
|
|
305
|
+
| 🧱 搬砖 ≥ 80 | 勤恳搬砖人 |
|
|
306
|
+
| 💥 爆发 ≥ 80 且 N ≤ 2 | 一把梭哈型程序员 |
|
|
307
|
+
|
|
308
|
+
### 隐藏成就
|
|
309
|
+
|
|
310
|
+
| 条件 | 成就 |
|
|
311
|
+
|------|------|
|
|
312
|
+
| 提交活跃度 ≥ 70 且 代码活跃度 ≤ 15 | 🏷 PPT 架构师 |
|
|
313
|
+
| N ≥ 10 且 L ≤ 30 | 🏷 格式化大师 |
|
|
314
|
+
| N ≥ 15 且 avgLines ≤ 2 | 🏷 Git 聊天达人 |
|
|
315
|
+
| 修仙 ≥ 80 且 N ≤ 3 | 🏷 深夜刺客 |
|
|
316
|
+
| 爆肝 ≥ 90 且 修仙 ≥ 70 且 周末 | 🏷 生产队的驴 |
|
|
317
|
+
| 摸鱼 ≥ 95 且 N ≤ 1 | 🏷 摸鱼仙人 |
|
|
318
|
+
|
|
319
|
+
### 特殊情况
|
|
320
|
+
|
|
321
|
+
- **0 Commit**:摸鱼 = 90(不判 100,可能开会/调研/排查问题),其余为 0,标签 = "🐟 今日暂无代码活动"
|
package/dist/index.js
CHANGED
|
@@ -289,6 +289,38 @@ function getLocalGitIdentity() {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// src/gitlab.ts
|
|
292
|
+
import http from "http";
|
|
293
|
+
import https from "https";
|
|
294
|
+
async function gitLabFetch(url, headers) {
|
|
295
|
+
if (typeof globalThis.fetch === "function") {
|
|
296
|
+
const res = await globalThis.fetch(url, { headers });
|
|
297
|
+
return {
|
|
298
|
+
ok: res.ok,
|
|
299
|
+
statusText: res.statusText,
|
|
300
|
+
json: () => res.json()
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return new Promise((resolve, reject) => {
|
|
304
|
+
const parsed = new URL(url);
|
|
305
|
+
const client = parsed.protocol === "http:" ? http : https;
|
|
306
|
+
const req = client.request(parsed, { method: "GET", headers }, (res) => {
|
|
307
|
+
let body = "";
|
|
308
|
+
res.setEncoding("utf8");
|
|
309
|
+
res.on("data", (chunk) => {
|
|
310
|
+
body += chunk;
|
|
311
|
+
});
|
|
312
|
+
res.on("end", () => {
|
|
313
|
+
resolve({
|
|
314
|
+
ok: (res.statusCode || 0) >= 200 && (res.statusCode || 0) < 300,
|
|
315
|
+
statusText: res.statusMessage || `HTTP ${res.statusCode}`,
|
|
316
|
+
json: async () => JSON.parse(body)
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
req.on("error", reject);
|
|
321
|
+
req.end();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
292
324
|
async function fetchGitLabCommits(since, until, source) {
|
|
293
325
|
const config = readConfig();
|
|
294
326
|
const gitlabs = config.gitlabs || [];
|
|
@@ -324,9 +356,7 @@ async function fetchGitLabCommits(since, until, source) {
|
|
|
324
356
|
const cleanHost = host.replace(/\/$/, "");
|
|
325
357
|
try {
|
|
326
358
|
const userUrl = `${cleanHost}/api/v4/user`;
|
|
327
|
-
const userRes = await
|
|
328
|
-
headers: { "PRIVATE-TOKEN": token }
|
|
329
|
-
});
|
|
359
|
+
const userRes = await gitLabFetch(userUrl, { "PRIVATE-TOKEN": token });
|
|
330
360
|
if (!userRes.ok) {
|
|
331
361
|
console.warn(`\x1B[33m[Warning] Failed to fetch GitLab user info: ${userRes.statusText}\x1B[0m`);
|
|
332
362
|
return [];
|
|
@@ -337,9 +367,7 @@ async function fetchGitLabCommits(since, until, source) {
|
|
|
337
367
|
const lowerUsername = user.username.toLowerCase();
|
|
338
368
|
const activeAfter = since.toISOString();
|
|
339
369
|
const projectsUrl = `${cleanHost}/api/v4/projects?membership=true&last_activity_after=${activeAfter}&per_page=100`;
|
|
340
|
-
const projectsRes = await
|
|
341
|
-
headers: { "PRIVATE-TOKEN": token }
|
|
342
|
-
});
|
|
370
|
+
const projectsRes = await gitLabFetch(projectsUrl, { "PRIVATE-TOKEN": token });
|
|
343
371
|
if (!projectsRes.ok) {
|
|
344
372
|
console.warn(`\x1B[33m[Warning] Failed to fetch GitLab projects: ${projectsRes.statusText}\x1B[0m`);
|
|
345
373
|
return [];
|
|
@@ -352,10 +380,8 @@ async function fetchGitLabCommits(since, until, source) {
|
|
|
352
380
|
const untilStr = until.toISOString();
|
|
353
381
|
const commitPromises = projects.map(async (project) => {
|
|
354
382
|
try {
|
|
355
|
-
const commitsUrl = `${cleanHost}/api/v4/projects/${project.id}/repository/commits?since=${sinceStr}&until=${untilStr}&per_page=100`;
|
|
356
|
-
const commitsRes = await
|
|
357
|
-
headers: { "PRIVATE-TOKEN": token }
|
|
358
|
-
});
|
|
383
|
+
const commitsUrl = `${cleanHost}/api/v4/projects/${project.id}/repository/commits?since=${sinceStr}&until=${untilStr}&per_page=100&all=true`;
|
|
384
|
+
const commitsRes = await gitLabFetch(commitsUrl, { "PRIVATE-TOKEN": token });
|
|
359
385
|
if (!commitsRes.ok) {
|
|
360
386
|
return [];
|
|
361
387
|
}
|
|
@@ -379,9 +405,7 @@ async function fetchGitLabCommits(since, until, source) {
|
|
|
379
405
|
let dels = 0;
|
|
380
406
|
try {
|
|
381
407
|
const detailUrl = `${cleanHost}/api/v4/projects/${project.id}/repository/commits/${encodeURIComponent(c.id)}`;
|
|
382
|
-
const detailRes = await
|
|
383
|
-
headers: { "PRIVATE-TOKEN": token }
|
|
384
|
-
});
|
|
408
|
+
const detailRes = await gitLabFetch(detailUrl, { "PRIVATE-TOKEN": token });
|
|
385
409
|
if (detailRes.ok) {
|
|
386
410
|
const detail = await detailRes.json();
|
|
387
411
|
if (detail.stats) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-fish-log",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "🐟 Git 摸鱼 & 爆肝分析器 CLI — 给你的提交记录生成摸鱼指数和 AI 锐评",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
-
"README.md"
|
|
12
|
+
"README.md",
|
|
13
|
+
"README-啰嗦版.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
16
|
"build": "tsup",
|