types

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIAnalysis added in v1.0.2

type CIAnalysis struct {
	Check            string `json:"check" yaml:"check"`
	Status           string `json:"status" yaml:"status"`
	Cause            string `json:"cause" yaml:"cause"`
	Evidence         string `json:"evidence" yaml:"evidence"`
	Fix              string `json:"fix" yaml:"fix"`
	NextVerification string `json:"next_verification" yaml:"next_verification"`
	Confidence       string `json:"confidence" yaml:"confidence"`
}

CIAnalysis records what the reviewer can and cannot conclude about a check. The model must not invent a failure cause when the supplied context contains only a check name or status.

type CacheConfig

type CacheConfig struct {
	// Enabled controls whether caching is active
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Directory specifies cache storage location
	Directory string `json:"directory" yaml:"directory"`

	// MaxAge specifies maximum cache age in hours (0 = no limit)
	MaxAge int `json:"max_age,omitempty" yaml:"max_age,omitempty"`
}

CacheConfig configures incremental build caching

type Config

type Config struct {
	Version       string              `json:"version" yaml:"version"`
	LLM           LLMConfig           `json:"llm" yaml:"llm"`
	Prompts       map[string]string   `json:"prompts,omitempty" yaml:"prompts,omitempty"`
	Rules         map[string]string   `json:"rules,omitempty" yaml:"rules,omitempty"`
	Outputs       OutputConfig        `json:"outputs" yaml:"outputs"`
	Features      FeaturesConfig      `json:"features" yaml:"features"`
	Documentation DocumentationConfig `json:"documentation,omitempty" yaml:"documentation,omitempty"`
}

Config represents the complete AurumCode configuration

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a configuration with sensible defaults

func (*Config) Validate

func (c *Config) Validate() error

Validate reports every inconsistency that would make the configuration unusable. Decoding YAML never rejects an out-of-range number or a path that climbs out of the repository, so a Config the caller did not build itself is only trustworthy after this returns nil.

type CostTracker

type CostTracker interface {
	Allow(costUSD float64) bool
	Spend(costUSD float64) error
	Remaining() float64
}

CostTracker defines the interface for budget management

type CoverageReport

type CoverageReport struct {
	LineCoverage   float64 `json:"line_coverage" yaml:"line_coverage"`
	BranchCoverage float64 `json:"branch_coverage" yaml:"branch_coverage"`
	TotalLines     int     `json:"total_lines" yaml:"total_lines"`
	CoveredLines   int     `json:"covered_lines" yaml:"covered_lines"`
}

CoverageReport represents test coverage metrics

type DeployConfig

type DeployConfig struct {
	// Enabled controls whether auto-deployment is active
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Target specifies deployment target: "github-pages", "netlify", "vercel"
	Target string `json:"target" yaml:"target"`

	// Branch specifies git branch for deployment (e.g., "gh-pages")
	Branch string `json:"branch" yaml:"branch"`

	// BaseURL is the site base URL for deployment
	BaseURL string `json:"base_url,omitempty" yaml:"base_url,omitempty"`
}

DeployConfig configures documentation deployment

type Diff

type Diff struct {
	Files []DiffFile `json:"files" yaml:"files"`
}

Diff represents the complete parsed diff

type DiffFile

type DiffFile struct {
	Path  string     `json:"path" yaml:"path"`
	Lang  string     `json:"lang" yaml:"lang"`
	Hunks []DiffHunk `json:"hunks" yaml:"hunks"`
}

DiffFile represents a single file in a diff

type DiffHunk

type DiffHunk struct {
	OldStart int      `json:"old_start" yaml:"old_start"`
	OldLines int      `json:"old_lines" yaml:"old_lines"`
	NewStart int      `json:"new_start" yaml:"new_start"`
	NewLines int      `json:"new_lines" yaml:"new_lines"`
	Lines    []string `json:"lines" yaml:"lines"`
}

DiffHunk represents a single hunk within a file diff

type DocCategoriesConfig

type DocCategoriesConfig struct {
	// API controls API documentation category
	API bool `json:"api" yaml:"api"`

	// Tutorials controls tutorials category
	Tutorials bool `json:"tutorials" yaml:"tutorials"`

	// Architecture controls architecture docs category
	Architecture bool `json:"architecture" yaml:"architecture"`

	// Guides controls how-to guides category
	Guides bool `json:"guides" yaml:"guides"`

	// Reference controls reference documentation category
	Reference bool `json:"reference" yaml:"reference"`

	// Roadmap controls roadmap/changelog category
	Roadmap bool `json:"roadmap" yaml:"roadmap"`
}

DocCategoriesConfig controls documentation category visibility

type DocFeaturesConfig

type DocFeaturesConfig struct {
	// WelcomePage enables AI-powered welcome page generation from README
	WelcomePage bool `json:"welcome_page" yaml:"welcome_page"`

	// APIReference enables API documentation generation
	APIReference bool `json:"api_reference" yaml:"api_reference"`

	// Tutorials includes tutorial documentation
	Tutorials bool `json:"tutorials" yaml:"tutorials"`

	// Architecture includes architecture documentation
	Architecture bool `json:"architecture" yaml:"architecture"`

	// Changelog includes changelog generation
	Changelog bool `json:"changelog" yaml:"changelog"`

	// Search enables search functionality in generated site
	Search bool `json:"search" yaml:"search"`
}

