← 返回 Skills 市场
kidok

Git Daily Report

作者 kidok · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
90
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install git-daily-report
功能描述
发送 image-tool (所有 remote 分支) 和 voc 项目 (dev 分支) 的每日 Git 变化报告 + 代码审查(安全 + 通用)(前一天)。
使用说明 (SKILL.md)

Git 日报技能

每天自动发送 image-tool 和 voc 项目前一天的 Git 提交记录。

  • image-tool: 所有 remote 分支
  • voc-frontend / voc-backend: 仅 dev 分支

📋 项目路径

项目 路径 分支
image-tool /home/admin/ua-image/code/UA-EC-Image-Tool 所有 remote 分支
voc-frontend /home/admin/voc/code/UA-VOC-Frontend dev
voc-backend /home/admin/voc/code/UA-VOC-Backend dev

🔧 获取 Git 变化

# 获取指定日期的提交(前一天)
TARGET_DATE="2026-03-22"
START_DATE="${TARGET_DATE} 00:00:00"
END_DATE="${TARGET_DATE} 23:59:59"

cd /path/to/repo

# image-tool: 获取所有 remote 分支
REMOTE_BRANCHES=$(git branch -r | grep -v '\->' | sed 's/^[[:space:]]*//')
for branch in $REMOTE_BRANCHES; do
    echo "📍 $branch:"
    git log --since="$START_DATE" --until="$END_DATE" --oneline --no-decorate "$branch"
done

# voc 项目:仅获取 dev 分支
echo "📍 origin/dev:"
git log --since="$START_DATE" --until="$END_DATE" --oneline --no-decorate "origin/dev"

🔍 代码审查

1️⃣ 安全审查

# 获取变更的文件列表
CHANGED_FILES=$(git diff --name-only "origin/main~1" "origin/main")

for file in $CHANGED_FILES; do
    # 1. 检查硬编码密码/密钥
    rg -n "(password|passwd|pwd|secret|api_key|apikey|token|credential)\s*[=:]\s*[\"'][^\"']+[\"']" "$file"
    
    # 2. 检查硬编码 IP/URL
    rg -n "(https?://|ftp://)[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" "$file"
    
    # 3. 检查 SQL 拼接风险
    rg -n "(execute|query|cursor\.execute)\s*\(\s*[\"'].*\+.*[\"']" "$file"
    
    # 4. 检查 eval/exec 危险函数
    rg -n "\b(eval|exec|system|os\.system|subprocess\.call)\s*\(" "$file"
    
    # 5. 检查调试代码残留
    rg -n "(console\.log|debugger|print\s*\(|logging\.debug)" "$file"
    
    # 6. 检查 TODO/FIXME 标记
    rg -n "(TODO|FIXME|XXX|HACK):" "$file"
done

安全检查项:

风险类型 检查内容 严重程度
🔴 高危 硬编码密码/API 密钥/Token 严重
🔴 高危 SQL 注入风险(字符串拼接) 严重
🟡 中危 eval/exec/system 危险函数 中等
🟡 中危 硬编码内网 IP/URL 中等
🟢 低危 console.log/debugger 调试代码 轻微
🟢 低危 TODO/FIXME 技术债务 轻微

2️⃣ 通用 Code Review

for file in $CHANGED_FILES; do
    # 1. 检查长函数 (>50 行)
    # 2. 检查大文件 (>500 行)
    # 3. 检查重复代码模式
    # 4. 检查命名规范 (驼峰/下划线)
    # 5. 检查注释完整性
    # 6. 检查错误处理
    # 7. 检查边界条件
    
    # 示例:检查空 catch 块
    rg -n "catch\s*\(\s*\w+\s*\)\s*\{\s*\}" "$file"
    
    # 示例:检查魔法数字
    rg -n "[^0-9][0-9]{4,}[^0-9]" "$file" | grep -v "//"
    
    # 示例:检查 var 使用 (JS)
    rg -n "\bvar\s+\w+\s*=" "$file"
    
    # 示例:检查缺少默认值
    rg -n "process\.env\.[A-Z_]+\s*[^|]" "$file"
done

通用审查项:

