
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
generator-commit-message
Advanced tools
基于 AI 的 Git Commit Message 生成工具,可以根据 git diff 的内容自动生成规范的 commit message。
基于 AI 的 Git Commit Message 生成工具,可以根据 git diff 的内容自动生成规范的 commit message。
npm install -g generator-commit-message
npx generator-commit-message flow-xxxx
在项目根目录创建 .env 文件并配置必要的环境变量:
# .env
OPENAI_API_KEY=your_api_key_here
BASE_URL=your_api_base_url_here
MODEL=gpt-3.5-turbo
# 翻译功能配置(可选)
YOUDAO_APP_KEY=your_youdao_app_key
YOUDAO_APP_SECRET=your_youdao_app_secret
或者直接设置环境变量:
export OPENAI_API_KEY=your_api_key_here
export BASE_URL=your_api_base_url_here
export MODEL=gpt-3.5-turbo
export YOUDAO_APP_KEY=your_youdao_app_key
export YOUDAO_APP_SECRET=your_youdao_app_secret
在你的 git 项目目录下,当有未提交的变更时:
# 使用全局安装的命令
gcm flow-22914
# 或使用 npx(无需全局安装)
npx gcm flow-22914
# 或者使用完整包名
npx generator-commit-message flow-22914
# 使用翻译功能
trans "Hello world"
# 或交互式使用
trans
工具会自动执行以下步骤:
git diff 内容,分析代码变更git add . && git commitgit push工具生成的 commit message 遵循以下格式:
<type>(<flow-id>): <简短的变更描述>
- <详细变更点1>
- <详细变更点2>
- <详细变更点3>
- <变更影响和意义总结>
| Type | 说明 | 示例 |
|---|---|---|
feat | 新功能 | feat(flow-22914): 新增用户登录功能 |
fix | 修复问题 | fix(flow-22914): 修复购物车数量更新问题 |
docs | 文档变更 | docs(flow-22914): 更新 API 使用文档 |
style | 代码格式 | style(flow-22914): 统一代码缩进格式 |
refactor | 代码重构 | refactor(flow-22914): 重构用户服务模块 |
perf | 性能优化 | perf(flow-22914): 优化首页加载性能 |
test | 测试相关 | test(flow-22914): 添加用户模块单元测试 |
chore | 构建/工具 | chore(flow-22914): 更新构建脚本配置 |
| 变量名 | 必需 | 说明 | 示例 |
|---|---|---|---|
OPENAI_API_KEY | ✅ | OpenAI API 密钥 | sk-xxxxxxxxxxxx |
BASE_URL | ✅ | API 服务地址 | https://api.openai.com |
MODEL | ✅ | 使用的 AI 模型 | gpt-3.5-turbo |
YOUDAO_APP_KEY | ❌ | 有道云翻译应用ID | xxxxxxxx |
YOUDAO_APP_SECRET | ❌ | 有道云翻译应用密钥 | xxxxxxxxxxxxxxxx |
# 修改了现有文件后
$ gcmsg flow-22914
生成的 commit message:
fix(flow-22914): 修复购物车数量更新时的状态同步问题
- 解决了购物车组件在数量变更时状态不同步的问题
- 优化了购物车数据更新的时序处理逻辑
- 修复了并发更新导致的数据不一致问题
- 确保购物车状态在各个组件间的正确同步
✅ 已复制到剪贴板!
? 是否执行 commit?(default no) (y/N)
# 添加了新文件后
$ gcmsg flow-22914
生成的 commit message:
feat(flow-22914): 新增用户权限管理模块
- 新增了 UserPermission.vue 组件,实现权限列表展示功能
- 添加了权限查询、编辑和删除的交互逻辑
- 集成了角色权限的动态配置功能
- 提升了系统的权限管理灵活性和用户体验
✅ 已复制到剪贴板!
? 是否执行 commit?(default no) (y/N)
# 直接翻译文本
$ trans "Hello world"
正在翻译...
原文: Hello world
译文: 你好世界
# 交互式翻译
$ trans
? 请输入要翻译的文本: Hello world
? 请选择翻译方向: 自动检测 → 中文
正在翻译...
原文: Hello world
译文: 你好世界
A: 确保在 git 项目的根目录或子目录中运行命令。
A: 检查 .env 文件是否存在且配置正确,或确保环境变量已正确设置。
A:
BASE_URL 是否正确OPENAI_API_KEY 是否有效A: 确保工作目录中有未提交的变更(git status 显示有修改或新增的文件)。
A: 在 macOS 上需要 pbcopy 命令支持,该功能在其他操作系统上可能需要额外配置。
A: 确保已正确配置有道云翻译API的密钥,可在 .env 文件或全局 .gcm-config 文件中设置。
ISC
chaowei.hou - newweber@163.com
如果这个工具对您有帮助,请给个 ⭐️ Star!
FAQs
基于 AI 的 Git Commit Message 生成工具,可以根据 git diff 的内容自动生成规范的 commit message。
The npm package generator-commit-message receives a total of 0 weekly downloads. As such, generator-commit-message popularity was classified as not popular.
We found that generator-commit-message demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.