linter

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package linter performs static and AI-based quality analysis on cloop task plans. Static checks run without any AI call; AI checks are batched into a single provider call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFixes

func ApplyFixes(plan *pm.Plan, fixes []FixSuggestion) int

ApplyFixes updates the plan in-place with the generated fixes.

Types

type FixSuggestion

type FixSuggestion struct {
	TaskID   int
	TitleFix string
	DescFix  string
}

FixSuggestion holds an AI-generated field rewrite for a single task.

func GenerateFixes

func GenerateFixes(ctx context.Context, prov provider.Provider, model string, plan *pm.Plan, issues []Issue) ([]FixSuggestion, error)

GenerateFixes asks the provider to rewrite titles/descriptions for the given issues.

type Issue

type Issue struct {
	// TaskID is the task this issue applies to (0 = plan-level).
	TaskID int

	// Field is the task field that is affected (e.g. "title", "description", "priority").
	Field string

	// Severity indicates how serious the issue is.
	Severity Severity

	// Code is a short machine-readable identifier (e.g. "duplicate-title").
	Code string

	// Message is the human-readable description of the problem.
	Message string

	// Suggestion is an optional actionable improvement hint (may be empty for static checks).
	Suggestion string
}

Issue is a single lint finding for a task plan.

func Lint

func Lint(ctx context.Context, plan *pm.Plan, opts Options) ([]Issue, error)

Lint analyses the plan and returns a slice of Issues ordered by severity (ERROR first). Static checks run without any AI call. AI checks are batched in a single provider call unless opts.SkipAI is true.

type Options

type Options struct {
	// TaskID, when non-zero, restricts linting to a single task.
	TaskID int

	// SkipAI disables the AI-based checks (static checks still run).
	SkipAI bool

	// Provider and Model are used for the AI batch call.
	Provider provider.Provider
	Model    string
}

Options configure the Lint call.

type Severity

type Severity string

Severity levels for lint issues.

const (
	SeverityError Severity = "ERROR"
	SeverityWarn  Severity = "WARN"
	SeverityInfo  Severity = "INFO"
)

Jump to

Keyboard shortcuts

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