类别 检查内容 建议
📐 代码结构 函数过长 (>50 行) 拆分函数
📐 代码结构 文件过大 (>500 行) 模块化拆分
📐 代码结构 嵌套过深 (>4 层) 提前返回/卫语句
🏷️ 命名规范 变量/函数命名不清晰 使用语义化命名
🏷️ 命名规范 魔法数字 提取为常量
📝 注释 缺少函数/类注释 添加文档注释
📝 注释 注释与代码不一致 更新或删除注释
⚠️ 错误处理 空 catch 块 添加日志或处理
⚠️ 错误处理 缺少边界检查 添加验证
♻️ 代码复用 重复代码 提取公共函数
🔧 最佳实践 使用 var 而非 let/const 使用块级作用域
🔧 最佳实践 硬编码配置 使用环境变量/配置

📤 发送 DingTalk 消息

使用 message 工具发送:

{
  "action": "send",
  "channel": "dingtalk",
  "target": "1923216025-1426160278",
  "message": "📊 **Git 日报 - 2026-03-22**\
\
📁 **image-tool**:\
  📍 origin/main:\
    - abc123 修复登录问题\
\
📁 **voc-frontend**:\
  📍 origin/main:\
    - 无更新\
\
📁 **voc-backend**:\
  📍 origin/main:\
    - ghi789 优化查询性能"
}

⏰ 定时任务配置

使用 cron 工具设置每天 10:00 执行:

{
  "action": "add",
  "job": {
    "name": "git-daily-report",
    "schedule": {
      "kind": "cron",
      "expr": "0 10 * * *",
      "tz": "Asia/Shanghai"
    },
    "sessionTarget": "isolated",
    "wakeMode": "now",
    "payload": {
      "kind": "agentTurn",
      "message": "你是一个 Git 日报助手。请执行以下任务:\
1. 获取昨天的日期(格式:YYYY-MM-DD)\
2. 检查以下仓库的 Git 提交记录:\
   - /home/admin/ua-image/code/UA-EC-Image-Tool (所有 remote 分支)\
   - /home/admin/voc/code/UA-VOC-Frontend (仅 dev 分支)\
   - /home/admin/voc/code/UA-VOC-Backend (仅 dev 分支)\
3. 对 image-tool,先获取所有 remote 分支列表 (git branch -r),然后遍历每个分支获取提交;对 voc 项目,直接获取 origin/dev 分支的提交\
4. 获取每个项目的变更文件列表及改动统计 (git diff --stat, git diff --numstat)\
5. 对有代码变更的项目,进行代码审查:\
   - 安全审查:硬编码密码、SQL 注入、危险函数、调试代码等\
   - 通用 Code Review:代码结构、命名规范、注释、错误处理、最佳实践等\
6. 生成格式化的报告并通过 DingTalk 发送给用户 (target: 1923216025-1426160278)\
\
报告格式要求:\
- 每个项目列出提交信息和变更文件 (+x -y)\
- 代码审查分【安全审查】和【Code Review】两部分\
- 风险等级标注 (🔴🟡🟢)\
- 汇总风险和改进建议",
      "deliver": true,
      "channel": "dingtalk",
      "to": "1923216025-1426160278"
    }
  }
}

💬 用户交互

设置 Git 日报

用户: 每天早上 10 点发送 git 日报

AI 操作:

  1. 确认当前时间和时区
  2. 调用 cron 工具创建定时任务
  3. 回复确认信息

AI 回复: ✅ 已设置 Git 日报,每天 10:00 发送 image-tool 和 voc 项目所有 remote 分支的昨日提交记录~

查询 Git 日报状态

用户: git 日报设置了吗?

AI 操作:

  1. 调用 cron 工具 action: "list" 查询任务

AI 回复:

📋 Git 日报状态:

🔄 git-daily-report - 每天 10:00

说"取消 git 日报"可删除~

取消 Git 日报

用户: 取消 git 日报

AI 操作:

  1. 调用 cron 工具 action: "list" 找到任务 ID
  2. 调用 cron 工具 action: "remove" 删除任务

AI 回复: ✅ 已取消 Git 日报任务


📝 报告格式模板

📊 **Git 日报 - {日期}**

