pub struct CommitService { /* private fields */ }Expand description
Service for handling Git commit operations with AI assistance
Implementations§
Source§impl CommitService
impl CommitService
Sourcepub fn new(
config: Config,
_repo_path: &Path,
provider_name: &str,
verify: bool,
git_repo: GitRepo,
) -> Result<Self>
pub fn new( config: Config, _repo_path: &Path, provider_name: &str, verify: bool, git_repo: GitRepo, ) -> Result<Self>
Create a new CommitService instance
§Arguments
config- The configuration for the servicerepo_path- The path to the Git repository (unused but kept for API compatibility)provider_name- The name of the LLM provider to useverify- Whether to verify commitsgit_repo- An existingGitRepoinstance
§Returns
A Result containing the new CommitService instance or an error
Sourcepub fn is_remote_repository(&self) -> bool
pub fn is_remote_repository(&self) -> bool
Check if the repository is remote
Sourcepub fn check_environment(&self) -> Result<()>
pub fn check_environment(&self) -> Result<()>
Check the environment for necessary prerequisites
Sourcepub async fn get_git_info(&self) -> Result<CommitContext>
pub async fn get_git_info(&self) -> Result<CommitContext>
Get Git information for the current repository
Sourcepub async fn get_git_info_with_unstaged(
&self,
include_unstaged: bool,
) -> Result<CommitContext>
pub async fn get_git_info_with_unstaged( &self, include_unstaged: bool, ) -> Result<CommitContext>
Get Git information including unstaged changes
Sourcepub async fn get_git_info_for_commit(
&self,
commit_id: &str,
) -> Result<CommitContext>
pub async fn get_git_info_for_commit( &self, commit_id: &str, ) -> Result<CommitContext>
Get Git information for a specific commit
Sourcepub async fn generate_message(
&self,
instructions: &str,
) -> Result<GeneratedMessage>
pub async fn generate_message( &self, instructions: &str, ) -> Result<GeneratedMessage>
Sourcepub async fn generate_review_with_unstaged(
&self,
instructions: &str,
include_unstaged: bool,
) -> Result<GeneratedReview>
pub async fn generate_review_with_unstaged( &self, instructions: &str, include_unstaged: bool, ) -> Result<GeneratedReview>
Sourcepub async fn generate_review_for_commit(
&self,
instructions: &str,
commit_id: &str,
) -> Result<GeneratedReview>
pub async fn generate_review_for_commit( &self, instructions: &str, commit_id: &str, ) -> Result<GeneratedReview>
Sourcepub async fn generate_review_for_branch_diff(
&self,
instructions: &str,
base_branch: &str,
target_branch: &str,
) -> Result<GeneratedReview>
pub async fn generate_review_for_branch_diff( &self, instructions: &str, base_branch: &str, target_branch: &str, ) -> Result<GeneratedReview>
Generate a review for branch comparison
§Arguments
preset- The instruction preset to useinstructions- Custom instructions for the AIbase_branch- The base branch (e.g., “main”)target_branch- The target branch (e.g., “feature-branch”)
§Returns
A Result containing the generated code review or an error
Sourcepub async fn generate_review(
&self,
instructions: &str,
) -> Result<GeneratedReview>
pub async fn generate_review( &self, instructions: &str, ) -> Result<GeneratedReview>
Sourcepub async fn generate_pr_for_commit_range(
&self,
instructions: &str,
from: &str,
to: &str,
) -> Result<GeneratedPullRequest>
pub async fn generate_pr_for_commit_range( &self, instructions: &str, from: &str, to: &str, ) -> Result<GeneratedPullRequest>
Sourcepub async fn generate_pr_for_branch_diff(
&self,
instructions: &str,
base_branch: &str,
target_branch: &str,
) -> Result<GeneratedPullRequest>
pub async fn generate_pr_for_branch_diff( &self, instructions: &str, base_branch: &str, target_branch: &str, ) -> Result<GeneratedPullRequest>
Generate a PR description for branch comparison
§Arguments
preset- The instruction preset to useinstructions- Custom instructions for the AIbase_branch- The base branch (e.g., “main”)target_branch- The target branch (e.g., “feature-branch”)
§Returns
A Result containing the generated PR description or an error
Sourcepub fn perform_commit(&self, message: &str) -> Result<CommitResult>
pub fn perform_commit(&self, message: &str) -> Result<CommitResult>
Sourcepub fn pre_commit(&self) -> Result<()>
pub fn pre_commit(&self) -> Result<()>
Execute the pre-commit hook if verification is enabled
Sourcepub fn create_message_channel(
&self,
) -> (Sender<Result<GeneratedMessage>>, Receiver<Result<GeneratedMessage>>)
pub fn create_message_channel( &self, ) -> (Sender<Result<GeneratedMessage>>, Receiver<Result<GeneratedMessage>>)
Create a channel for message generation
Auto Trait Implementations§
impl Freeze for CommitService
impl !RefUnwindSafe for CommitService
impl Send for CommitService
impl Sync for CommitService
impl Unpin for CommitService
impl !UnwindSafe for CommitService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more