compact

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package compact provides AI-powered issue compaction using Claude Haiku.

Index

Constants

This section is empty.

Variables

View Source
var ErrAPIKeyRequired = errors.New("API key required")

ErrAPIKeyRequired is returned when an API key is needed but not provided.

Functions

func GetCurrentCommitHash

func GetCurrentCommitHash() string

GetCurrentCommitHash returns the current git HEAD commit hash. Returns empty string if not in a git repository or if git command fails.

Types

type Compactor

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

Compactor handles issue compaction using AI summarization.

func New

func New(store *sqlite.SQLiteStorage, apiKey string, config *Config) (*Compactor, error)

New creates a new Compactor instance with the given configuration.

func (*Compactor) CompactTier1

func (c *Compactor) CompactTier1(ctx context.Context, issueID string) error

CompactTier1 performs tier-1 compaction on a single issue using AI summarization.

func (*Compactor) CompactTier1Batch

func (c *Compactor) CompactTier1Batch(ctx context.Context, issueIDs []string) ([]*Result, error)

CompactTier1Batch performs tier-1 compaction on multiple issues in a single batch.

type Config

type Config struct {
	APIKey       string
	Concurrency  int
	DryRun       bool
	AuditEnabled bool
	Actor        string
}

Config holds configuration for the compaction process.

type HaikuClient

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

HaikuClient wraps the Anthropic API for issue summarization.

func NewHaikuClient

func NewHaikuClient(apiKey string) (*HaikuClient, error)

NewHaikuClient creates a new Haiku API client. Env var ANTHROPIC_API_KEY takes precedence over explicit apiKey.

func (*HaikuClient) SummarizeTier1

func (h *HaikuClient) SummarizeTier1(ctx context.Context, issue *types.Issue) (string, error)

SummarizeTier1 creates a structured summary of an issue (Summary, Key Decisions, Resolution).

type Result

type Result struct {
	IssueID       string
	OriginalSize  int
	CompactedSize int
	Err           error
}

Result holds the outcome of a compaction operation.

Jump to

Keyboard shortcuts

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