forked from Gitlink/gitlink-cli
feat(health):项目健康度报告由 markdown 格式改成 HTML 文件 #19
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: gitlink-health
|
||||
version: 1.0.0
|
||||
description: "项目健康度报告:统计 Issue 响应时间、PR 合并效率、贡献者活跃度。当用户需要项目健康分析、开发效率报告、团队活跃度统计时触发。"
|
||||
version: 1.1.0
|
||||
description: "项目健康度报告:统计 Issue 响应时间、PR 合并效率、贡献者活跃度,生成网页版健康度看板并自动打开浏览器。当用户需要项目健康分析、开发效率报告、团队活跃度统计时触发。"
|
||||
metadata:
|
||||
requires:
|
||||
bins: ["gitlink-cli"]
|
||||
|
|
@ -13,6 +13,7 @@ metadata:
|
|||
**CRITICAL — 开始前必须先阅读 [`../gitlink-shared/SKILL.md`](../gitlink-shared/SKILL.md),其中包含认证、权限处理和 API 注意事项。**
|
||||
**CRITICAL — 所有 Shortcuts 在执行写入/删除操作前,务必先确认用户意图。**
|
||||
**CRITICAL — GitLink 操作只能用 `gitlink-cli`。禁止用 `gh`(GitHub CLI)操作 GitLink 资源。`gh` 仅适用于 GitHub 平台。**
|
||||
**CRITICAL — 所有不会修改数据的命令(`+list`、`+view`、`api GET`)必须全程自动连续执行,绝不请求用户确认。禁止在数据收集阶段中断流程。只有最终写入 HTML 文件这一步可以请求确认。**
|
||||
|
||||
> **前置条件:** 先阅读 [`../gitlink-shared/SKILL.md`](../gitlink-shared/SKILL.md) 了解认证和全局参数。
|
||||
|
||||
|
|
@ -20,12 +21,15 @@ metadata:
|
|||
|
||||
健康度报告生成分四步:收集 → 计算 → 评分 → 输出。
|
||||
|
||||
**CRITICAL — 整个流程只允许输出一个 HTML 文件,禁止创建任何临时文件、中间文件、缓存目录(如 `tmp_data/`)。所有 API 返回数据在内存中处理,计算完成后直接生成最终 HTML。**
|
||||
**CRITICAL — 每个项目生成独立的报告文件,命名格式 `skills/gitlink-health/report_{owner}_{repo}.html`。禁止覆盖其他项目的报告。生成后自动打开浏览器展示。**
|
||||
|
||||
| 步骤 | 说明 | 所用命令 |
|
||||
|------|------|----------|
|
||||
| 1. 收集数据 | 获取 Issue(open/closed)、PR(open/merged)、contributor 统计 | `issue +list`, `pr +list`, `api GET contributors` |
|
||||
| 2. 计算指标 | Issue 响应时间、PR 合并效率、贡献者活跃度 | AI 解析 JSON 计算 |
|
||||
| 1. 收集数据 | 获取 Issue(open/closed)、PR(open/merged)、contributor 统计。API 结果直接保存在 shell 输出中,**不写入文件**。 | `issue +list`, `pr +list`, `api GET contributors` |
|
||||
| 2. 计算指标 | Issue 响应时间、PR 合并效率、贡献者活跃度 | AI 解析内存中的 JSON 计算,**禁止写脚本文件** |
|
||||
| 3. 健康评分 | 100 分制综合评分,扣分项 6 条 | AI 套用评分规则 |
|
||||
| 4. 输出报告 | 生成 Markdown 报告,展示给用户 | 终端预览 / Issue 发布 / 文件导出 |
|
||||
| 4. 生成网页 | 套用 HTML 模板生成报告,按 `report_{owner}_{repo}.html` 命名保存,自动打开浏览器 | 写入 `skills/gitlink-health/report_{owner}_{repo}.html`,`start` / `open` 打开 |
|
||||
|
||||
## 命令参考
|
||||
|
||||
|
|
@ -105,8 +109,13 @@ PR 合并效率由**三类 PR** 共同决定,需计算**三段时间**:
|
|||
| 贡献者总数 | `contributors.author_count` | 项目总贡献者数 |
|
||||
| 每人 commits | `contributors.authors[].commits` | 按 commit 数排名 |
|
||||
| 每人增删行数 | `contributors.authors[].additions / deletions` | 代码贡献量 |
|
||||
| 每人 PR 数 / Issue 数 | PR 和 Issue 列表统计 | 在 podium 和 contributor-row 中显示 |
|
||||
| 活跃度分级 | 综合 commits + PRs + Issues | 高频 / 正常 / 低频 |
|
||||
|
||||
**CRITICAL — 每个贡献者必须同时显示 PR 数量和 Issue 数量**,格式为 `N PRs · M Issues`。
|
||||
- **Podium 前三名**(冠亚季军):`N PRs · M Issues · 🔥 高频` — 带活跃度标签。
|
||||
- **其他贡献者**(contributor-row):`N PRs · M Issues` — 不带活跃度标签。
|
||||
|
||||
活跃度分级标准:
|
||||
|
||||
| 级别 | 条件 |
|
||||
|
|
@ -144,99 +153,38 @@ PR 合并效率由**三类 PR** 共同决定,需计算**三段时间**:
|
|||
| 30-49 | 需关注 | 🟠 |
|
||||
| 0-29 | 严重 | 🔴 |
|
||||
|
||||
## 报告模板
|
||||
## 报告输出(HTML 网页)
|
||||
|
||||
### 标准模板
|
||||
### 模板文件
|
||||
|
||||
```markdown
|
||||
# 🏥 项目健康度报告
|
||||
报告使用 `skills/gitlink-health/template.html` 作为模板。AI 将计算后的指标填入模板中的 `{{PLACEHOLDER}}` 占位符,按 `report_{owner}_{repo}.html` 格式命名(如 `report_chroe_gitlink-cli.html`),生成到 `skills/gitlink-health/` 目录下。每个项目独立文件,不覆盖其他项目报告。
|
||||
|
||||
**项目**: {OWNER}/{REPO}
|
||||
**报告时间**: {DATE}
|
||||
**统计周期**: {PERIOD_DAYS} 天
|
||||
### 占位符说明
|
||||
|
||||
---
|
||||
|
||||
## 📊 综合评分
|
||||
|
||||
| 评分 | 等级 |
|
||||
|------|------|
|
||||
| {SCORE}/100 | {GRADE_ICON} {GRADE} |
|
||||
|
||||
| 扣分明细 | 扣分 | 结果 |
|
||||
|----------|------|------|
|
||||
| Issue 积压(当前 {OPEN_ISSUES} 个) | {DEDUCTION} | {ISSUE_BACKLOG_STATUS} |
|
||||
| PR 积压(当前 {OPEN_PRS} 个) | {DEDUCTION} | {PR_BACKLOG_STATUS} |
|
||||
| Issue 响应时间(平均 {RESPONSE_TIME}) | {DEDUCTION} | {RESPONSE_STATUS} |
|
||||
| PR 合并时间(平均 {MERGE_TIME}) | {DEDUCTION} | {MERGE_STATUS} |
|
||||
| 贡献者集中度(最高占比 {TOP_SHARE}) | {DEDUCTION} | {CONCENTRATION_STATUS} |
|
||||
| 近期发布(最近 {LAST_RELEASE}) | {DEDUCTION} | {RELEASE_STATUS} |
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Issue 分析
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 全部 Issue | {TOTAL_ISSUES} |
|
||||
| 已关闭 | {CLOSED_ISSUES} |
|
||||
| 未关闭 | {OPEN_ISSUES} |
|
||||
| 平均关闭时长 | {AVG_RESPONSE_TIME} |
|
||||
| 中位数关闭时长 | {MEDIAN_RESPONSE_TIME} |
|
||||
|
||||
### 按优先级分布
|
||||
|
||||
| 优先级 | 数量 | 占比 |
|
||||
| 占位符 | 来源 | 说明 |
|
||||
|--------|------|------|
|
||||
| 🔴 紧急 | {URGENT_COUNT} | {URGENT_PCT}% |
|
||||
| 🟠 高 | {HIGH_COUNT} | {HIGH_PCT}% |
|
||||
| 🟡 正常 | {NORMAL_COUNT} | {NORMAL_PCT}% |
|
||||
| 🟢 低 | {LOW_COUNT} | {LOW_PCT}% |
|
||||
| `{{OWNER}}` / `{{REPO}}` | git remote 解析 | 项目路径 |
|
||||
| `{{DATE}}` | 当前日期 | 报告生成日期 |
|
||||
| `{{PERIOD_DAYS}}` | 默认 30 | 统计周期天数 |
|
||||
| `{{SCORE}}` | 计算得出 | 综合评分 0-100 |
|
||||
| `{{SCORE_COLOR}}` | 评分映射 | #00b894(优秀) / #0984e3(良好) / #fdcb6e(一般) / #e17055(需关注) / #d63031(严重) |
|
||||
| `{{SCORE_DASH}}` | 评分计算 | SVG stroke-dasharray:`(SCORE/100*377) 377` |
|
||||
| `{{GRADE}}` | 评分映射 | 优秀 / 良好 / 一般 / 需关注 / 严重 |
|
||||
| `{{DEDUCTION_ROWS}}` | 扣分明细 | 6 行 `<tr>`,每行含指标名、实际值、扣分、状态 |
|
||||
| `{{TOTAL_ISSUES}}` 等 | 统计数据 | Issue/PR 各项数值 |
|
||||
| `{{PRIORITY_BAR}}` | 优先级分布 | 4 个 `<span>` 表示紧急/高/正常/低占比 |
|
||||
| `{{PRIORITY_LEGEND}}` | 优先级分布 | 图例说明 |
|
||||
| `{{CONTRIBUTOR_ROWS}}` | 贡献者统计 | 每人一行的表格数据 |
|
||||
| `{{SUGGESTIONS}}` | AI 生成 | 改进建议列表 |
|
||||
|
||||
---
|
||||
### 生成并打开
|
||||
|
||||
## 🔀 PR 分析
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 全部 PR | {TOTAL_PRS} |
|
||||
| 已合并 | {MERGED_PRS} |
|
||||
| 未合并 | {OPEN_PRS} |
|
||||
| 合并率 | {MERGE_RATE}% |
|
||||
| 平均合并时长 | {AVG_MERGE_TIME} |
|
||||
| 中位数合并时长 | {MEDIAN_MERGE_TIME} |
|
||||
|
||||
---
|
||||
|
||||
## 👥 贡献者活跃度
|
||||
|
||||
| 贡献者 | Commits | PRs | Issues | 增删行数 | 活跃度 |
|
||||
|---------|---------|-----|--------|----------|--------|
|
||||
| {NAME} | {COMMITS} | {PRS} | {ISSUES} | +{ADD}/-{DEL} | {ACTIVITY_ICON} {LEVEL} |
|
||||
| ... | ... | ... | ... | ... | ... |
|
||||
|
||||
**总贡献者**: {TOTAL_CONTRIBUTORS} | **总 commits**: {TOTAL_COMMITS} | **总代码变更**: +{TOTAL_ADD}/-{TOTAL_DEL}
|
||||
|
||||
---
|
||||
|
||||
## 💡 改进建议
|
||||
|
||||
{SUGGESTIONS}
|
||||
```
|
||||
|
||||
### 简化模板
|
||||
|
||||
```markdown
|
||||
# 🏥 {OWNER}/{REPO} 健康度: {SCORE}/100 {GRADE}
|
||||
|
||||
| 指标 | 数值 | 状态 |
|
||||
|------|------|------|
|
||||
| Issue 响应 | avg {RESPONSE_TIME} | {RESPONSE_STATUS} |
|
||||
| PR 合并 | avg {MERGE_TIME} | {MERGE_STATUS} |
|
||||
| 贡献者 | {ACTIVE}/{TOTAL} 活跃 | {CONTRIBUTOR_STATUS} |
|
||||
| 积压 | {OPEN_ISSUES} issues + {OPEN_PRS} PRs | {BACKLOG_STATUS} |
|
||||
| 发布 | 最新 {LAST_RELEASE} | {RELEASE_STATUS} |
|
||||
```
|
||||
1. 将计算后的数据填入模板所有占位符
|
||||
2. 写入 `skills/gitlink-health/report_{owner}_{repo}.html`(每个项目独立文件,不覆盖)
|
||||
3. 写入成功后立即根据操作系统自动打开浏览器:
|
||||
- Windows: `start skills/gitlink-health/report_{owner}_{repo}.html`
|
||||
- macOS: `open skills/gitlink-health/report_{owner}_{repo}.html`
|
||||
- Linux: `xdg-open skills/gitlink-health/report_{owner}_{repo}.html`
|
||||
|
||||
## API 注意事项
|
||||
|
||||
|
|
|
|||
|
|
@ -77,96 +77,15 @@ PR 合并效率:
|
|||
最终: 85/100(良好 🔵)
|
||||
```
|
||||
|
||||
### 第五步:生成报告草稿
|
||||
### 第五步:填充 HTML 模板
|
||||
|
||||
AI 套用模板生成并展示给用户:
|
||||
AI 读取 `skills/gitlink-health/template.html`,将计算后的指标替换所有 `{{PLACEHOLDER}}` 占位符,生成完整的 HTML 文件。
|
||||
|
||||
```markdown
|
||||
# 🏥 项目健康度报告
|
||||
### 第六步:输出报告
|
||||
|
||||
**项目**: zzx-coder/gitlink-cli
|
||||
**报告时间**: 2026-06-14
|
||||
**统计周期**: 最近 30 天
|
||||
|
||||
---
|
||||
|
||||
## 📊 综合评分
|
||||
|
||||
| 评分 | 等级 |
|
||||
|------|------|
|
||||
| 85/100 | 🔵 良好 |
|
||||
|
||||
| 扣分明细 | 扣分 | 状态 |
|
||||
|----------|------|------|
|
||||
| **核心指标** | | |
|
||||
| Issue 响应时间(样本不足) | 0 | ✅ 跳过 |
|
||||
| PR 合并时间(平均 ~3.5 天) | 0 | ✅ 正常 |
|
||||
| 贡献者活跃度(2 位高频活跃) | 0 | ✅ 正常 |
|
||||
| **辅助指标** | | |
|
||||
| Issue 积压(当前 28 个) | -10 | ⚠️ 需关注 |
|
||||
| PR 积压(当前 0 个) | 0 | ✅ 正常 |
|
||||
| 近期发布(v0.1.18, 今天) | 0 | ✅ 正常 |
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Issue 分析
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 全部 Issue | 29 |
|
||||
| 已关闭 | 1 |
|
||||
| 待处理 | 28 |
|
||||
| 平均关闭时长 | 样本不足 |
|
||||
|
||||
### 按优先级分布
|
||||
|
||||
| 优先级 | 数量 | 占比 |
|
||||
|--------|------|------|
|
||||
| 🔴 紧急 | 0 | 0% |
|
||||
| 🟠 高 | 0 | 0% |
|
||||
| 🟡 正常 | 28 | 100% |
|
||||
| 🟢 低 | 0 | 0% |
|
||||
|
||||
---
|
||||
|
||||
## 🔀 PR 分析
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 全部 PR | 11 |
|
||||
| 已合并 | 10 |
|
||||
| 待合并 | 0 |
|
||||
| 合并率 | 91% |
|
||||
| 平均合并时长 | ~3.5 天 |
|
||||
|
||||
---
|
||||
|
||||
## 👥 贡献者活跃度
|
||||
|
||||
| 贡献者 | Commits | PRs | 增/删 | 活跃度 |
|
||||
|---------|---------|-----|-------|--------|
|
||||
| mengcheng | 120 | 5 | +8500/-3200 | 🔥 高频 |
|
||||
| zzx-coder | 65 | 4 | +3200/-1800 | 🔥 高频 |
|
||||
| wbtiger | 40 | 1 | +2100/-900 | 🟢 正常 |
|
||||
| wangyue789 | 5 | 0 | +300/-150 | 🟡 低频 |
|
||||
|
||||
**总贡献者**: 4 | **总 commits**: 230+ | **代码变更**: +14100/-6050
|
||||
|
||||
---
|
||||
|
||||
## 💡 改进建议
|
||||
|
||||
- **Issue 积压(28 个)**:建议安排 Issue Triage,对 28 个 open Issue 进行分类,关闭不再需要的,优先处理高优先级 Issue
|
||||
- **样本量不足**:仅 1 个已关闭 Issue,无法评估响应时间。建议保持关注,积累更多数据后重新评估
|
||||
- **贡献者持续良好**:4 位贡献者中 2 位高频活跃,项目 bus factor 健康
|
||||
```
|
||||
|
||||
### 第六步:用户选择输出
|
||||
|
||||
生成后给用户三个选择:
|
||||
1. 终端预览(展示即可)
|
||||
2. 发布为 Issue(`gitlink-cli issue +create -t "项目健康度报告 — 2026-06-14" -b "..."`)
|
||||
3. 导出本地文件
|
||||
1. 写入 `skills/gitlink-health/report.html`(唯一的输出文件)
|
||||
2. 自动打开浏览器展示报告
|
||||
3. 如需持久化,可选发布为 Issue(内容从内存生成,不写本地文件)
|
||||
|
||||
## AI Agent 执行要点
|
||||
|
||||
|
|
@ -176,6 +95,8 @@ AI 套用模板生成并展示给用户:
|
|||
4. **指标计算容错**:样本不足时标注而非报错,新项目可能仅有少量数据
|
||||
5. **评分可按需调整**:新项目无 Release 时,"无近期发布"项自动跳过
|
||||
6. **避免 GIGO**:数据异常时(如极长的响应时间),标注并排除 outlier
|
||||
7. **HTML 生成**:读取 `template.html` → 替换所有 `{{PLACEHOLDER}}` → 写入 `report.html` → 自动 `start`/`open` 打开浏览器
|
||||
8. **禁止创建临时文件**:所有 API 数据在内存中处理,禁止创建 `tmp_data/`、脚本文件、中间 JSON 等任何多余文件。整个流程只输出一个 `report.html`。
|
||||
|
||||
## References
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,31 @@
|
|||
|
||||
> **前置条件:** 先阅读 [`../../gitlink-shared/SKILL.md`](../../gitlink-shared/SKILL.md) 了解认证、全局参数和安全规则。
|
||||
|
||||
将计算的指标和评分套用模板,生成 Markdown 格式的健康度报告,通过终端、Issue 或文件三种方式输出。
|
||||
将计算的指标和评分套用 HTML 模板,生成网页版健康度报告,自动打开浏览器展示。
|
||||
|
||||
## 输出方式
|
||||
## 输出方式(HTML 网页)
|
||||
|
||||
### 方式 1:终端预览(默认)
|
||||
**CRITICAL — 整个流程只允许输出一个文件 `skills/gitlink-health/report.html`,禁止创建任何临时文件、中间文件、缓存目录、脚本文件或额外的 Markdown 文件。**
|
||||
|
||||
直接在对话中展示 Markdown 报告,用户确认后决定是否持久化。
|
||||
### 步骤 1:填充模板
|
||||
|
||||
### 方式 2:创建报告 Issue(需认证)
|
||||
读取 `skills/gitlink-health/template.html`,将计算后的指标替换所有 `{{PLACEHOLDER}}` 占位符。占位符说明见 [SKILL.md](../SKILL.md#占位符说明)。
|
||||
|
||||
将报告发布为项目的 Review Issue,便于团队讨论和跟踪:
|
||||
### 步骤 2:写入文件
|
||||
|
||||
将填充后的 HTML 写入 `skills/gitlink-health/report.html`。
|
||||
|
||||
### 步骤 3:自动打开浏览器
|
||||
|
||||
| 平台 | 命令 |
|
||||
|------|------|
|
||||
| Windows | `start skills/gitlink-health/report.html` |
|
||||
| macOS | `open skills/gitlink-health/report.html` |
|
||||
| Linux | `xdg-open skills/gitlink-health/report.html` |
|
||||
|
||||
## 备选输出方式(仅发布 Issue,不创建额外文件)
|
||||
|
||||
### 创建报告 Issue(需认证)
|
||||
|
||||
```bash
|
||||
gitlink-cli issue +create \
|
||||
|
|
@ -21,126 +35,32 @@ gitlink-cli issue +create \
|
|||
--label 文档
|
||||
```
|
||||
|
||||
> ⚠️ 此为 Write Operation,创建前必须确认用户意图。
|
||||
> ⚠️ 此为 Write Operation,创建前必须确认用户意图。内容从内存中的计算结果直接生成,不写本地文件。
|
||||
|
||||
### 方式 3:导出 Markdown 文件(本地)
|
||||
|
||||
AI Agent 将报告内容写入本地文件:
|
||||
|
||||
```
|
||||
health_reports/health_report_{DATE}.md
|
||||
```
|
||||
|
||||
## 模板
|
||||
|
||||
### 标准模板
|
||||
|
||||
```markdown
|
||||
# 🏥 项目健康度报告
|
||||
|
||||
**项目**: {OWNER}/{REPO}
|
||||
**报告时间**: {DATE}
|
||||
**统计周期**: 最近 {PERIOD_DAYS} 天
|
||||
|
||||
---
|
||||
|
||||
## 📊 综合评分
|
||||
|
||||
| 评分 | 等级 |
|
||||
|------|------|
|
||||
| {SCORE}/100 | {GRADE_ICON} {GRADE} |
|
||||
|
||||
| 扣分明细 | 扣分 | 状态 |
|
||||
|----------|------|------|
|
||||
| Issue 积压(当前 {OPEN_ISSUES} 个) | -{DEDUCTION} | {ISSUE_BACKLOG_STATUS} |
|
||||
| PR 积压(当前 {OPEN_PRS} 个) | -{DEDUCTION} | {PR_BACKLOG_STATUS} |
|
||||
| Issue 响应时间(平均 {RESPONSE_TIME}) | -{DEDUCTION} | {RESPONSE_STATUS} |
|
||||
| PR 合并时间(平均 {MERGE_TIME}) | -{DEDUCTION} | {MERGE_STATUS} |
|
||||
| 贡献者集中度(最高占比 {TOP_SHARE}) | -{DEDUCTION} | {CONCENTRATION_STATUS} |
|
||||
| 近期发布(最新 {LAST_RELEASE}) | -{DEDUCTION} | {RELEASE_STATUS} |
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Issue 分析
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 全部 Issue | {TOTAL_ISSUES} |
|
||||
| 已关闭 | {CLOSED_ISSUES} |
|
||||
| 待处理 | {OPEN_ISSUES} |
|
||||
| 平均关闭时长 | {AVG_RESPONSE_TIME} |
|
||||
| 中位数关闭时长 | {MEDIAN_RESPONSE_TIME} |
|
||||
|
||||
### 按优先级分布
|
||||
|
||||
| 优先级 | 数量 | 占比 |
|
||||
|--------|------|------|
|
||||
| 🔴 紧急 | {URGENT_COUNT} | {URGENT_PCT}% |
|
||||
| 🟠 高 | {HIGH_COUNT} | {HIGH_PCT}% |
|
||||
| 🟡 正常 | {NORMAL_COUNT} | {NORMAL_PCT}% |
|
||||
| 🟢 低 | {LOW_COUNT} | {LOW_PCT}% |
|
||||
|
||||
---
|
||||
|
||||
## 🔀 PR 分析
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 全部 PR | {TOTAL_PRS} |
|
||||
| 已合并 | {MERGED_PRS} |
|
||||
| 待合并 | {OPEN_PRS} |
|
||||
| 合并率 | {MERGE_RATE}% |
|
||||
| 平均合并时长 | {AVG_MERGE_TIME} |
|
||||
| 中位数合并时长 | {MEDIAN_MERGE_TIME} |
|
||||
|
||||
---
|
||||
|
||||
## 👥 贡献者活跃度
|
||||
|
||||
| 贡献者 | Commits | PRs | Issues | 增/删 | 活跃度 |
|
||||
|---------|---------|-----|--------|-------|--------|
|
||||
| {NAME} | {COMMITS} | {PRS} | {ISSUES} | +{ADD}/-{DEL} | {ACTIVITY_ICON} {LEVEL} |
|
||||
|
||||
**总贡献者**: {TOTAL_CONTRIBUTORS} | **总 commits**: {TOTAL_COMMITS} | **代码变更**: +{TOTAL_ADD}/-{TOTAL_DEL}
|
||||
|
||||
---
|
||||
|
||||
## 💡 改进建议
|
||||
|
||||
{SUGGESTIONS}
|
||||
|
||||
---
|
||||
*报告由 [gitlink-health skill](...) 自动生成*
|
||||
```
|
||||
|
||||
## 占位符说明
|
||||
## 模板关键占位符
|
||||
|
||||
| 占位符 | 来源 |
|
||||
|--------|------|
|
||||
| `{OWNER}` / `{REPO}` | git remote 解析 |
|
||||
| `{DATE}` | 当前日期 |
|
||||
| `{PERIOD_DAYS}` | 数据覆盖天数(默认 30) |
|
||||
| `{SCORE}` | 综合评分(0-100) |
|
||||
| `{GRADE}` / `{GRADE_ICON}` | 评分等级 + 图标 |
|
||||
| `{OPEN_ISSUES}` | 未关闭 Issue 数量 |
|
||||
| `{CLOSED_ISSUES}` | 已关闭 Issue 数量 |
|
||||
| `{AVG_RESPONSE_TIME}` / `{MEDIAN_RESPONSE_TIME}` | Issue 响应时间 |
|
||||
| `{OPEN_PRS}` | 未合并 PR 数量 |
|
||||
| `{MERGED_PRS}` | 已合并 PR 数量 |
|
||||
| `{AVG_MERGE_TIME}` / `{MEDIAN_MERGE_TIME}` | PR 合并时间 |
|
||||
| `{MERGE_RATE}` | PR 合并率(%) |
|
||||
| `{TOTAL_CONTRIBUTORS}` | 总贡献者数 |
|
||||
| `{TOP_SHARE}` | 最高单贡献者占比 |
|
||||
| `{LAST_RELEASE}` | 最近一次 Release 时间或 "无" |
|
||||
| `{SUGGESTIONS}` | AI 生成的改进建议列表 |
|
||||
| `{{OWNER}}` / `{{REPO}}` | git remote 解析 |
|
||||
| `{{DATE}}` | 当前日期 |
|
||||
| `{{SCORE}}` | 综合评分(0-100) |
|
||||
| `{{SCORE_COLOR}}` | #00b894(90+)/#0984e3(70+)/#fdcb6e(50+)/#e17055(30+)/#d63031(<30) |
|
||||
| `{{SCORE_DASH}}` | `(SCORE/100*377) 377` |
|
||||
| `{{GRADE}}` | 优秀 / 良好 / 一般 / 需关注 / 严重 |
|
||||
| `{{DEDUCTION_ROWS}}` | 6 行 `<tr>` 扣分明细 |
|
||||
| `{{OPEN_ISSUES}}` / `{{CLOSED_ISSUES}}` 等 | 统计数据 |
|
||||
| `{{CONTRIBUTOR_ROWS}}` | 每人一行 `<tr>` |
|
||||
| `{{SUGGESTIONS}}` | `<li>` 列表 |
|
||||
|
||||
完整占位符列表参见 [SKILL.md](../SKILL.md).
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **计算**所有指标和评分(参见 [health-metrics](health-metrics.md))
|
||||
2. **填充**标准模板,生成 Markdown 报告
|
||||
3. **展示**报告草稿给用户审核
|
||||
4. **确认**用户选择输出方式(终端 / Issue / 文件)
|
||||
5. 如需发布为 Issue,确认后执行 `issue +create`
|
||||
1. **计算**所有指标和评分(参见 [health-metrics](health-metrics.md)),所有数据在内存中处理
|
||||
2. **填充** HTML 模板所有占位符
|
||||
3. **写入** `skills/gitlink-health/report.html`(唯一的输出文件)
|
||||
4. **打开** 浏览器自动展示(`start` / `open` / `xdg-open`)
|
||||
5. 如需持久化,可选发布为 Issue(内容从内存生成,不写本地文件)
|
||||
|
||||
## 注意事项
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,333 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>项目健康度报告 — {{OWNER}}/{{REPO}}</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f0f2f5;
|
||||
--card-bg: #ffffff;
|
||||
--text: #1a1a2e;
|
||||
--text-secondary: #6b7280;
|
||||
--border: #e5e7eb;
|
||||
--green: #10b981;
|
||||
--blue: #3b82f6;
|
||||
--yellow: #f59e0b;
|
||||
--orange: #e17055;
|
||||
--red: #ef4444;
|
||||
--header-bg: #0f172a;
|
||||
--accent: #8b5cf6;
|
||||
}
|
||||
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
||||
color: #fff;
|
||||
padding: 52px 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 56px;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.header::before {
|
||||
content: ''; position: absolute; top: -80px; right: -60px;
|
||||
width: 300px; height: 300px; border-radius: 50%;
|
||||
background: radial-gradient(circle, rgba(225,112,85,0.12) 0%, transparent 70%);
|
||||
}
|
||||
.header-left { flex: 1; min-width: 280px; position: relative; z-index: 1; }
|
||||
.header-left .project-icon { font-size: 40px; margin-bottom: 8px; }
|
||||
.header-left h1 { font-size: 30px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.5px; }
|
||||
.header-left .subtitle { font-size: 15px; color: #94a3b8; font-weight: 500; }
|
||||
.header-left .meta { font-size: 13px; color: #64748b; margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
|
||||
.header-left .alert-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
|
||||
.header-left .alert-tags span {
|
||||
display: inline-flex; align-items: center; gap: 5px;
|
||||
padding: 5px 12px; border-radius: 6px;
|
||||
font-size: 12px; font-weight: 600;
|
||||
}
|
||||
.alert-red { background: rgba(239,68,68,0.18); color: #ef4444; }
|
||||
.alert-orange { background: rgba(225,112,85,0.18); color: #e17055; }
|
||||
|
||||
.score-ring-wrap { flex-shrink: 0; position: relative; z-index: 1; text-align: center; }
|
||||
.score-ring { width: 150px; height: 150px; position: relative; display: inline-block; }
|
||||
.score-ring svg { transform: rotate(-90deg); }
|
||||
.score-ring .bg-circle { fill: none; stroke: #1e293b; stroke-width: 12; }
|
||||
.score-ring .fg-circle {
|
||||
fill: none; stroke-width: 12; stroke-linecap: round;
|
||||
filter: drop-shadow(0 0 8px var(--glow-color));
|
||||
}
|
||||
.score-ring .score-text {
|
||||
position: absolute; inset: 0;
|
||||
display: flex; flex-direction: column;
|
||||
align-items: center; justify-content: center;
|
||||
}
|
||||
.score-ring .score-text .num { font-size: 44px; font-weight: 800; line-height: 1; }
|
||||
.score-ring .score-text .label { font-size: 13px; color: #94a3b8; margin-top: 2px; }
|
||||
.grade-badge {
|
||||
display: inline-block; padding: 5px 16px; border-radius: 20px;
|
||||
font-size: 13px; font-weight: 700; margin-top: 8px; letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.main { max-width: 1200px; margin: 0 auto; padding: 36px 24px; }
|
||||
.section { margin-bottom: 36px; }
|
||||
.section-title {
|
||||
font-size: 20px; font-weight: 700; margin-bottom: 18px;
|
||||
padding-bottom: 10px; border-bottom: 2px solid var(--border);
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
}
|
||||
.section-title .icon { font-size: 24px; }
|
||||
|
||||
.deduction-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 14px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
|
||||
.deduction-table th, .deduction-table td { padding: 14px 22px; text-align: left; font-size: 14px; }
|
||||
.deduction-table th { background: #f8fafc; font-weight: 700; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }
|
||||
.deduction-table td { border-top: 1px solid var(--border); }
|
||||
.deduction-table .status-icon { margin-right: 6px; font-size: 16px; }
|
||||
.deduct-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-weight: 700; font-size: 13px; }
|
||||
.deduct-ok { background: #d1fae5; color: #065f46; }
|
||||
.deduct-warn { background: #fef3c7; color: #92400e; }
|
||||
.deduct-bad { background: #fee2e2; color: #991b1b; }
|
||||
.deduction-table tr.row-warn { background: #fffbeb; }
|
||||
.deduction-table tr.row-bad { background: #fef2f2; }
|
||||
|
||||
.kpi-banner {
|
||||
background: linear-gradient(135deg, #fee2e2 0%, #fff5f5 100%);
|
||||
border: 1px solid #fecaca; border-radius: 10px;
|
||||
padding: 14px 20px; margin-bottom: 20px;
|
||||
font-size: 14px; font-weight: 600; color: #991b1b;
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
}
|
||||
.kpi-banner .kpi-icon { font-size: 22px; }
|
||||
|
||||
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 22px; }
|
||||
.card {
|
||||
background: var(--card-bg); border-radius: 14px;
|
||||
padding: 26px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
|
||||
.card h3 { font-size: 17px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
|
||||
.card h3 .card-icon { font-size: 22px; }
|
||||
.card table { width: 100%; border-collapse: collapse; }
|
||||
.card table td { padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
|
||||
.card table td:last-child { text-align: right; font-weight: 700; }
|
||||
.card table tr:last-child td { border-bottom: none; }
|
||||
.metric-highlight { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; margin-left: 4px; font-weight: 700; }
|
||||
.hl-good { background: #d1fae5; color: #065f46; }
|
||||
.hl-warn { background: #fef3c7; color: #92400e; }
|
||||
.hl-bad { background: #fee2e2; color: #991b1b; }
|
||||
|
||||
.priority-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 14px 0 10px; }
|
||||
.priority-bar span { display: block; height: 100%; }
|
||||
.pg-urgent { background: var(--red); }
|
||||
.pg-high { background: var(--orange); }
|
||||
.pg-normal { background: var(--blue); }
|
||||
.pg-low { background: var(--green); }
|
||||
.priority-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
|
||||
.priority-legend span { display: flex; align-items: center; gap: 5px; }
|
||||
.priority-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
|
||||
|
||||
/* Podium */
|
||||
.podium-section { background: var(--card-bg); border-radius: 14px; padding: 30px 24px 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
|
||||
.podium-container { display: flex; align-items: flex-end; justify-content: center; gap: 20px; margin: 20px 0 32px; }
|
||||
.podium-spot { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
|
||||
.podium-spot .avatar-area { position: relative; margin-bottom: 8px; }
|
||||
.podium-spot .crown { font-size: 26px; position: absolute; top: -30px; left: 50%; transform: translateX(-50%); animation: float 2s ease-in-out infinite; }
|
||||
.podium-spot .avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: #fff; }
|
||||
.podium-spot .name { font-weight: 700; font-size: 14px; margin: 6px 0 2px; text-align: center; }
|
||||
.podium-spot .stat { font-size: 12px; color: var(--text-secondary); text-align: center; }
|
||||
.podium-block { width: 100%; border-radius: 8px 8px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
|
||||
.podium-block .rank { font-size: 28px; line-height: 1.2; }
|
||||
|
||||
.podium-champion { order: 2; }
|
||||
.podium-champion .podium-block { background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%); height: 120px; box-shadow: 0 4px 20px rgba(245,158,11,0.4); }
|
||||
.podium-champion .avatar { background: linear-gradient(135deg, #fbbf24, #f59e0b); width: 76px; height: 76px; font-size: 32px; box-shadow: 0 0 0 4px rgba(245,158,11,0.3); }
|
||||
.podium-champion .crown { color: #f59e0b; font-size: 30px; top: -34px; animation-delay: 0s; }
|
||||
|
||||
.podium-runner { order: 1; }
|
||||
.podium-runner .podium-block { background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%); height: 90px; box-shadow: 0 4px 16px rgba(148,163,184,0.3); }
|
||||
.podium-runner .avatar { background: linear-gradient(135deg, #cbd5e1, #94a3b8); box-shadow: 0 0 0 4px rgba(148,163,184,0.3); }
|
||||
.podium-runner .crown { color: #94a3b8; animation-delay: 0.3s; }
|
||||
|
||||
.podium-third { order: 3; }
|
||||
.podium-third .podium-block { background: linear-gradient(180deg, #e8a87c 0%, #cd7f32 100%); height: 64px; box-shadow: 0 4px 12px rgba(205,127,50,0.35); }
|
||||
.podium-third .avatar { background: linear-gradient(135deg, #e8a87c, #cd7f32); box-shadow: 0 0 0 4px rgba(205,127,50,0.3); }
|
||||
.podium-third .crown { color: #cd7f32; animation-delay: 0.6s; }
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translateX(-50%) translateY(0); }
|
||||
50% { transform: translateX(-50%) translateY(-4px); }
|
||||
}
|
||||
|
||||
.other-contributors { border-top: 1px solid var(--border); padding-top: 16px; }
|
||||
.other-contributors .list-header { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
|
||||
.contributor-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; transition: background 0.1s; }
|
||||
.contributor-row:hover { background: #f8fafc; }
|
||||
.contributor-row .rank-num { width: 28px; text-align: center; font-weight: 700; font-size: 14px; color: var(--text-secondary); }
|
||||
.contributor-row .avatar-small { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0; }
|
||||
.contributor-row .info { flex: 1; min-width: 0; }
|
||||
.contributor-row .info .name { font-weight: 600; font-size: 14px; }
|
||||
.contributor-row .info .detail { font-size: 12px; color: var(--text-secondary); }
|
||||
|
||||
.suggestions { list-style: none; display: grid; gap: 12px; }
|
||||
.suggestions li {
|
||||
background: var(--card-bg); border-radius: 10px; padding: 16px 20px 16px 48px;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.04); font-size: 14px;
|
||||
position: relative; border-left: 4px solid var(--accent);
|
||||
}
|
||||
.suggestions li .sug-icon { position: absolute; left: 14px; top: 15px; font-size: 18px; }
|
||||
|
||||
.data-note {
|
||||
background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
|
||||
padding: 12px 18px; margin-top: 20px; font-size: 12px; color: #166534;
|
||||
}
|
||||
|
||||
.footer { text-align: center; padding: 28px; font-size: 12px; color: #b2bec3; }
|
||||
.footer a { color: var(--accent); text-decoration: none; }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.header { padding: 32px 24px; flex-direction: column; text-align: center; }
|
||||
.podium-container { gap: 12px; }
|
||||
.podium-spot { min-width: 80px; }
|
||||
.podium-champion .podium-block { height: 90px; }
|
||||
.podium-runner .podium-block { height: 68px; }
|
||||
.podium-third .podium-block { height: 50px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div class="header-left">
|
||||
<div class="project-icon">🏠</div>
|
||||
<h1>{{OWNER}} / {{REPO}}</h1>
|
||||
<div class="subtitle">📊 项目健康度报告</div>
|
||||
<div class="meta">
|
||||
<span>📅 {{DATE}}</span>
|
||||
<span>⏳ 统计周期:{{PERIOD_DAYS}} 天</span>
|
||||
{{META_EXTRAS}}
|
||||
</div>
|
||||
<div class="alert-tags">
|
||||
{{ALERT_TAGS}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="score-ring-wrap">
|
||||
<div class="score-ring">
|
||||
<svg width="150" height="150" viewBox="0 0 150 150">
|
||||
<circle class="bg-circle" cx="75" cy="75" r="64"/>
|
||||
<circle class="fg-circle" cx="75" cy="75" r="64" stroke="{{SCORE_COLOR}}" style="--glow-color:{{SCORE_COLOR}}" stroke-dasharray="{{SCORE_DASH}}" stroke-dashoffset="0"/>
|
||||
</svg>
|
||||
<div class="score-text">
|
||||
<span class="num" style="color:{{SCORE_COLOR}}">{{SCORE}}</span>
|
||||
<span class="label">/ 100</span>
|
||||
<span class="grade-badge" style="background:{{SCORE_COLOR}}22;color:{{SCORE_COLOR}}">{{GRADE}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
|
||||
<!-- Deduction Detail -->
|
||||
<div class="section">
|
||||
<div class="section-title">
|
||||
<span class="icon">📋</span> 扣分明细
|
||||
</div>
|
||||
<table class="deduction-table">
|
||||
<thead>
|
||||
<tr><th>指标</th><th>实际值</th><th>扣分</th><th>评定</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{DEDUCTION_ROWS}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Metric Cards -->
|
||||
<div class="section">
|
||||
<div class="section-title">
|
||||
<span class="icon">📊</span> 关键指标
|
||||
</div>
|
||||
|
||||
{{KPI_BANNER}}
|
||||
|
||||
<div class="cards">
|
||||
{{ISSUE_CARD}}
|
||||
{{PR_CARD}}
|
||||
</div>
|
||||
|
||||
{{DATA_NOTE}}
|
||||
</div>
|
||||
|
||||
<!-- Podium -->
|
||||
<div class="section">
|
||||
<div class="section-title">
|
||||
<span class="icon">🏆</span> 贡献者活跃度{{PODIUM_SUBTITLE}}
|
||||
</div>
|
||||
<div class="podium-section">
|
||||
<div class="podium-container">
|
||||
{{PODIUM}}
|
||||
<!-- 每位 podium-spot 格式:
|
||||
<div class="podium-spot podium-champion">
|
||||
<div class="avatar-area">
|
||||
<div class="crown">♛</div>
|
||||
<div class="avatar">W</div>
|
||||
</div>
|
||||
<div class="name">用户名</div>
|
||||
<div class="stat">N PRs · M Issues · 🔥 高频</div>
|
||||
<!-- 注意:仅 podium 前三名标注活跃度(🔥高频/🟢正常/🟡低频),其他贡献者不标注 -->
|
||||
<div class="podium-block"><span class="rank">🥇</span></div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<div class="other-contributors">
|
||||
<div class="list-header">📋 其他贡献者{{OTHER_CONTRIBUTORS_HEADER}}</div>
|
||||
{{OTHER_CONTRIBUTORS}}
|
||||
<!-- 每条 contributor-row 格式:
|
||||
<div class="contributor-row">
|
||||
<span class="rank-num">#4</span>
|
||||
<div class="avatar-small" style="background:...;">X</div>
|
||||
<div class="info">
|
||||
<span class="name">用户名</span>
|
||||
<span class="detail">N PRs · M Issues</span>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
{{MORE_CONTRIBUTORS_HINT}}
|
||||
</div>
|
||||
|
||||
<div style="margin-top:18px;padding-top:14px;border-top:1px solid var(--border);font-size:13px;color:var(--text-secondary);text-align:center;">
|
||||
{{CONTRIBUTOR_SUMMARY}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Suggestions -->
|
||||
<div class="section">
|
||||
<div class="section-title">
|
||||
<span class="icon">💡</span> 改进建议
|
||||
</div>
|
||||
<ul class="suggestions">
|
||||
{{SUGGESTIONS}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
{{FOOTER}}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue