pub enum TaskContext {
Staged {
include_unstaged: bool,
},
Commit {
commit_id: String,
},
Range {
from: String,
to: String,
},
Changelog {
from: String,
to: String,
version_name: Option<String>,
date: String,
},
Amend {
original_message: String,
},
Discover,
}Expand description
Validated, structured context for agent tasks.
This enum represents the different modes of operation for code analysis, with validation built into the constructors.
Variants§
Staged
Analyze staged changes (optionally including unstaged)
Commit
Analyze a single commit
Range
Analyze a range of commits or branch comparison
Changelog
Generate changelog or release notes with version metadata
Fields
Amend
Amend the previous commit with staged changes The agent sees the combined diff from HEAD^1 to staged state
Discover
Let the agent discover context via tools (default for gen command)
Implementations§
Source§impl TaskContext
impl TaskContext
Sourcepub fn for_gen() -> Self
pub fn for_gen() -> Self
Create context for the gen (commit message) command. Always uses staged changes only.
Sourcepub fn for_amend(original_message: String) -> Self
pub fn for_amend(original_message: String) -> Self
Create context for amending the previous commit. The agent will see the combined diff from HEAD^1 to staged state.
Sourcepub fn for_review(
commit: Option<String>,
from: Option<String>,
to: Option<String>,
include_unstaged: bool,
) -> Result<Self>
pub fn for_review( commit: Option<String>, from: Option<String>, to: Option<String>, include_unstaged: bool, ) -> Result<Self>
Create context for the review command with full parameter validation.
Validates:
--fromrequires--tofor range comparison--commitis mutually exclusive with--from/--to--include-unstagedis incompatible with range comparisons
Sourcepub fn for_pr(from: Option<String>, to: Option<String>) -> Self
pub fn for_pr(from: Option<String>, to: Option<String>) -> Self
Create context for the PR command.
PR command is more flexible - all parameter combinations are valid:
from+to: Explicit range/branch comparisonfromonly: Comparefrom..HEADtoonly: Comparemain..to- Neither: Compare
main..HEAD
Sourcepub fn for_changelog(
from: String,
to: Option<String>,
version_name: Option<String>,
date: Option<String>,
) -> Self
pub fn for_changelog( from: String, to: Option<String>, version_name: Option<String>, date: Option<String>, ) -> Self
Create context for changelog/release-notes commands.
These always require a from reference; to defaults to HEAD.
Automatically sets today’s date if not provided.
Sourcepub fn to_prompt_context(&self) -> String
pub fn to_prompt_context(&self) -> String
Generate a human-readable prompt context string for the agent.
Sourcepub fn diff_hint(&self) -> String
pub fn diff_hint(&self) -> String
Generate a hint for which git_diff call the agent should make.
Sourcepub fn is_range(&self) -> bool
pub fn is_range(&self) -> bool
Check if this context represents a range comparison (vs staged/single commit)
Sourcepub fn includes_unstaged(&self) -> bool
pub fn includes_unstaged(&self) -> bool
Check if this context involves unstaged changes
Sourcepub fn original_message(&self) -> Option<&str>
pub fn original_message(&self) -> Option<&str>
Get the original commit message if this is an amend context
Trait Implementations§
Source§impl Clone for TaskContext
impl Clone for TaskContext
Source§fn clone(&self) -> TaskContext
fn clone(&self) -> TaskContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaskContext
impl Debug for TaskContext
Source§impl Default for TaskContext
impl Default for TaskContext
Source§fn default() -> TaskContext
fn default() -> TaskContext
Source§impl<'de> Deserialize<'de> for TaskContext
impl<'de> Deserialize<'de> for TaskContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TaskContext
impl Display for TaskContext
Auto Trait Implementations§
impl Freeze for TaskContext
impl RefUnwindSafe for TaskContext
impl Send for TaskContext
impl Sync for TaskContext
impl Unpin for TaskContext
impl UnwindSafe for TaskContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.