wukong-gitlog-cli 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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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.4](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.3...v1.0.4) (2025-11-29)
6
+
5
7
  ### [1.0.3](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.2...v1.0.3) (2025-11-29)
6
8
 
7
9
  ### [1.0.2](https://github.com/tomatobybike/wukong-gitlog-cli/compare/v1.0.1...v1.0.2) (2025-11-28)
package/README.md CHANGED
@@ -14,6 +14,7 @@
14
14
 
15
15
  Advanced Git commit log exporter with Excel/JSON/TXT output, grouping, stats and CLI.
16
16
 
17
+ English | [简体中文](./README.zh-CN.md)
17
18
  ---
18
19
 
19
20
  ## Features
@@ -82,7 +83,10 @@ Command-line options:
82
83
  - `--gerrit <prefix>` Show Gerrit URL for each commit (supports templates `{{hash}}`, `{{changeId}}` and `{{changeNumber}}`; `{{changeId}}` falls back to `hash` when absent; `{{changeNumber}}` requires `--gerrit-api` and falls back to `changeId` or `hash`)
83
84
  - `--out <file>` Output file name (without path). Defaults: `commits.json` / `commits.txt` / `commits.xlsx`
84
85
  - `--out-dir <dir>` Output directory path — supports relative or absolute path, e.g., `--out-dir ../output`
85
- - `--out-parent` Place output in the parent directory's `output/` folder (same as `--out-dir ../output`)
86
+ - `--serve` Start the local web service and view the submission statistics (data files will be generated under output/data)
87
+ - `--port <n>` Local web service port (default: 3000)
88
+ - `--serve-only` Only start the web service without exporting or analyzing data (using existing data in output/data)
89
+ - `--version` show version information
86
90
 
87
91
  > Output files are written to an `output/` directory in the current working directory.
88
92
  >
