diff --git a/CHANGELOG.md b/CHANGELOG.md index cf85986..021249e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 暂无。 +## [0.5.0] - 2026-07-24 + +### ✨ 新功能 +- `commit` 命令新增 `.gitignore` 文件过滤:自动暂存与 `--all` 模式下自动跳过被 `.gitignore` 规则匹配的文件,并清理索引中已被忽略的已跟踪文件,暂存完成后列出被移除的文件 +- `tag` 命令新增 `-A, --auto` 模式:优先从 `Cargo.toml`/`pyproject.toml` 读取项目版本,回退到基于 commit 的语义化升级分析(与 `--bump` 互斥) +- `changelog` 命令在未指定 `--from` 时,自动检测现有 changelog 中最高版本对应的 tag 作为起始点 +- 新增 `parse_changelog_versions()`,按 semver 降序提取 changelog 中已有的版本 +- 新增 `sort_tags_by_semver()`,取代纯时间排序,按语义版本正确排序标签 + +### 🐞 错误修复 +- 修复 `get_tags()` 对 annotated tag 的解析:改用 `find_object`+`peel_to_commit` 正确取得标签指向的 commit +- 修复 `changelog` 写入时 `insert_changelog_entry` 覆盖已有章节的问题,现保留现有内容并按版本插入新条目 + +### 📚 文档 +- 同步更新 README(中/英文):补充 `--think`、`tag --auto` 选项说明,移除已废弃的 `--prepend` 参数,修正 `set-llm` 的 `--base-url` 选项名 + +### 🔧 其他变更 +- 新增 `TagInfo::version_name()` 与 `GitRepo::find_tag_by_version()` 辅助方法 +- 新增 `tests/gitignore_tests.rs`,包含 7 个测试覆盖 `.gitignore` 过滤逻辑 + ## [0.4.0] - 2026-07-16 ### ✨ 新功能 diff --git a/Cargo.toml b/Cargo.toml index 47ad09d..ba6af9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "quicommit" -version = "0.4.1" +version = "0.5.0" edition = "2024" authors = ["Sidney Zhang "] description = "A powerful Git assistant tool with AI-powered commit/tag/changelog generation" diff --git a/README.md b/README.md index e21b377..b8c8db6 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ quicommit commit # Manual commit quicommit commit --manual -t feat -m "add new feature" -# Stage all and commit +# Stage all and commit (skips .gitignore-matched files automatically) quicommit commit -a # Skip confirmation @@ -72,16 +72,24 @@ quicommit commit --yes # Use date-based commit message quicommit commit --date +# Enable LLM thinking/reasoning mode for this commit +quicommit commit --think + # Push after committing quicommit commit --push ``` +When staging changes (auto-stage or `--all`), files matched by `.gitignore` rules are skipped and any ignored files already in the index are removed; the skipped list is printed for review. + ### Create Tag ```bash # Auto-detect version bump quicommit tag +# Auto-detect version from Cargo.toml/pyproject.toml, fall back to commit analysis +quicommit tag --auto + # Specify bump type quicommit tag --bump minor @@ -98,11 +106,14 @@ quicommit tag --push ### Generate Changelog ```bash -# Generate for unreleased changes +# Generate for unreleased changes (auto-detects --from from the highest version in the existing changelog) quicommit changelog # Generate for specific version -quicommit changelog -v 1.0.0 +quicommit changelog --version 1.0.0 + +# Generate from a specific tag +quicommit changelog --from v0.9.0 # AI-generate changelog quicommit changelog --generate @@ -222,7 +233,7 @@ quicommit profile token ```bash # Configure Ollama (local) quicommit config set-llm ollama -quicommit config set-llm ollama --url http://localhost:11434 --model llama2 +quicommit config set-llm ollama --base-url http://localhost:11434 --model llama2 # Configure OpenAI quicommit config set-llm openai @@ -309,13 +320,14 @@ quicommit config reset --force | `-b, --breaking` | Mark as breaking change | | `-d, --date` | Use date-based commit message | | `--manual` | Manual input, skip AI | -| `-a, --all` | Stage all changes | +| `-a, --all` | Stage all changes (skips `.gitignore`-matched files) | | `-S, --sign` | GPG sign commit | | `--amend` | Amend previous commit | | `--dry-run` | Show without committing | | `--conventional` | Use Conventional Commits format | | `--commitlint` | Use commitlint format | | `--no-verify` | Skip commit message verification | +| `-t, --think` | Enable LLM thinking/reasoning mode (overrides config) | | `-y, --yes` | Skip confirmation | | `--push` | Push after committing | | `--remote` | Specify remote repository (default: origin) | @@ -326,6 +338,7 @@ quicommit config reset --force |--------|-------------| | `-n, --name` | Tag name | | `-b, --bump` | Version bump (major/minor/patch) | +| `-A, --auto` | Auto-detect version from Cargo.toml/pyproject.toml, fall back to commit analysis (conflicts with `--bump`) | | `-m, --message` | Tag message | | `-g, --generate` | AI-generate message | | `-S, --sign` | GPG sign tag | @@ -334,6 +347,7 @@ quicommit config reset --force | `-p, --push` | Push to remote | | `-r, --remote` | Specify remote repository (default: origin) | | `--dry-run` | Dry run | +| `-t, --think` | Enable LLM thinking/reasoning mode (overrides config) | | `-y, --yes` | Skip confirmation | ### Changelog Options @@ -341,16 +355,16 @@ quicommit config reset --force | Option | Description | |--------|-------------| | `-o, --output` | Output file path | -| `-v, --version` | Generate for specific version | -| `-f, --from` | Generate from specific tag | +| `--version` | Generate for specific version | +| `-f, --from` | Generate from specific tag (auto-detected from existing changelog if omitted) | | `-t, --to` | Generate to specific ref (default: HEAD) | | `-i, --init` | Initialize new changelog file | | `-g, --generate` | AI-generate changelog | -| `--prepend` | Prepend to existing changelog | | `--include-hashes` | Include commit hashes | | `--include-authors` | Include authors | | `--format` | Format (keep-a-changelog, github-releases) | | `--dry-run` | Dry run (output to stdout) | +| `--think` | Enable LLM thinking/reasoning mode (overrides config) | | `-y, --yes` | Skip confirmation | ## Configuration File diff --git a/readme_zh.md b/readme_zh.md index 03132a3..0eb6e70 100644 --- a/readme_zh.md +++ b/readme_zh.md @@ -62,7 +62,7 @@ quicommit commit # 手动提交 quicommit commit --manual -t feat -m "添加新功能" -# 暂存所有文件并提交 +# 暂存所有文件并提交(自动跳过 .gitignore 匹配的文件) quicommit commit -a # 跳过确认直接提交 @@ -71,16 +71,24 @@ quicommit commit --yes # 使用日期格式的提交信息 quicommit commit --date +# 为本次提交启用 LLM 思考/推理模式 +quicommit commit --think + # 提交后推送到远程 quicommit commit --push ``` +在暂存更改时(自动暂存或 `--all` 模式),会自动跳过匹配 `.gitignore` 规则的文件,并清理索引中已被忽略的已跟踪文件,最后打印出被跳过的文件列表。 + ### 创建标签 ```bash # 自动检测版本升级 quicommit tag +# 从 Cargo.toml/pyproject.toml 自动检测版本,回退到基于 commit 的分析 +quicommit tag --auto + # 指定版本升级类型 quicommit tag --bump minor @@ -97,11 +105,14 @@ quicommit tag --push ### 生成变更日志 ```bash -# 生成未发布变更的变更日志 +# 生成未发布变更的变更日志(未指定 --from 时自动从现有 changelog 的最高版本检测) quicommit changelog # 为特定版本生成 -quicommit changelog -v 1.0.0 +quicommit changelog --version 1.0.0 + +# 从指定标签生成 +quicommit changelog --from v0.9.0 # AI生成变更日志 quicommit changelog --generate @@ -216,7 +227,7 @@ quicommit profile token ```bash # 配置Ollama(本地) quicommit config set-llm ollama -quicommit config set-llm ollama --url http://localhost:11434 --model llama2 +quicommit config set-llm ollama --base-url http://localhost:11434 --model llama2 # 配置OpenAI quicommit config set-llm openai @@ -303,13 +314,14 @@ quicommit config reset --force | `-b, --breaking` | 标记为破坏性变更 | | `-d, --date` | 使用日期格式的提交信息 | | `--manual` | 手动输入,跳过AI生成 | -| `-a, --all` | 暂存所有更改 | +| `-a, --all` | 暂存所有更改(自动跳过 `.gitignore` 匹配的文件) | | `-S, --sign` | GPG签名提交 | | `--amend` | 修改上一次提交 | | `--dry-run` | 试运行,不实际提交 | | `--conventional` | 使用Conventional Commits格式 | | `--commitlint` | 使用commitlint格式 | | `--no-verify` | 不验证提交信息 | +| `-t, --think` | 启用 LLM 思考/推理模式(覆盖配置) | | `-y, --yes` | 跳过确认提示 | | `--push` | 提交后推送到远程 | | `--remote` | 指定远程仓库(默认:origin) | @@ -320,6 +332,7 @@ quicommit config reset --force |------|------| | `-n, --name` | 标签名称 | | `-b, --bump` | 版本升级类型(major/minor/patch) | +| `-A, --auto` | 从 Cargo.toml/pyproject.toml 自动检测版本,回退到基于 commit 的分析(与 `--bump` 互斥) | | `-m, --message` | 标签信息 | | `-g, --generate` | AI生成标签信息 | | `-S, --sign` | GPG签名标签 | @@ -328,6 +341,7 @@ quicommit config reset --force | `-p, --push` | 推送到远程 | | `-r, --remote` | 指定远程仓库(默认:origin) | | `--dry-run` | 试运行 | +| `-t, --think` | 启用 LLM 思考/推理模式(覆盖配置) | | `-y, --yes` | 跳过确认提示 | ### changelog命令选项 @@ -335,16 +349,16 @@ quicommit config reset --force | 选项 | 说明 | |------|------| | `-o, --output` | 输出文件路径 | -| `-v, --version` | 为特定版本生成 | -| `-f, --from` | 从指定标签生成 | +| `--version` | 为特定版本生成 | +| `-f, --from` | 从指定标签生成(未指定时自动从现有 changelog 的最高版本检测) | | `-t, --to` | 生成到指定引用(默认:HEAD) | | `-i, --init` | 初始化新的变更日志文件 | | `-g, --generate` | AI生成变更日志 | -| `--prepend` | 添加到现有变更日志开头 | | `--include-hashes` | 包含提交哈希 | | `--include-authors` | 包含作者信息 | | `--format` | 格式(keep-a-changelog、github-releases) | | `--dry-run` | 试运行(输出到stdout) | +| `--think` | 启用 LLM 思考/推理模式(覆盖配置) | | `-y, --yes` | 跳过确认提示 | ## 配置文件