📁 **image-tool** (origin/main):
  📝 提交:abc123 修复登录问题
  📄 变更文件 (2):
    - src/login.js (+15 -3)
    - src/api.js (+8 -1)

📁 **voc-frontend** (origin/dev):
  📝 提交:def456 新增用户组件
  📄 变更文件 (5):
    - src/components/UserForm.vue (新增)
    - src/views/UserView.vue (+120 -45)
    - src/router/index.ts (+25 -2)
    - src/types/user.ts (+10 -0)
    - src/api/user.js (+30 -5)

📁 **voc-backend** (origin/dev):
  📝 提交:ghi789 优化查询性能
  📄 变更文件 (3):
    - routes/user.js (+45 -12)
    - services/db.js (+20 -8)
    - utils/validator.js (+15 -3)

🔍 **代码审查**:

📁 **image-tool**:
变更文件:src/login.js, src/api.js

【安全审查】
- ✅ 未发现硬编码密码/密钥
- ✅ 未发现 SQL 注入风险
- ⚠️ src/login.js:15 发现 console.log 调试代码

【Code Review】
- ✅ 函数长度合理
- ✅ 命名规范清晰
- 💡 建议:提取魔法数字为常量

---

📁 **voc-frontend**:
变更文件:UserForm.vue, TestView.vue, router/index.ts, comment.ts, CommentView.vue

【安全审查】
- ✅ 未发现硬编码密码/密钥
- ✅ 未发现 SQL 注入风险
- ⚠️ TestView.vue:22 发现 console.log 调试代码

【Code Review】
- ⚠️ TestView.vue: 函数过长 (176 行),建议拆分
- ⚠️ TestForm.vue: 硬编码测试数据,建议移至 mock 文件
- 💡 建议:添加类型定义和注释

---

📁 **voc-backend**:
变更文件:11 个 Java 文件

【安全审查】
- ✅ 已清理多处 System.out.println 调试代码 👍
- ✅ 未发现硬编码密码/密钥
- ✅ 未发现 SQL 注入风险
- ✅ 未发现危险函数调用

【Code Review】
- ✅ 代码结构清晰
- ✅ 命名规范良好
- 💡 建议:添加单元测试

---

🚨 **风险汇总**:
- 🔴 高危:0 处
- 🟡 中危:2 处 (函数过长、测试数据硬编码)
- 🟢 低危:1 处 (console.log)

📈 **改动统计**:
- 总文件数:18
- 新增行数:+253
- 删除行数:-59

💡 **改进建议**:
1. 移除 TestView.vue 中的 console.log
2. 拆分 TestView.vue 中的长函数
3. 将测试数据移至 mock 文件

_Generated at {时间}_

