Skip to main content

format_issue

Function format_issue 

Source
pub async fn format_issue(
    provider: &dyn TokenProvider,
    title: &str,
    body: &str,
    repo: &str,
    ai_config: &AiConfig,
) -> Result<CreateIssueResponse>
Expand description

Formats a GitHub issue with AI assistance.

This function takes raw issue title and body, and uses AI to format them according to project conventions. Returns formatted title, body, and suggested labels.

This is the first step of the two-step issue creation process. Use post_issue() to post the formatted issue to GitHub.

§Arguments

  • provider - Token provider for AI provider credentials
  • title - Raw issue title
  • body - Raw issue body
  • repo - Repository name (owner/repo format) for context
  • ai_config - AI configuration (provider, model, etc.)

§Returns

CreateIssueResponse with formatted title, body, and suggested labels.

§Errors

Returns an error if:

  • AI provider token is not available from the provider
  • AI API call fails
  • Response parsing fails