{"id":22696065,"url":"https://github.com/zhangwt-cn/git-daily","last_synced_at":"2025-04-12T07:50:48.656Z","repository":{"id":264110662,"uuid":"891888793","full_name":"zhangwt-cn/git-daily","owner":"zhangwt-cn","description":"基于git提交代码生成工作日报","archived":false,"fork":false,"pushed_at":"2024-11-22T06:16:37.000Z","size":28,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T03:03:35.832Z","etag":null,"topics":["daily","git"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhangwt-cn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-21T06:12:56.000Z","updated_at":"2025-03-24T08:04:00.000Z","dependencies_parsed_at":"2025-02-04T18:50:45.900Z","dependency_job_id":"cdf58e2a-3dbc-4ae5-a1e9-000b76ad81c2","html_url":"https://github.com/zhangwt-cn/git-daily","commit_stats":null,"previous_names":["zhangwt-cn/git-daily"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangwt-cn%2Fgit-daily","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangwt-cn%2Fgit-daily/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangwt-cn%2Fgit-daily/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangwt-cn%2Fgit-daily/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhangwt-cn","download_url":"https://codeload.github.com/zhangwt-cn/git-daily/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537003,"owners_count":21120688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["daily","git"],"created_at":"2024-12-10T04:13:33.588Z","updated_at":"2025-04-12T07:50:48.633Z","avatar_url":"https://github.com/zhangwt-cn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Daily 📝\n\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/zhangwt-cn/git-daily)](https://goreportcard.com/report/github.com/zhangwt-cn/git-daily)\n[![GitHub release](https://img.shields.io/github/v/release/zhangwt-cn/git-daily)](https://github.com/zhangwt-cn/git-daily/releases)\n[![License](https://img.shields.io/github/license/zhangwt-cn/git-daily)](LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)\n\n**基于 Git commit hooks 的智能工作日报生成工具**\n\n\n\n## ✨ 特性\n\n- 🔄 基于 Git post-commit hook 实现自动触发\n- 🤖 利用 AI 智能分析代码变动内容\n- 📊 生成结构化的工作日报\n- ⚙️ 支持自定义配置\n- 🚀 轻量级，低资源占用\n\n## 📦 安装\n\n### 前置条件\n\n- ✅ Git\n\n### 安装步骤\n\n#### 方法一：直接使用预编译的二进制文件（推荐） 🚀\n\n1. 从 [Release 页面](https://github.com/zhangwt-cn/git-daily/releases) 下载适合你操作系统的最新版本\n\n2. 解压下载的文件：\n```bash\n# 🪟 Windows\nunzip git-daily-windows-amd64.zip\n\n# 🐧 Linux/🍎 MacOS\ntar -xzf git-daily-linux-amd64.tar.gz\n```\n\n3. 将解压出的 `git-daily` 二进制文件复制到你的 Git 项目的 hooks 目录：\n```bash\n# 进入你的项目目录\ncd your-project\n\n# 复制 git-daily、config.json 到 .git/hooks/post-commit\ncp path/to/post-commit .git/hooks/post-commit\ncp path/to/config.json .git/hooks/config.json\n```\n\n4. 确保 hook 文件具有执行权限（Linux/MacOS）：\n```bash\nchmod +x .git/hooks/post-commit\n```\n\n#### 方法二：从源码编译（可选） 🛠️\n\n如果你有 Go 开发环境（Go 1.21.4），也可以从源码编译：\n\n1. 克隆项目并编译：\n```bash\ngit clone https://github.com/zhangwt-cn/git-daily.git\ncd git-daily\ngo build\n```\n\n2. 将编译好的二进制文件复制到你的项目的 hooks 目录：\n```bash\ncp git-daily /path/to/your-project/.git/hooks/post-commit\ncp config.json /path/to/your-project/.git/hooks/config.json\n```\n\n## 🚀 使用方法\n\n### 1️⃣ 配置\n\n在项目根目录创建 `config.json` 配置文件：\n```json\n{\n  \"openai_base_url\": \"https://api.oaipro.com/v1\",\n  \"openai_api_key\": \"sk-xxx\",\n  \"moderation_model\": \"claude-3-5-sonnet-20241022\",\n  \"daily_path\": \"\"\n}\n```\n\n### 2️⃣ 自动运行\n\n完成配置后，工具会自动在每次 commit 后运行：\n- 🔍 自动分析本次提交的代码变动\n- 🤖 使用 AI 模型生成变更说明\n- 📝 生成日报内容\n\n### 3️⃣ 输出说明\n\n默认情况下，日报将保存在项目根目录的 `daily-report.md` 文件中：\n- 📂 可以通过 `daily_path` 配置项修改输出位置\n- 🔄 每次提交后会自动更新日报内容\n\n### 4️⃣ 使用示例\n\n```bash\ngit add .\ngit commit -m \"feat: add new feature\"\n# git-daily 会自动运行并生成日报\n```\n\n## ⚙️ 配置说明\n\n配置文件 (`config.json`) 参数说明：\n\n| 参数 | 说明 | 默认值 |\n|------|------|--------|\n| `openai_base_url` | OpenAI API 基础 URL | `https://api.oaipro.com/v1` |\n| `openai_api_key` | OpenAI API 密钥 | - |\n| `moderation_model` | AI 模型选择 | `claude-3-5-sonnet-20241022` |\n| `daily_path` | 日报输出路径 | 当前目录 |\n\n## 📋 日报示例\n\n```markdown\n# Daily Git Report - 2024-11-22\n\n### Repo: git-daily\n**Commit Hash:** 5e645887f32be6129b1aef7413d000f2809df4a6\n**Date:** 2024-11-22 09:37:39\n**Message:** feat: 增加日志颜色输出\n**Analysis:**\n今日工作进展：\n1. 增强日志输出功能\n    - 通过引入日志颜色输出功能，优化了系统的可读性和使用体验。不同颜色的日志信息可以帮助开发人员和运维人员快速区分和识别关键信息、警告和错误，从而提高问题诊断效率。\n    - 具体改进方面，在终端输出中新增了红色（错误）、蓝色（信息）、绿色（成功）、黄色（警告）等颜色表示，能够使日志分析更加直观和快速，减少了人工筛选和判断时间。\n    - 此功能不仅提升了日志的友好性，同时也预见性地减少了由于信息误读带来的潜在业务风险。后续我们计划根据实际的使用反馈，进一步调整和优化颜色配置，以适应更多场景需求。\n```\n\n## 🔧 故障排除\n\n### 常见问题\n\n1. **🔴 权限问题**\n   ```bash\n   # 解决方案\n   chmod +x .git/hooks/post-commit\n   ```\n\n2. **🔴 配置文件无法读取**\n    - 确保 `config.json` 在.git/hooks目录下\n    - 检查 JSON 格式是否正确\n\n3. **🔴 Failed to fetch analysis**\n    - 验证 API 密钥是否正确\n    - 检查网络连接\n    - 确认 API 代理地址可访问\n\n\n## 🤝 贡献指南\n\n1. Fork 本项目\n2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)\n3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)\n4. 推送到分支 (`git push origin feature/AmazingFeature`)\n5. 提交 Pull Request\n\n## 📄 许可证\n\n本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情\n\n## 👥 作者\n\n- zhangwt-cn\n\n## 🙏 致谢\n\n感谢所有贡献者对本项目的支持！\n\n---\n\n\n如果这个项目对你有帮助，请给一个 ⭐️ Star ⭐️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangwt-cn%2Fgit-daily","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhangwt-cn%2Fgit-daily","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangwt-cn%2Fgit-daily/lists"}