Conversation
…nce test coverage - Replaced specific test file name with --ignored flag to run all tests - Made branch field optional in CLI args with dynamic derivation from current branch - Introduced anyhow::Result for better config loading error handling - Exposed helper functions and made struct/enum fields public in git module - Refactored main module imports and error handling with explicit ? operators - Moved LLM client setup to setup module for better organization - Added comprehensive tests for CLI parsing, config loading, Git operations, and core types - Marked live LLM tests as ignored to prevent execution without actual LLM access - Corrected spelling in prompt rules and reformatted assertions for readability
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors commitbot into a shared library + slimmer binary, improves error propagation (replacing panics with anyhow::Result), adjusts CLI/config behavior (notably branch handling), and expands integration/unit test coverage while preventing live LLM tests from running by default.
Changes:
- Introduce a
src/lib.rswith shared types/exports; updatesrc/main.rsto consume the library crate APIs. - Refactor config loading and LLM client setup to return
anyhow::Resultand propagate errors via?. - Add/expand integration tests for CLI parsing, config resolution, git utilities, and core types; mark live LLM tests as ignored.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/prompt_live.rs | Marks live LLM tests as ignored so they don’t run in normal test suites. |
| tests/lib_types.rs | Adds coverage for core exported types (FileCategory, FileChange). |
| tests/git.rs | Adds integration tests for git parsing/formatting helpers and small utilities. |
| tests/config.rs | Adds integration tests for config resolution precedence and validation errors. |
| tests/cli_basics.rs | Extends CLI tests to validate Clap parsing into Command. |
| Taskfile.yaml | Updates task commands to run all tests and run ignored prompt tests explicitly. |
| src/setup.rs | Returns Result from build_llm_client and replaces panics with errors. |
| src/main.rs | Refactors binary to use commitbot library exports and improves error propagation. |
| src/llm/prompts.rs | Fixes spelling in prompt rules strings. |
| src/llm/ollama.rs | Re-formats assertions for readability in tests. |
| src/lib.rs | Adds new library crate surface (modules, re-exports, core types). |
| src/git.rs | Exposes helpers/types publicly and moves tests out to integration tests. |
| src/config.rs | Makes config resolution return Result and returns errors instead of panicking. |
| src/cli_args.rs | Makes branch optional and expands CLI help text/examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…nce test coverage