shared

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient returns a hardened HTTP client shared by commands that need to communicate with AI providers.

func OpenEditor added in v0.9.0

func OpenEditor(initialContent, extension string) (string, error)

OpenEditor opens the user's preferred editor with the given content. It returns the edited content and any error derived from the operation.

Types

type ModelEndpoint

type ModelEndpoint struct {
	APIKey   string
	BaseURL  string
	Provider string
}

ModelEndpoint describes the credentials and endpoint overrides for a specific model class.

type RuntimeContext

type RuntimeContext struct {
	Provider         string
	BaseURL          string
	APIKey           string
	LightModel       string
	HeavyModel       string
	Fallback         string
	LightEndpoint    ModelEndpoint
	HeavyEndpoint    ModelEndpoint
	FallbackEndpoint ModelEndpoint
	HTTPClient       *http.Client
	AnalysisTimeout  time.Duration
	WriterTimeout    time.Duration
	CopilotBinary    string
	ClaudeBinary     string
}

RuntimeContext exposes sanitized configuration and shared dependencies that can be reused across commands without reaching into unrelated domains directly.

func BuildRuntimeContext

func BuildRuntimeContext() (*RuntimeContext, error)

BuildRuntimeContext constructs a RuntimeContext from viper configuration and returns actionable pointers commands can share without duplicating sensitive logic.

func (*RuntimeContext) RedactedCopy

func (rc *RuntimeContext) RedactedCopy() RuntimeContext

RedactedCopy provides a safe snapshot that can be logged or passed to prompts without leaking the API key.

Jump to

Keyboard shortcuts

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