ai

package
v3.1.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEnabled

func IsEnabled() bool

IsEnabled returns true if AI service is enabled

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the AI service client

func GetClient

func GetClient() *Client

GetClient returns the default AI client

func NewClient

func NewClient(baseURL, token string, timeout time.Duration) *Client

NewClient creates a new AI service client

func (*Client) CheckHealth

func (c *Client) CheckHealth(ctx context.Context) (*HealthCheckResponse, error)

CheckHealth checks the health of the AI service

func (*Client) ExplainCode

func (c *Client) ExplainCode(ctx context.Context, req *ExplainCodeRequest) (*ExplainCodeResponse, error)

ExplainCode requests an AI explanation of code

func (*Client) GenerateCommitMessage

GenerateCommitMessage requests an AI-generated commit message

func (*Client) GenerateDocumentation

GenerateDocumentation requests AI-generated documentation

func (*Client) ReviewPullRequest

func (c *Client) ReviewPullRequest(ctx context.Context, req *ReviewPullRequestRequest) (*ReviewPullRequestResponse, error)

ReviewPullRequest requests an AI review of a pull request

func (*Client) SuggestLabels

func (c *Client) SuggestLabels(ctx context.Context, req *SuggestLabelsRequest) (*SuggestLabelsResponse, error)

SuggestLabels requests AI label suggestions

func (*Client) SummarizeChanges

func (c *Client) SummarizeChanges(ctx context.Context, req *SummarizeChangesRequest) (*SummarizeChangesResponse, error)

SummarizeChanges requests an AI summary of code changes

func (*Client) TriageIssue

func (c *Client) TriageIssue(ctx context.Context, req *TriageIssueRequest) (*TriageIssueResponse, error)

TriageIssue requests AI triage for an issue

type CodeReference

type CodeReference struct {
	Description string `json:"description"`
	URL         string `json:"url"`
}

CodeReference represents a reference to related documentation

type DocumentationSection

type DocumentationSection struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

DocumentationSection represents a section of documentation

type ExplainCodeRequest

type ExplainCodeRequest struct {
	RepoID    int64  `json:"repo_id"`
	FilePath  string `json:"file_path"`
	Code      string `json:"code"`
	StartLine int    `json:"start_line"`
	EndLine   int    `json:"end_line"`
	Question  string `json:"question,omitempty"`
}

ExplainCodeRequest is the request for explaining code

type ExplainCodeResponse

type ExplainCodeResponse struct {
	Explanation string          `json:"explanation"`
	KeyConcepts []string        `json:"key_concepts"`
	References  []CodeReference `json:"references"`
}

ExplainCodeResponse is the response from explaining code

type FileDiff

type FileDiff struct {
	Path     string `json:"path"`
	OldPath  string `json:"old_path,omitempty"`
	Status   string `json:"status"` // added, modified, deleted, renamed
	Patch    string `json:"patch"`
	Content  string `json:"content,omitempty"`
	Language string `json:"language,omitempty"`
}

FileDiff represents a file diff for code review

type GenerateCommitMessageRequest

type GenerateCommitMessageRequest struct {
	RepoID int64      `json:"repo_id"`
	Files  []FileDiff `json:"files"`
	Style  string     `json:"style"` // conventional, descriptive, brief
}

GenerateCommitMessageRequest is the request for generating a commit message

type GenerateCommitMessageResponse

type GenerateCommitMessageResponse struct {
	Message      string   `json:"message"`
	Alternatives []string `json:"alternatives"`
}

GenerateCommitMessageResponse is the response from generating a commit message

type GenerateDocumentationRequest

type GenerateDocumentationRequest struct {
	RepoID   int64  `json:"repo_id"`
	FilePath string `json:"file_path"`
	Code     string `json:"code"`
	DocType  string `json:"doc_type"` // function, class, module, api
	Language string `json:"language"`
	Style    string `json:"style"` // jsdoc, docstring, xml, markdown
}

GenerateDocumentationRequest is the request for generating documentation

type GenerateDocumentationResponse

type GenerateDocumentationResponse struct {
	Documentation string                 `json:"documentation"`
	Sections      []DocumentationSection `json:"sections"`
}

GenerateDocumentationResponse is the response from generating documentation

type HealthCheckResponse

type HealthCheckResponse struct {
	Healthy        bool              `json:"healthy"`
	Version        string            `json:"version"`
	ProviderStatus map[string]string `json:"provider_status"`
	License        *LicenseInfo      `json:"license,omitempty"`
}

HealthCheckResponse is the response from a health check

type LabelSuggestion

type LabelSuggestion struct {
	Label      string  `json:"label"`
	Confidence float32 `json:"confidence"`
	Reason     string  `json:"reason"`
}

LabelSuggestion represents a suggested label

type LicenseInfo

