@spaceflow/review-summary 0.1.0
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 +591 -0
- package/README.md +58 -0
- package/dist/index.js +73 -0
- package/package.json +32 -0
- package/src/index.ts +28 -0
- package/src/locales/en/review-summary.json +13 -0
- package/src/locales/index.ts +11 -0
- package/src/locales/zh-cn/review-summary.json +13 -0
- package/src/review-summary.service.ts +528 -0
- package/src/types.ts +115 -0
- package/tsconfig.json +5 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @spaceflow/review-summary
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@spaceflow/review-summary)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
> Spaceflow 审查统计扩展,根据时间范围统计 PR 贡献情况,按人员汇总并排序。支持输出到控制台、GitHub Issue 或 Markdown 文件。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm spaceflow install @spaceflow/review-summary
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 功能特性
|
|
15
|
+
|
|
16
|
+
- **时间范围统计** — 支持自定义日期范围或预设时间段
|
|
17
|
+
- **多维度统计** — PR 数量、代码行数、变更文件数、问题数量
|
|
18
|
+
- **综合评分** — 根据代码量和问题数量权衡计算分数
|
|
19
|
+
- **按人员排序** — 按综合分数降序排列贡献者
|
|
20
|
+
- **多种输出方式** — 控制台、GitHub Issue、Markdown 文件
|
|
21
|
+
|
|
22
|
+
## 使用
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 使用时间预设 - 统计本周
|
|
26
|
+
spaceflow review-summary -p this-week
|
|
27
|
+
|
|
28
|
+
# 使用时间预设 - 统计上月
|
|
29
|
+
spaceflow review-summary -p last-month
|
|
30
|
+
|
|
31
|
+
# 自定义日期范围
|
|
32
|
+
spaceflow review-summary -s 2026-01-01 -u 2026-01-18
|
|
33
|
+
|
|
34
|
+
# 输出到 GitHub Issue
|
|
35
|
+
spaceflow review-summary -p last-week -o issue -c
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 命令行参数
|
|
39
|
+
|
|
40
|
+
| 参数 | 简写 | 说明 |
|
|
41
|
+
| ------------------- | ---- | ------------------------------------------------------------------- |
|
|
42
|
+
| `--period <preset>` | `-p` | 时间预设(`this-week` / `last-week` / `this-month` / `last-month`) |
|
|
43
|
+
| `--since <date>` | `-s` | 起始日期(`YYYY-MM-DD` 格式) |
|
|
44
|
+
| `--until <date>` | `-u` | 截止日期(`YYYY-MM-DD` 格式) |
|
|
45
|
+
| `--output <format>` | `-o` | 输出方式(`console` / `issue` / `markdown`) |
|
|
46
|
+
| `--ci` | `-c` | 在 CI 环境中运行 |
|
|
47
|
+
| `--dry-run` | `-d` | 仅打印将要执行的操作 |
|
|
48
|
+
|
|
49
|
+
## 环境变量
|
|
50
|
+
|
|
51
|
+
| 变量 | 说明 |
|
|
52
|
+
| ------------------- | ----------------------------- |
|
|
53
|
+
| `GITHUB_TOKEN` | GitHub API Token |
|
|
54
|
+
| `GITHUB_REPOSITORY` | 仓库名称(`owner/repo` 格式) |
|
|
55
|
+
|
|
56
|
+
## 许可证
|
|
57
|
+
|
|
58
|
+
[MIT](../../LICENSE)
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { addLocaleResources, defineExtension, t } from "@spaceflow/core";
|
|
2
|
+
// The require scope
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
|
|
5
|
+
// webpack/runtime/define_property_getters
|
|
6
|
+
(() => {
|
|
7
|
+
__webpack_require__.d = (exports, definition) => {
|
|
8
|
+
for(var key in definition) {
|
|
9
|
+
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
10
|
+
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
// webpack/runtime/has_own_property
|
|
16
|
+
(() => {
|
|
17
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
18
|
+
})();
|
|
19
|
+
var __webpack_exports__ = {};
|
|
20
|
+
|
|
21
|
+
// EXPORTS
|
|
22
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
23
|
+
A: () => (/* binding */ src),
|
|
24
|
+
c: () => (/* binding */ extension)
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
;// CONCATENATED MODULE: external "@spaceflow/core"
|
|
28
|
+
|
|
29
|
+
;// CONCATENATED MODULE: ./src/locales/zh-cn/review-summary.json
|
|
30
|
+
var review_summary_namespaceObject = JSON.parse('{"description":"周期统计命令,根据时间范围统计 PR 贡献情况,按人员汇总并排序","options.preset":"时间预设: this-week(本周), last-week(上周), this-month(本月), last-month(上月), last-7-days, last-15-days, last-30-days","options.since":"开始日期 (YYYY-MM-DD 格式),与 --preset 二选一","options.until":"结束日期 (YYYY-MM-DD 格式),默认为今天","options.repository":"仓库路径 (owner/repo 格式),默认从环境变量获取","options.format":"输出格式: table, json, markdown","options.output":"输出目标: console(控制台), issue(创建 GitHub Issue), file(Markdown 文件)","options.outputFile":"输出文件路径(当 --output 为 file 时使用)","options.verbose":"详细日志级别 (1: 过程日志, 2: 详细日志)","reportOutput":"✅ 报告已输出到: {{location}}","extensionDescription":"周期统计命令,根据时间范围统计 PR 贡献情况,按人员汇总并排序"}')
|
|
31
|
+
;// CONCATENATED MODULE: ./src/locales/en/review-summary.json
|
|
32
|
+
var en_review_summary_namespaceObject = JSON.parse('{"description":"Period summary - aggregate PR contributions by time range, grouped by author","options.preset":"Time preset: this-week, last-week, this-month, last-month, last-7-days, last-15-days, last-30-days","options.since":"Start date (YYYY-MM-DD format), alternative to --preset","options.until":"End date (YYYY-MM-DD format), defaults to today","options.repository":"Repository path (owner/repo format), auto-detected from env by default","options.format":"Output format: table, json, markdown","options.output":"Output target: console, issue (create GitHub Issue), file (Markdown file)","options.outputFile":"Output file path (used when --output is file)","options.verbose":"Verbose log level (1: process logs, 2: detailed logs)","reportOutput":"✅ Report output to: {{location}}","extensionDescription":"Period summary - aggregate PR contributions by time range, grouped by author"}')
|
|
33
|
+
;// CONCATENATED MODULE: ./src/locales/index.ts
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/** review-summary 命令 i18n 资源 */ const reviewSummaryLocales = {
|
|
38
|
+
"zh-CN": review_summary_namespaceObject,
|
|
39
|
+
en: en_review_summary_namespaceObject
|
|
40
|
+
};
|
|
41
|
+
addLocaleResources("review-summary", reviewSummaryLocales);
|
|
42
|
+
|
|
43
|
+
;// CONCATENATED MODULE: ./src/index.ts
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const extension = defineExtension({
|
|
48
|
+
name: "review-summary",
|
|
49
|
+
version: "1.0.0",
|
|
50
|
+
description: t("review-summary:extensionDescription"),
|
|
51
|
+
configKey: "review-summary",
|
|
52
|
+
commands: [
|
|
53
|
+
{
|
|
54
|
+
name: "review-summary",
|
|
55
|
+
description: t("review-summary:description"),
|
|
56
|
+
options: [
|
|
57
|
+
{
|
|
58
|
+
flags: "-d, --days",
|
|
59
|
+
description: "天数"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
run: async (args, options, ctx)=>{
|
|
63
|
+
ctx.output.info("review-summary 命令暂未实现");
|
|
64
|
+
// TODO: 实现 review-summary 命令逻辑
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
/* export default */ const src = (extension);
|
|
70
|
+
|
|
71
|
+
var __webpack_exports__default = __webpack_exports__.A;
|
|
72
|
+
var __webpack_exports__extension = __webpack_exports__.c;
|
|
73
|
+
export { __webpack_exports__default as default, __webpack_exports__extension as extension };
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spaceflow/review-summary",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Spaceflow 审查统计命令,根据时间范围统计 PR 贡献情况,按人员汇总并排序",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Lydanne",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Lydanne/spaceflow.git",
|
|
10
|
+
"directory": "extensions/review-summary"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.15.0",
|
|
19
|
+
"@spaceflow/cli": "0.21.0"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@spaceflow/core": "0.3.0"
|
|
23
|
+
},
|
|
24
|
+
"spaceflow": {
|
|
25
|
+
"type": "flow",
|
|
26
|
+
"entry": "."
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "spaceflow build",
|
|
30
|
+
"dev": "spaceflow dev"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "./locales";
|
|
2
|
+
import { defineExtension } from "@spaceflow/core";
|
|
3
|
+
import { t } from "@spaceflow/core";
|
|
4
|
+
|
|
5
|
+
export const extension = defineExtension({
|
|
6
|
+
name: "review-summary",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
description: t("review-summary:extensionDescription"),
|
|
9
|
+
configKey: "review-summary",
|
|
10
|
+
commands: [
|
|
11
|
+
{
|
|
12
|
+
name: "review-summary",
|
|
13
|
+
description: t("review-summary:description"),
|
|
14
|
+
options: [
|
|
15
|
+
{
|
|
16
|
+
flags: "-d, --days",
|
|
17
|
+
description: "天数",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
run: async (args, options, ctx) => {
|
|
21
|
+
ctx.output.info("review-summary 命令暂未实现");
|
|
22
|
+
// TODO: 实现 review-summary 命令逻辑
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default extension;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Period summary - aggregate PR contributions by time range, grouped by author",
|
|
3
|
+
"options.preset": "Time preset: this-week, last-week, this-month, last-month, last-7-days, last-15-days, last-30-days",
|
|
4
|
+
"options.since": "Start date (YYYY-MM-DD format), alternative to --preset",
|
|
5
|
+
"options.until": "End date (YYYY-MM-DD format), defaults to today",
|
|
6
|
+
"options.repository": "Repository path (owner/repo format), auto-detected from env by default",
|
|
7
|
+
"options.format": "Output format: table, json, markdown",
|
|
8
|
+
"options.output": "Output target: console, issue (create GitHub Issue), file (Markdown file)",
|
|
9
|
+
"options.outputFile": "Output file path (used when --output is file)",
|
|
10
|
+
"options.verbose": "Verbose log level (1: process logs, 2: detailed logs)",
|
|
11
|
+
"reportOutput": "✅ Report output to: {{location}}",
|
|
12
|
+
"extensionDescription": "Period summary - aggregate PR contributions by time range, grouped by author"
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { addLocaleResources } from "@spaceflow/core";
|
|
2
|
+
import zhCN from "./zh-cn/review-summary.json";
|
|
3
|
+
import en from "./en/review-summary.json";
|
|
4
|
+
|
|
5
|
+
/** review-summary 命令 i18n 资源 */
|
|
6
|
+
export const reviewSummaryLocales: Record<string, Record<string, string>> = {
|
|
7
|
+
"zh-CN": zhCN,
|
|
8
|
+
en,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
addLocaleResources("review-summary", reviewSummaryLocales);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "周期统计命令,根据时间范围统计 PR 贡献情况,按人员汇总并排序",
|
|
3
|
+
"options.preset": "时间预设: this-week(本周), last-week(上周), this-month(本月), last-month(上月), last-7-days, last-15-days, last-30-days",
|
|
4
|
+
"options.since": "开始日期 (YYYY-MM-DD 格式),与 --preset 二选一",
|
|
5
|
+
"options.until": "结束日期 (YYYY-MM-DD 格式),默认为今天",
|
|
6
|
+
"options.repository": "仓库路径 (owner/repo 格式),默认从环境变量获取",
|
|
7
|
+
"options.format": "输出格式: table, json, markdown",
|
|
8
|
+
"options.output": "输出目标: console(控制台), issue(创建 GitHub Issue), file(Markdown 文件)",
|
|
9
|
+
"options.outputFile": "输出文件路径(当 --output 为 file 时使用)",
|
|
10
|
+
"options.verbose": "详细日志级别 (1: 过程日志, 2: 详细日志)",
|
|
11
|
+
"reportOutput": "✅ 报告已输出到: {{location}}",
|
|
12
|
+
"extensionDescription": "周期统计命令,根据时间范围统计 PR 贡献情况,按人员汇总并排序"
|
|
13
|
+
}
|