Skip to content

Refactor CLI and config handling, improve error propagation, and enha… - #26

Merged
MikeGarde merged 2 commits into
mainfrom
fix/tests
Apr 9, 2026
Merged

Refactor CLI and config handling, improve error propagation, and enha…#26
MikeGarde merged 2 commits into
mainfrom
fix/tests

Conversation

@MikeGarde

Copy link
Copy Markdown
Owner

…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

…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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs with shared types/exports; update src/main.rs to consume the library crate APIs.
  • Refactor config loading and LLM client setup to return anyhow::Result and 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.

Comment thread src/cli_args.rs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MikeGarde
MikeGarde merged commit a926b57 into main Apr 9, 2026
2 checks passed
@MikeGarde
MikeGarde deleted the fix/tests branch April 9, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants