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 ¶
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.
Types ¶
type AIConfig ¶
type AIConfig struct {
Provider string
APIKey string
ExistingKey string // populated from disk config; used to show masked hint in the form
// StorageMode selects how the API key is persisted. Defaults to
// [credentials.ModeEnvVar] when the wizard presents the choice.
// [credentials.ModeLiteral] is refused when the process runs
// under CI (CI=true); the only accepted CI credential path is a
// platform-injected environment variable referenced via env-var
// mode.
StorageMode credentials.Mode
// EnvVarName is the environment variable name recorded in
// {provider}.api.env when [StorageMode] is [credentials.ModeEnvVar].
// Ignored in literal mode.
EnvVarName string
}
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. The creator returns forms in order: [0] provider, [1] storage mode, [2] env-var name (or key input), [3] key input fallback.
Returning fewer forms is allowed — the runner skips stages whose slot is nil or absent.