⚠️ 注意事项

  1. 时区: 使用 Asia/Shanghai (GMT+8)
  2. 日期计算: 报告的是前一天的提交(例如 23 号早上发 22 号的)
  3. 分支覆盖:
    • image-tool: 所有 remote 分支 (origin/*)
    • voc-frontend / voc-backend: 仅 dev 分支 (origin/dev)
  4. 无更新处理: 如果项目/分支没有提交,显示「无更新」
  5. 错误处理: 如果仓库不存在或 git 命令失败,在报告中注明
  6. 代码审查:
    • 分【安全审查】和【Code Review】两部分
    • 仅对有代码变更的项目进行审查
    • 使用 git diff --name-only 获取变更文件列表
    • 优先报告🔴高危问题(密码泄露、SQL 注入等)
    • 发现高危问题时,在报告开头添加🚨警告提示
  7. 通用 Code Review 重点:
    • 代码结构:函数长度、文件大小、嵌套深度
    • 命名规范:语义化命名、避免魔法数字
    • 注释文档:函数/类注释、注释与代码一致性
    • 错误处理:空 catch 块、边界检查
    • 最佳实践:var vs let/const、环境变量配置
  8. 依赖工具: 需要安装 ripgrep (rg) 进行代码搜索
安全使用建议
Before installing, verify the following: - Confirm the repository paths (/home/admin/...) match your environment; the SKILL.md contains both placeholders and absolute paths and may need editing. - Understand who/what owns the DingTalk target (1923216025-1426160278) and how the agent authenticates to it; the skill does not declare messaging credentials or how they are protected. - The review rules will likely capture full secrets (API keys, passwords). Decide whether reports should redact or omit matched secret strings before being sent and update the scripts accordingly. - Check the git branch logic (the script uses origin/main in diff examples while voc repos target dev) and test in a safe environment first. - If you schedule the cron job, ensure it runs under a least-privilege account and that periodic autonomous sending of repository contents to an external channel is acceptable to your security/privacy policies. - If you are uncertain about the message/cron tooling or where credentials live on the platform, request implementation details or require explicit consent/authorization before the skill sends any data externally. If you cannot verify the messaging integration and intended recipients, treat this skill as potentially exposing sensitive data and avoid enabling it until those issues are resolved.
功能分析
Type: OpenClaw Skill Name: git-daily-report Version: 1.0.0 The skill automates Git activity reporting and code reviews but includes a hardcoded DingTalk recipient ID (1923216025-1426160278) for all outgoing reports. It specifically uses `ripgrep` in `SKILL.md` to search for sensitive information such as hardcoded passwords, API keys, and tokens. Sending these findings to a fixed external endpoint poses a significant risk of data exfiltration. Additionally, the skill targets specific local directory paths (e.g., `/home/admin/ua-image/code/UA-EC-Image-Tool`), suggesting it is tailored for a specific environment but highly risky if deployed in others.
能力评估
Purpose & Capability
The name/description align with the SKILL.md: it enumerates repos, collects commits and diffs, and runs basic static checks. Required binaries (git, rg, curl) are appropriate. However the instructions rely on external platform tools ('message' and 'cron') that are not declared in the metadata, and the repo paths are hard-coded to /home/admin/… which assumes a specific host layout; both are noteworthy operational assumptions.
Instruction Scope
The runtime instructions instruct the agent to read repository files under /home/admin/… and run ripgrep rules that will likely surface secrets (passwords, API keys) and then include findings in a report sent to a DingTalk target. The SKILL.md contains inconsistent placeholders (cd /path/to/repo) vs. concrete paths in the table, and CHANGED_FILES logic references origin/main even though some projects target dev. There is no instruction to redact or sanitize secrets before sending, so the agent could transmit sensitive data off-host.
Install Mechanism
This is an instruction-only skill with no install spec and no code files — low write-to-disk risk. It depends on existing binaries (git, rg, curl) which is appropriate and proportional.
Credentials
The skill requests no environment variables or credentials, yet it will read local repository files and send reports externally to a DingTalk target ID via an unspecified 'message' tool. Because it searches for and may reveal secrets, the lack of declared messaging credentials or a redaction/privacy policy is a mismatch: sending potentially sensitive data to an external channel without specifying how that channel is authorized or protected is a proportionality/privacy concern.
Persistence & Privilege
The SKILL.md includes cron job instructions to schedule daily autonomous runs. 'always' is false, so it won't be force-included, but once scheduled it will periodically execute and send reports without further user action. This persistence is reasonable for a scheduled report feature, but increases the impact of any accidental secret disclosure — confirm scheduling runs under an appropriately scoped account and that the target channel is intended.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install git-daily-report
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /git-daily-report 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: Automates daily Git commit reports and code review for image-tool and voc projects. - Sends daily Git commit summaries for all remote branches of image-tool, and dev branch for voc-frontend/voc-backend. - Performs automated code review, covering security checks (like hardcoded credentials, SQL injection) and general code quality. - Delivers formatted reports via DingTalk, listing commits, file changes, review results, and improvement suggestions. - Supports user commands to schedule, query, or cancel daily report delivery. - Provides detailed report templates and setup instructions, including cron scheduling and tool dependencies.
元数据
Slug git-daily-report
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Git Daily Report 是什么?

发送 image-tool (所有 remote 分支) 和 voc 项目 (dev 分支) 的每日 Git 变化报告 + 代码审查(安全 + 通用)(前一天)。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 90 次。

如何安装 Git Daily Report?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install git-daily-report」即可一键安装,无需额外配置。

Git Daily Report 是免费的吗?

是的,Git Daily Report 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Git Daily Report 支持哪些平台?

Git Daily Report 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Git Daily Report?

由 kidok(@kidok)开发并维护,当前版本 v1.0.0。

💬 留言讨论