DocFeaturesConfig controls specific documentation features

type DocumentationConfig

type DocumentationConfig struct {
	// Enabled controls whether documentation generation is active
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Mode determines generation strategy: "full" or "incremental"
	Mode string `json:"mode" yaml:"mode"`

	// OutputDirectory is where documentation will be generated
	OutputDirectory string `json:"output_directory" yaml:"output_directory"`

	// Languages specifies which languages to document (empty = all detected)
	Languages []string `json:"languages,omitempty" yaml:"languages,omitempty"`

	// SiteGenerator specifies the static site generator: "jekyll" (default)
	SiteGenerator string `json:"site_generator" yaml:"site_generator"`

	// Theme specifies the documentation theme (e.g., "just-the-docs")
	Theme string `json:"theme" yaml:"theme"`

	// Deploy configuration for automated deployment
	Deploy DeployConfig `json:"deploy" yaml:"deploy"`

	// Features controls specific documentation features
	Features DocFeaturesConfig `json:"features" yaml:"features"`

	// Categories controls which documentation categories to generate
	Categories DocCategoriesConfig `json:"categories" yaml:"categories"`

	// Cache configuration for incremental builds
	Cache CacheConfig `json:"cache" yaml:"cache"`
}

DocumentationConfig configures documentation generation behavior

type Event

type Event struct {
	Repo       string `json:"repo" yaml:"repo"`
	RepoOwner  string `json:"repo_owner" yaml:"repo_owner"`
	Provider   string `json:"provider" yaml:"provider"` // "github", "gitea", "git"
	EventType  string `json:"event_type" yaml:"event_type"`
	Action     string `json:"action" yaml:"action"` // PR action: opened, synchronize, closed, etc.
	DeliveryID string `json:"delivery_id" yaml:"delivery_id"`
	PRNumber   int    `json:"pr_number" yaml:"pr_number"`
	CommitSHA  string `json:"commit_sha" yaml:"commit_sha"`
	Branch     string `json:"branch" yaml:"branch"`
	Merged     bool   `json:"merged" yaml:"merged"` // For PR closed events
	Payload    []byte `json:"payload" yaml:"payload"`
	Signature  string `json:"signature" yaml:"signature"`
}

Event represents a Git provider event (webhook payload)

type FeaturesConfig

type FeaturesConfig struct {
	CodeReview       bool `json:"code_review" yaml:"code_review"`
	CodeReviewOnPush bool `json:"code_review_on_push" yaml:"code_review_on_push"`
	Documentation    bool `json:"documentation" yaml:"documentation"`
	QATesting        bool `json:"qa_testing" yaml:"qa_testing"`
}

FeaturesConfig enables/disables the 3 main use cases

type GitClient

type GitClient interface {
	GetPullRequestDiff(repo, owner string, prNumber int) (*Diff, error)
	ListChangedFiles(repo, owner string, prNumber int) ([]string, error)
	PostReviewComment(repo, owner string, prNumber int, comment ReviewComment) error
	SetStatus(repo, owner, sha, status, context, description string) error
}

GitClient defines the interface for Git provider interactions

type ISOScores

type ISOScores struct {
	Functionality   int `json:"functionality" yaml:"functionality"`
	Reliability     int `json:"reliability" yaml:"reliability"`
	Usability       int `json:"usability" yaml:"usability"`
	Efficiency      int `json:"efficiency" yaml:"efficiency"`
	Maintainability int `json:"maintainability" yaml:"maintainability"`
	Portability     int `json:"portability" yaml:"portability"`
	Security        int `json:"security" yaml:"security"`
	Compatibility   int `json:"compatibility" yaml:"compatibility"`
}

ISOScores represents ISO/IEC 25010 quality characteristics

type LLMConfig

type LLMConfig struct {
	Provider    string  `json:"provider" yaml:"provider"` // "auto", "litellm", "openai", "anthropic", "ollama"
	Model       string  `json:"model" yaml:"model"`
	Temperature float64 `json:"temperature" yaml:"temperature"`
	MaxTokens   int     `json:"max_tokens" yaml:"max_tokens"`
}

LLMConfig configures the LLM provider and parameters

type Options

