{"id":28137357,"url":"https://github.com/hellodigua/auto-gen-tag","last_synced_at":"2026-02-18T12:31:07.335Z","repository":{"id":285900502,"uuid":"959691806","full_name":"hellodigua/auto-gen-tag","owner":"hellodigua","description":"一个 Git 标签生成工具，用于简化发版操作流程","archived":false,"fork":false,"pushed_at":"2025-04-07T01:48:42.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T20:42:48.661Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/hellodigua.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":"2025-04-03T07:42:12.000Z","updated_at":"2025-04-07T01:48:40.000Z","dependencies_parsed_at":"2025-04-03T09:36:30.470Z","dependency_job_id":null,"html_url":"https://github.com/hellodigua/auto-gen-tag","commit_stats":null,"previous_names":["hellodigua/auto-gen-tag"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hellodigua/auto-gen-tag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellodigua%2Fauto-gen-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellodigua%2Fauto-gen-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellodigua%2Fauto-gen-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellodigua%2Fauto-gen-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellodigua","download_url":"https://codeload.github.com/hellodigua/auto-gen-tag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellodigua%2Fauto-gen-tag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29578927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-05-14T16:22:36.466Z","updated_at":"2026-02-18T12:31:07.321Z","avatar_url":"https://github.com/hellodigua.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# auto-gen-tag\n\n![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)\n![License](https://img.shields.io/badge/license-MIT-green.svg)\n\n`auto-gen-tag` 是一个创建 Git 标签 的工具，用于简化发版操作流程。它通过识别最近的 Git 标签，并根据配置规则智能递增版本号，从而生成新的标签。\n\n## 📦 安装\n\n```bash\nnpm i -g auto-gen-tag\n```\n\n## 🚀 快速开始\n\n### 基本使用\n\n无需配置，直接运行：\n\n```bash\ngt\n```\n\n这将使用默认规则（`v${major}.${minor}.${patch}`）找到最新标签并递增补丁版本号。\n\n### 命令语法\n\n```bash\ngt [配置模式] [版本类型]\n```\n\n- **配置模式**：对应配置文件中 `tagPattern` 的键名（如 `default`、`test`）\n- **版本类型**：指定要递增的版本部分（`major`、`minor`、`patch`）\n\n### 示例\n\n```bash\n# 使用默认模式，递增补丁版本（v0.1.0 -\u003e v0.1.1）\ngt\n\n# 使用测试环境，递增补丁版本（test-v0.1.0 -\u003e test-v0.1.1）\ngt test\n\n# 使用生产环境，递增次要版本（release-v0.1.0 -\u003e release-v0.2.0）\ngt prod minor\n\n# 使用日期版本（v20230401 -\u003e v20230402）\ngt daily\n\n# 使用递增数字版本（v1 -\u003e v2）\ngt simple\n\n# 查看最近10个标签\ngt list -n 10\n\n# 查看包含\"test\"的标签\ngt list -p \"test\"\n\n# 显示标签详细信息\ngt list -v\n\n# 删除标签 test-0.1.3（包括远程标签）\ngt rm test-0.1.3\n\n# 删除最近创建的标签\ngt rm\n```\n\n### 配置文件\n\n在项目根目录创建 `.gentagrc` 或 `.gentagrc.json` 文件：\n\n```json\n{\n  \"tagPattern\": {\n    \"default\": \"v${major}.${minor}.${patch}\",\n    \"test\": \"test-${major}.${minor}.${patch}\",\n    \"prod\": \"release-${major}.${minor}.${patch}\",\n    \"daily\": \"v${YYYYMMDD}\",\n    \"simple\": \"v${n}\"\n  },\n  \"autoPush\": true\n}\n```\n\n### 环境变量\n\n也可以通过环境变量配置：\n\n```bash\nexport GENTAG_PATTERN=\"v${major}.${minor}.${patch}\"\nexport GENTAG_INITIAL=\"v0.1.0\"\nexport GENTAG_AUTO_PUSH=false\n```\n\n## 其他命令选项\n\n### gt list\n\n用于查看最近创建的标签\n\n```bash\ngt list [选项]\n```\n\n选项：\n\n- `-n, --number \u003cn\u003e`: 显示最近 n 个标签（默认：10）\n- `-p, --pattern \u003cpattern\u003e`: 按指定模式过滤标签\n- `-v, --verbose`: 显示详细信息，包括提交信息和日期\n\n### gt rm\n\n用于删除本地和远程的 Git 标签\n\n```bash\ngt rm [标签名称]\n```\n\n- 如果提供`标签名称`，则删除指定的标签\n- 如果不提供参数，则自动删除最近创建的标签\n\n示例：\n\n```bash\n# 删除标签 test-0.1.3\ngt rm test-0.1.3\n\n# 删除最近创建的标签\ngt rm\n```\n\n该命令将：\n\n1. 删除本地标签\n2. 若配置文件中 `autoPush` 为 `true`，则同时删除远程标签\n\n## 💡 最佳实践\n\n- **CI/CD 集成**：在构建流程中添加 `gt` 命令自动生成发布标签\n- **环境分离**：为测试和生产环境使用不同的标签前缀\n- **版本策略**：制定清晰的版本递增策略，何时递增主版本、次版本和补丁版本\n\n## Windows 系统使用说明\n\n如果遇到类似以下错误：\n\n```\ngt : 无法加载文件，因为在此系统上禁止运行脚本。\n```\n\n有两种解决方法：\n\n1. **临时解决方案**：使用 CMD 命令行（而非 PowerShell）运行 `gt` 命令\n\n2. **永久解决方案**：以管理员身份运行 PowerShell，执行以下命令放宽执行策略：\n   ```powershell\n   Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\n   ```\n\n## 📝 版本历史\n\n- **1.0.4**: 兼容 Windows\n- **1.0.3**: 修复远程标签删除问题\n- **1.0.2**: 支持删除 tag\n- **1.0.0**: 初始版本\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellodigua%2Fauto-gen-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellodigua%2Fauto-gen-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellodigua%2Fauto-gen-tag/lists"}