enhance

package
v0.11.430 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEnhancePrompt

func BuildEnhancePrompt(assetPath, assetName, pipelineName, tableSummaryJSON string) string

BuildEnhancePrompt constructs the prompt for Claude. Claude will directly edit the file using its native tools. If tableSummaryJSON is provided, it will be included in the prompt.

func GetSystemPrompt

func GetSystemPrompt(hasPreFetchedStats bool) string

GetSystemPrompt returns the system prompt for Claude. If hasPreFetchedStats is true, uses the prompt that references pre-fetched statistics.

Types

type CLIProvider

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

CLIProvider implements the Provider interface for any CLI-based AI tool.

func NewCLIProvider

func NewCLIProvider(config CLIProviderConfig, model string, fs afero.Fs) *CLIProvider

NewCLIProvider creates a new generic CLI provider.

func (*CLIProvider) Enhance

func (p *CLIProvider) Enhance(ctx context.Context, prompt, systemPrompt string) error

Enhance executes the CLI with the given prompt.

func (*CLIProvider) EnsureCLI

func (p *CLIProvider) EnsureCLI() error

EnsureCLI checks if the CLI is available.

func (*CLIProvider) Name

func (p *CLIProvider) Name() string

Name returns the provider name.

func (*CLIProvider) SetAPIKey

func (p *CLIProvider) SetAPIKey(apiKey string)

SetAPIKey sets the API key for the provider.

func (*CLIProvider) SetDebug

func (p *CLIProvider) SetDebug(debug bool)

SetDebug enables or disables debug output.

type CLIProviderConfig

type CLIProviderConfig struct {
	Name              string
	BinaryName        string
	DefaultModel      string
	UseAPIKeyEnv      bool   // Whether to inject API key via environment variable.
	APIKeyEnvVar      string // Environment variable name for API key (e.g., "ANTHROPIC_API_KEY").
	BuildArgs         func(model, prompt, systemPrompt string) []string
	CommonSearchPaths []string // Additional search paths beyond standard ones.
}

CLIProviderConfig holds configuration for a generic CLI provider.

type Enhancer

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

Enhancer coordinates the AI enhancement process for assets.

func NewEnhancer

func NewEnhancer(providerType ProviderType, model string) *Enhancer

NewEnhancer creates a new Enhancer instance.

func (*Enhancer) EnhanceAsset

func (e *Enhancer) EnhanceAsset(ctx context.Context, asset *pipeline.Asset, pipelineName, tableSummaryJSON string) error

EnhanceAsset runs AI enhancement on a single asset.

func (*Enhancer) EnsureCLI

func (e *Enhancer) EnsureCLI() error

EnsureCLI checks if the provider's CLI is available.

func (*Enhancer) SetAPIKey

func (e *Enhancer) SetAPIKey(apiKey string)

SetAPIKey sets the API key for the provider.

func (*Enhancer) SetDebug

func (e *Enhancer) SetDebug(debug bool)

SetDebug enables or disables debug output.

type EnhancerInterface

type EnhancerInterface interface {
	SetAPIKey(apiKey string)
	SetDebug(debug bool)
	EnsureCLI() error
	EnhanceAsset(ctx context.Context, asset *pipeline.Asset, pipelineName, tableSummaryJSON string) error
}

EnhancerInterface defines the interface for asset enhancement.

type Provider

type Provider interface {
	Name() string
	EnsureCLI() error
	Enhance(ctx context.Context, prompt, systemPrompt string) error
	SetDebug(debug bool)
	SetAPIKey(apiKey string) // May be no-op for some providers
}

Provider defines the interface for AI CLI providers.

func NewClaudeProvider

func NewClaudeProvider(model string, fs afero.Fs) Provider

NewClaudeProvider creates a new Claude CLI provider.

func NewCodexProvider

func NewCodexProvider(model string, fs afero.Fs) Provider

NewCodexProvider creates a new Codex CLI provider.

func NewOpenCodeProvider

func NewOpenCodeProvider(model string, fs afero.Fs) Provider

NewOpenCodeProvider creates a new OpenCode CLI provider.

type ProviderType

type ProviderType string

ProviderType represents the AI provider type.

const (
	ProviderClaude   ProviderType = "claude"
	ProviderOpenCode ProviderType = "opencode"
	ProviderCodex    ProviderType = "codex"
)

Jump to

Keyboard shortcuts

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