@@ -0,0 +1,211 @@
1
+ # 📦 `wukong-gitlog-cli`
2
+
3
+ <p align="center"> <img src="https://raw.githubusercontent.com/tomatobybike/wukong-gitlog-cli/main/images/logo.svg" width="200" alt="wukong-dev Logo" /> </p> <p align="center"> <a href="https://www.npmjs.com/package/wukong-gitlog-cli"><img src="https://img.shields.io/npm/v/wukong-gitlog-cli.svg" alt="npm version"></a> <a href="https://www.npmjs.com/package/wukong-gitlog-cli"><img src="https://img.shields.io/npm/dm/wukong-gitlog-cli.svg" alt="downloads"></a> <a href="https://github.com/tomatobybike/wukong-gitlog-cli/blob/master/LICENSE"><img src="https://img.shields.io/github/license/tomatobybike/wukong-gitlog-cli.svg" alt="license"></a> <a href="https://github.com/tomatobybike/wukong-gitlog-cli"><img src="https://img.shields.io/github/stars/tomatobybike/wukong-gitlog-cli.svg?style=social" alt="GitHub stars"></a> <a href="https://github.com/tomatobybike/wukong-gitlog-cli/issues"><img src="https://img.shields.io/github/issues/tomatobybike/wukong-gitlog-cli.svg" alt="issues"></a> </p>
4
+
5
+ 一个增强型的 Git 提交记录导出工具,支持 **Excel / JSON / TXT** 输出、分组统计、加班文化分析、Gerrit 链接支持,并带有可视化 Web Dashboard。
6
+
7
+ ## 中文 | [English](./README.md)
8
+
9
+ ---
10
+
11
+ ## ✨ 功能特性
12
+
13
+ - 导出 Git 提交记录到 **JSON / 文本 / Excel (XLSX)**
14
+
15
+ - 支持按日期分组(按 **天** / **月**)
16
+
17
+ - Excel 导出可包含每日统计表
18
+
19
+ - 支持 Gerrit 链接(支持模板 `{{hash}}`、`{{changeId}}`、`{{changeNumber}}`)
20
+
21
+ - 提供加班文化分析(每日工作时段、节假日、周末等)
22
+
23
+ - 自带本地 Web Dashboard,可显示柱状图、折线图、饼图
24
+
25
+ - 小而精简的 CLI,依赖极少,基于 ZX + ExcelJS
26
+
27
+ ---
28
+
29
+ ## 🆕 更新内容
30
+
31
+ - 新增 `--gerrit` 支持,自定义 Gerrit URL 模板
32
+
33
+ - 新增 `--out-dir` / `--out-parent` 控制输出目录
34
+
35
+ - 新增多种 `npm` demo 脚本,便于测试和演示
36
+
37
+ - `src/utils` 结构优化,使用 barrel 导出
38
+
39
+ ---
40
+
41
+ ## 📥 安装
42
+
43
+ 全局安装(推荐):
44
+
45
+ ```bash
46
+ npm i -g wukong-gitlog-cli
47
+ # 或
48
+ yarn global add wukong-gitlog-cli
49
+
50
+ # 全局运行
51
+ wukong-gitlog-cli --help
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 🚀 使用方法
57
+
58
+ ```bash
59
+ wukong-gitlog-cli [options]
60
+ ```
61
+
62
+ ### 常用参数
63
+
64
+ | 参数 | 描述 |
65
+ | -------------------- | ------------------------------------------------------------------ | --- |
66
+ | `--author <name>` | 按作者过滤 |
67
+ | `--email <email>` | 按邮箱过滤 |
68
+ | `--since <date>` | 起始日期(如 2025-01-01) |
69
+ | `--until <date>` | 结束日期 |
70
+ | `--limit <n>` | 限制提交数量 |
71
+ | `--no-merges` | 排除 merge 提交 |
72
+ | `--json` | 输出 JSON |
73
+ | `--format <type>` | 输出格式:text / excel / json(默认 text) |
74
+ | `--group-by <type>` | 分组:day / month |
75
+ | `--overtime` | 启用加班文化分析 |
76
+ | `--country <code>` | 假期:CN 或 US(默认 CN) |
77
+ | `--stats` | Excel 中包含统计 sheet |
78
+ | `--gerrit <prefix>` | Gerrit URL 模板 |
79
+ | `--gerrit-api <url>` | Gerrit API 地址(用于 changeNumber) |
80
+ | `--out <file>` | 输出文件名 |
81
+ | `--out-dir <dir>` | 输出目录 |
82
+ | `--out-parent` | 输出到父目录的 output/ |
83
+ | `--serve` | 启动本地 web 服务,查看提交统计(将在 output/data 下生成数据文件) |
84
+ | `--port <n>` | 本地 web 服务端口(默认 3000) (default: 3000) | |
85
+ | `--serve-only` | 仅启动 web 服务,不导出或分析数据(使用 output/data 中已有的数据) |
86
+ | `--version` | 显示版本号 |
87
+
88
+ ---
89
+
90
+ ## 📊 分时段(按周/月)输出
91
+
92
+ ```bash
93
+ wukong-gitlog-cli --overtime --limit 200 --format text --out commits.txt --per-period-formats csv,tab
94
+ ```
95
+
96
+ 如需导出 Excel:
97
+
98
+ ```bash
99
+ wukong-gitlog-cli --per-period-formats xlsx --per-period-excel-mode sheets
100
+ ```
101
+
102
+ 仅导出分时段文件:
103
+
104
+ ```bash
105
+ wukong-gitlog-cli --per-period-only
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 📈 启动本地 Dashboard
111
+
112
+ 分析结果会导出为:
113
+
114
+ - `output/data/commits.mjs`
115
+
116
+ - `output/data/overtime-stats.mjs`
117
+
118
+ 启动服务器:
119
+
120
+ ```bash
121
+ wukong-gitlog-cli --serve --overtime --limit 200
122
+ ```
123
+
124
+ 浏览器访问:
125
+
126
+ ```arduino
127
+ http://localhost:3000
128
+ ```
129
+
130
+ ---
131
+
132
+ ## 🔗 Gerrit 支持
133
+
134
+ 示例:
135
+
136
+ ```bash
137
+ wukong-gitlog-cli --gerrit "https://gerrit.example.com/c/project/+/{{hash}}"
138
+ ```
139
+
140
+ 若想使用 Gerrit 数字 Change Number:
141
+
142
+ ```bash
143
+ wukong-gitlog-cli --gerrit "https://gerrit.example.com/c/project/+/{{changeNumber}}" --gerrit-api https://gerrit.example.com/gerrit
144
+ ```
145
+
146
+ 支持 Basic 和 Bearer Token:
147
+
148
+ ```bash
149
+ --gerrit-auth "user:password"
150
+ --gerrit-auth "MYTOKEN"
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 📚 示例指令
156
+
157
+ 导出文本(按月分组):
158
+
159
+ ```bash
160
+ wukong-gitlog-cli --format text --group-by month
161
+ ```
162
+
163
+ 导出 Excel + Gerrit:
164
+
165
+ ```bash
166
+ wukong-gitlog-cli --format excel --stats --gerrit "https://gerrit.example.com/c/project/+/{{hash}}"
167
+ ```
168
+
169
+ 导出 JSON:
170
+
171
+ ```bash
172
+ wukong-gitlog-cli --json --out commits.json
173
+ ```
174
+
175
+ 自定义输出目录:
176
+
177
+ ```bash
178
+ wukong-gitlog-cli --out-dir ../output --format text --limit 5 --out demo.txt
179
+ ```
180
+
181
+ ---
182
+
183
+ ## ⚙️ 开发说明
184
+
185
+ - 所有输出文件默认存放于 `output/`
186
+
187
+ - 内部 `src/utils/index.mjs` 为 utils 汇总入口
188
+
189
+ - Excel 使用 exceljs,并自动添加 `autoFilter`
190
+
191
+ 推荐 `.gitignore`:
192
+
193
+ ```gitignore
194
+ output/
195
+ custom-output/
196
+ ```
197
+
198
+ ---
199
+
200
+ ## 🤝 贡献指南
201
+
202
+ 欢迎 PR!
203
+ 如果添加新参数或输出字段,请记得同步更新 README。
204
+
205
+ ---
206
+
207
+ ## 📄 License
208
+
209
+ MIT
210
+
211
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wukong-gitlog-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Advanced Git commit log exporter with Excel/JSON/TXT output, grouping, stats and CLI.",
5
5
  "keywords": [
6
6
  "git",
package/src/cli.mjs CHANGED
@@ -55,6 +55,7 @@ const main = async () => {
55
55
 
56
56
  program
57
57
  .name('git-commits')
58
+ .version(pkg.version, '-v', 'show version')
58
59
  .description('Advanced Git commit log exporter.')
59
60
  .option('--author <name>', '指定 author 名')
60
61
  .option('--email <email>', '指定 email')