(&self, os: &Os, _updates: impl Write)
| 43 | |
| 44 | impl GhIssue { |
| 45 | pub async fn invoke(&self, os: &Os, _updates: impl Write) -> Result<InvokeOutput> { |
| 46 | let Some(context) = self.context.as_ref() else { |
| 47 | return Err(eyre!( |
| 48 | "report_issue: Required tool context (GhIssueContext) not set by the program." |
| 49 | )); |
| 50 | }; |
| 51 | |
| 52 | // Prepare additional details from the chat session |
| 53 | let additional_environment = [ |
| 54 | Self::get_chat_settings(context), |
| 55 | Self::get_request_ids(context), |
| 56 | Self::get_context(os, context).await, |
| 57 | ] |
| 58 | .join("\n\n"); |
| 59 | |
| 60 | // Add chat history to the actual behavior text. |
| 61 | let actual_behavior = self.actual_behavior.as_ref().map_or_else( |
| 62 | || Self::get_transcript(context), |
| 63 | |behavior| format!("{behavior}\n\n{}\n", Self::get_transcript(context)), |
| 64 | ); |
| 65 | |
| 66 | let _ = IssueCreator { |
| 67 | title: Some(self.title.clone()), |
| 68 | expected_behavior: self.expected_behavior.clone(), |
| 69 | actual_behavior: Some(actual_behavior), |
| 70 | steps_to_reproduce: self.steps_to_reproduce.clone(), |
| 71 | additional_environment: Some(additional_environment), |
| 72 | } |
| 73 | .create_url(os) |
| 74 | .await |
| 75 | .wrap_err("failed to invoke gh issue tool"); |
| 76 | |
| 77 | Ok(Default::default()) |
| 78 | } |
| 79 | |
| 80 | pub fn set_context(&mut self, context: GhIssueContext) { |
| 81 | self.context = Some(context); |
nothing calls this directly
no test coverage detected