ai

package
v1.10.5 Latest Latest
Warning

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

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

Documentation

Overview

Package ai provides factory functions that construct chat.ChatClient instances from Props configuration, resolving the configured provider (Claude, OpenAI, Gemini) and wiring API keys, model selection, and token limits for use in documentation generation and agentic verification loops.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAIConfigured

func IsAIConfigured(p *props.Props) bool

IsAIConfigured checks if the AI provider and its corresponding key are configured.

func NewCmdInitAI

func NewCmdInitAI(p *props.Props, opts ...FormOption) *cobra.Command

NewCmdInitAI creates the `init ai` subcommand.

func RunAIInit

func RunAIInit(p *props.Props, dir string, opts ...FormOption) error

RunAIInit executes the AI configuration form and writes the results to the config file.

Types

type AIConfig

type AIConfig struct {
	Provider    string
	APIKey      string
	ExistingKey string // populated from disk config; used to show masked hint in the form
}

AIConfig holds the AI provider configuration captured from the form.

type AIInitialiser

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

AIInitialiser implements setup.Initialiser for AI provider configuration.

func NewAIInitialiser

func NewAIInitialiser(p *props.Props, opts ...FormOption) *AIInitialiser

NewAIInitialiser creates a new AIInitialiser and mounts its assets.

func (*AIInitialiser) Configure

func (a *AIInitialiser) Configure(p *props.Props, cfg config.Containable) error

Configure runs the interactive AI configuration forms and populates the shared config.

func (*AIInitialiser) IsConfigured

func (a *AIInitialiser) IsConfigured(cfg config.Containable) bool

IsConfigured checks if a valid AI provider is set and its corresponding API key is present.

func (*AIInitialiser) Name

func (a *AIInitialiser) Name() string

Name returns the human-readable name for this initialiser.

type FormOption

type FormOption func(*formConfig)

FormOption configures the AI init form for testability.

func WithAIForm

func WithAIForm(creator func(*AIConfig) []*huh.Form) FormOption

WithAIForm allows injecting custom form creators for testing.

Jump to

Keyboard shortcuts

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