type Options struct {
	Temperature float64           `json:"temperature"`
	MaxTokens   int               `json:"max_tokens"`
	Model       string            `json:"model,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

Options represents LLM request options

type OutputConfig

type OutputConfig struct {
	CommentOnPR   bool `json:"comment_on_pr" yaml:"comment_on_pr"`
	UpdateDocs    bool `json:"update_docs" yaml:"update_docs"`
	GenerateTests bool `json:"generate_tests" yaml:"generate_tests"`
	DeploySite    bool `json:"deploy_site" yaml:"deploy_site"`
}

OutputConfig controls what AurumCode generates

type PromptBuilder

type PromptBuilder interface {
	Build(diff *Diff, config *Config) (string, error)
	EstimateTokens(prompt string) int
}

PromptBuilder defines the interface for constructing LLM prompts

type Provider

type Provider interface {
	Complete(prompt string, opts Options) (Response, error)
	Tokens(input string) (int, error)
	Name() string
}

Provider defines the interface for LLM providers

type QAArtifacts

type QAArtifacts struct {
	CoverageReportPath string          `json:"coverage_report_path,omitempty" yaml:"coverage_report_path,omitempty"`
	SARIFPath          string          `json:"sarif_path,omitempty" yaml:"sarif_path,omitempty"`
	SBOMPath           string          `json:"sbom_path,omitempty" yaml:"sbom_path,omitempty"`
	ChangelogPath      string          `json:"changelog_path,omitempty" yaml:"changelog_path,omitempty"`
	Coverage           *CoverageReport `json:"coverage,omitempty" yaml:"coverage,omitempty"`
}

QAArtifacts tracks generated test and quality artifacts

type Response

type Response struct {
	Content    string `json:"content"`
	TokensUsed int    `json:"tokens_used"`
	Model      string `json:"model"`
	Provider   string `json:"provider"`
}

Response represents an LLM response

type ResponseParser

type ResponseParser interface {
	ParseJSON(content string, schema interface{}) error
	ParseMarkdown(content string) (string, error)
}

ResponseParser defines the interface for parsing LLM responses

type ReviewComment

type ReviewComment struct {
	Path     string `json:"path" yaml:"path"` // Empty for general PR comment
	Line     int    `json:"line" yaml:"line"` // 0 for general comment
	Body     string `json:"body" yaml:"body"`
	CommitID string `json:"commit_id" yaml:"commit_id"`
}

ReviewComment represents a comment to post on a PR

type ReviewIssue

type ReviewIssue struct {
	ID           string `json:"id" yaml:"id"`
	File         string `json:"file" yaml:"file"`
	Line         int    `json:"line" yaml:"line"`
	Severity     string `json:"severity" yaml:"severity"` // "error", "warning", "info"
	RuleID       string `json:"rule_id" yaml:"rule_id"`
	Message      string `json:"message" yaml:"message"`
	Impact       string `json:"impact,omitempty" yaml:"impact,omitempty"`
	Evidence     string `json:"evidence,omitempty" yaml:"evidence,omitempty"`
	Suggestion   string `json:"suggestion,omitempty" yaml:"suggestion,omitempty"`
	Verification string `json:"verification,omitempty" yaml:"verification,omitempty"`
}

ReviewIssue represents a single finding in a code review

type ReviewResult

type ReviewResult struct {
	Verdict       string             `json:"verdict" yaml:"verdict"`
	Strengths     []string           `json:"strengths" yaml:"strengths"`
	Issues        []ReviewIssue      `json:"issues" yaml:"issues"`
	Suggestions   []ReviewSuggestion `json:"suggestions" yaml:"suggestions"`
	CIAnalysis    []CIAnalysis       `json:"ci_analysis" yaml:"ci_analysis"`
	TestPlan      []string           `json:"test_plan" yaml:"test_plan"`
	Limitations   []string           `json:"limitations" yaml:"limitations"`
	ISOScores     *ISOScores         `json:"iso_scores,omitempty" yaml:"iso_scores,omitempty"`
	Summary       string             `json:"summary" yaml:"summary"`
	OverallScore  float64            `json:"overall_score" yaml:"overall_score"`
	LineComments  []ReviewComment    `json:"line_comments" yaml:"line_comments"`   // Legacy input compatibility
	FileComments  []ReviewComment    `json:"file_comments" yaml:"file_comments"`   // Legacy input compatibility
	CommitComment string             `json:"commit_comment" yaml:"commit_comment"` // Legacy input compatibility
	Metadata      map[string]string  `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

ReviewResult represents the complete output of a code review

type ReviewSuggestion added in v1.0.2

type ReviewSuggestion struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	// Kind is "code" for an implementation-ready replacement and "general"
	// for advice that does not have a safe, concrete patch shape. It is
	// optional for backward compatibility with older model responses.
	Kind         string `json:"kind,omitempty" yaml:"kind,omitempty"`
	File         string `json:"file,omitempty" yaml:"file,omitempty"`
	Line         int    `json:"line,omitempty" yaml:"line,omitempty"`
	StartLine    int    `json:"start_line,omitempty" yaml:"start_line,omitempty"`
	EndLine      int    `json:"end_line,omitempty" yaml:"end_line,omitempty"`
	CurrentCode  string `json:"current_code,omitempty" yaml:"current_code,omitempty"`
	ProposedCode string `json:"proposed_code,omitempty" yaml:"proposed_code,omitempty"`
	Rationale    string `json:"rationale,omitempty" yaml:"rationale,omitempty"`
	Verification string `json:"verification,omitempty" yaml:"verification,omitempty"`
}

ReviewSuggestion is a non-blocking improvement proposed by the reviewer. Suggestions are deliberately separate from Issues so the published report can distinguish required changes from useful follow-ups.

Jump to

Keyboard shortcuts

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