type LicenseInfo struct {
	Tier      string   `json:"tier"`
	Customer  string   `json:"customer"`
	ExpiresAt string   `json:"expires_at"`
	Features  []string `json:"features"`
	SeatCount int      `json:"seat_count"`
	IsTrial   bool     `json:"is_trial"`
}

LicenseInfo contains AI service license information

type ReviewComment

type ReviewComment struct {
	Path         string `json:"path"`
	Line         int    `json:"line"`
	EndLine      int    `json:"end_line,omitempty"`
	Body         string `json:"body"`
	Severity     string `json:"severity"` // info, warning, error, critical
	Category     string `json:"category"` // security, performance, style, bug
	SuggestedFix string `json:"suggested_fix,omitempty"`
}

ReviewComment represents a code review comment

type ReviewOptions

type ReviewOptions struct {
	CheckSecurity       bool   `json:"check_security"`
	CheckPerformance    bool   `json:"check_performance"`
	CheckStyle          bool   `json:"check_style"`
	CheckTests          bool   `json:"check_tests"`
	SuggestImprovements bool   `json:"suggest_improvements"`
	FocusAreas          string `json:"focus_areas,omitempty"`
	LanguageHints       string `json:"language_hints,omitempty"`
}

ReviewOptions contains options for code review

type ReviewPullRequestRequest

type ReviewPullRequestRequest struct {
	RepoID        int64         `json:"repo_id"`
	PullRequestID int64         `json:"pull_request_id"`
	BaseBranch    string        `json:"base_branch"`
	HeadBranch    string        `json:"head_branch"`
	Files         []FileDiff    `json:"files"`
	PRTitle       string        `json:"pr_title"`
	PRDescription string        `json:"pr_description"`
	Options       ReviewOptions `json:"options"`
}

ReviewPullRequestRequest is the request for reviewing a pull request

type ReviewPullRequestResponse

type ReviewPullRequestResponse struct {
	Summary                string           `json:"summary"`
	Comments               []ReviewComment  `json:"comments"`
	Verdict                string           `json:"verdict"` // approve, request_changes, comment
	Suggestions            []string         `json:"suggestions"`
	Security               SecurityAnalysis `json:"security"`
	EstimatedReviewMinutes int              `json:"estimated_review_minutes"`
}

ReviewPullRequestResponse is the response from reviewing a pull request

type SecurityAnalysis

type SecurityAnalysis struct {
	Issues    []SecurityIssue `json:"issues"`
	RiskScore int             `json:"risk_score"`
	Summary   string          `json:"summary"`
}

SecurityAnalysis contains security analysis results

type SecurityIssue

type SecurityIssue struct {
	Path        string `json:"path"`
	Line        int    `json:"line"`
	IssueType   string `json:"issue_type"`
	Description string `json:"description"`
	Severity    string `json:"severity"`
	Remediation string `json:"remediation"`
}

SecurityIssue represents a security issue found during review

type SuggestLabelsRequest

type SuggestLabelsRequest struct {
	RepoID          int64    `json:"repo_id"`
	Title           string   `json:"title"`
	Body            string   `json:"body"`
	AvailableLabels []string `json:"available_labels"`
}

SuggestLabelsRequest is the request for suggesting labels

type SuggestLabelsResponse

type SuggestLabelsResponse struct {
	Suggestions []LabelSuggestion `json:"suggestions"`
}

SuggestLabelsResponse is the response from suggesting labels

type SummarizeChangesRequest

type SummarizeChangesRequest struct {
	RepoID  int64      `json:"repo_id"`
	Files   []FileDiff `json:"files"`
	Context string     `json:"context"`
}

SummarizeChangesRequest is the request for summarizing changes

type SummarizeChangesResponse

type SummarizeChangesResponse struct {
	Summary          string   `json:"summary"`
	BulletPoints     []string `json:"bullet_points"`
	ImpactAssessment string   `json:"impact_assessment"`
}

SummarizeChangesResponse is the response from summarizing changes

type TriageIssueRequest

type TriageIssueRequest struct {
	RepoID          int64    `json:"repo_id"`
	IssueID         int64    `json:"issue_id"`
	Title           string   `json:"title"`
	Body            string   `json:"body"`
	ExistingLabels  []string `json:"existing_labels"`
	AvailableLabels []string `json:"available_labels"`
}

TriageIssueRequest is the request for triaging an issue

type TriageIssueResponse

type TriageIssueResponse struct {
	Priority           string   `json:"priority"` // critical, high, medium, low
	Category           string   `json:"category"` // bug, feature, question, docs
	SuggestedLabels    []string `json:"suggested_labels"`
	SuggestedAssignees []string `json:"suggested_assignees"`
	Summary            string   `json:"summary"`
	IsDuplicate        bool     `json:"is_duplicate"`
	DuplicateOf        int64    `json:"duplicate_of,omitempty"`
}

TriageIssueResponse is the response from triaging an issue

Source Files

  • client.go
  • types.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL