cqa

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package cqa bridges a Code-Quality-Agent (CQA) API into the task queue: the latest scan's fixable issues for each locally-present repo become agent fix tasks. This closes the quality loop — the pool fixes what the scanners find, the next scan re-verifies, and any remaining or new issues arrive as fresh tasks (dedup keys include the scan ID, so a new scan arms new work).

Ingestion is read-only against the CQA API and idempotent against the queue: enqueues ride the store's dedup keys, so running the bridge twice (or racing a harvest tick) never double-enqueues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DedupKey

func DedupKey(repo, scanID, file string) string

DedupKey identifies one fix task: repo + scan + file.

Types

type Bridge

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

Bridge reads a CQA API and turns findings into agent tasks.

func New

func New(cfg Config) *Bridge

New creates a Bridge.

func (*Bridge) Collect

func (b *Bridge) Collect(ctx context.Context) ([]FixTask, error)

Collect fetches projects, their latest scans, and the fixable issues worth agent work, and renders one fix task per file (grouping issues keeps each agent run focused and keeps the commit reviewable).

type Config

type Config struct {
	// BaseURL is the CQA API root, e.g. http://localhost:8080.
	BaseURL string
	// Token is sent as a Bearer authorization header (optional).
	Token string
	// OwnerID filters projects on the CQA side (its API requires it).
	OwnerID string
	// ProjectsDir maps CQA repo names to local directories: only repos that
	// exist locally become tasks (the pool cannot fix remote-only repos).
	ProjectsDir string
	// MaxFiles caps how many fix tasks one run may produce (0 = no cap).
	MaxFiles int
	// MinSeverity filters which issues are worth an agent run:
	// "critical" and "error" by default. One of critical|error|warning|info.
	MinSeverity string
	// Type is the task type enqueued (default "agent").
	Type string
	// TimeoutMinutes for generated fix tasks (default 45).
	TimeoutMinutes int
}

Config controls one bridge run.

type FixTask

type FixTask struct {
	Project  string
	RepoDir  string
	File     string
	Issues   []Issue
	Template task.New
}

FixTask is one generated agent task plus its provenance.

type Issue

type Issue struct {
	Analyzer      string `json:"analyzer"`
	Severity      string `json:"severity"`
	RuleID        string `json:"rule_id,omitempty"`
	FilePath      string `json:"file_path,omitempty"`
	LineStart     int32  `json:"line_start,omitempty"`
	Message       string `json:"message,omitempty"`
	Suggestion    string `json:"suggestion,omitempty"`
	Fixable       bool   `json:"fixable"`
	FixComplexity string `json:"fix_complexity,omitempty"`
}

Issue is the slice of CQA's issue response the bridge needs.

type Project

type Project struct {
	ID       string `json:"id"`
	RepoName string `json:"repo_name"`
}

Project is the slice of CQA's project response the bridge needs.

type Scan

type Scan struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

Scan is the slice of CQA's scan response the bridge needs.

Jump to

Keyboard shortcuts

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