Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigCmd(env *Env) *cobra.Command
- func LiveCmd(env *Env) *cobra.Command
- func RecordCmd(env *Env) *cobra.Command
- func StructureCmd(env *Env) *cobra.Command
- func TranscribeCmd(env *Env) *cobra.Command
- type ChunkerFactory
- type ConfigLoader
- type Env
- type EnvOption
- func WithChunkerFactory(f ChunkerFactory) EnvOption
- func WithConfigLoader(l ConfigLoader) EnvOption
- func WithFFmpegResolver(r FFmpegResolver) EnvOption
- func WithGetenv(fn func(string) string) EnvOption
- func WithNow(fn func() time.Time) EnvOption
- func WithRecorderFactory(f RecorderFactory) EnvOption
- func WithRestructurerFactory(f RestructurerFactory) EnvOption
- func WithStderr(w io.Writer) EnvOption
- func WithTranscriberFactory(f TranscriberFactory) EnvOption
- type FFmpegResolver
- type Provider
- type RecorderFactory
- type RestructureOptions
- type RestructurerFactory
- type TranscriberFactory
Constants ¶
const ( // ProviderDeepSeek uses DeepSeek API for restructuring. ProviderDeepSeek = "deepseek" // ProviderOpenAI uses OpenAI API for restructuring. ProviderOpenAI = "openai" )
Restructuring provider constants.
const ( EnvOpenAIAPIKey = "OPENAI_API_KEY" EnvDeepSeekAPIKey = "DEEPSEEK_API_KEY" )
Environment variable names for API keys. #nosec G101 -- these are env var names, not credentials
Variables ¶
var ( // ErrAPIKeyMissing indicates OPENAI_API_KEY environment variable is not set. ErrAPIKeyMissing = errors.New("OPENAI_API_KEY environment variable not set") // ErrDeepSeekKeyMissing indicates DEEPSEEK_API_KEY environment variable is not set. ErrDeepSeekKeyMissing = errors.New("DEEPSEEK_API_KEY environment variable not set") // ErrInvalidDuration indicates a duration string could not be parsed. ErrInvalidDuration = errors.New("invalid duration format") // ErrUnsupportedFormat indicates an audio file has an unsupported extension. ErrUnsupportedFormat = errors.New("unsupported audio format") // ErrFileNotFound indicates the specified input file does not exist. ErrFileNotFound = errors.New("file not found") // ErrOutputExists indicates the output file already exists. ErrOutputExists = errors.New("output file already exists") )
var ( DeepSeekProvider = Provider{/* contains filtered or unexported fields */} OpenAIProvider = Provider{/* contains filtered or unexported fields */} )
Pre-parsed provider constants for use in code. These avoid parsing overhead and provide compile-time safety.
var ErrInvalidProvider = errors.New("invalid provider")
ErrInvalidProvider indicates an invalid provider name was specified.
var ErrUnsupportedProvider = fmt.Errorf("unsupported provider (use %q or %q)", ProviderDeepSeek, ProviderOpenAI)
ErrUnsupportedProvider indicates an unknown provider was passed to the factory. With the Provider type, this error is only reachable if: 1. A zero-value Provider is passed without defaulting 2. The Provider type is extended but the factory is not updated Normal CLI flows default zero providers to DeepSeek before calling the factory.
Functions ¶
func ConfigCmd ¶
ConfigCmd creates the config command with subcommands. The env parameter provides injectable dependencies for testing.
func LiveCmd ¶
LiveCmd creates the live command (record + transcribe in one step). The env parameter provides injectable dependencies for testing.
func RecordCmd ¶
RecordCmd creates the record command. The env parameter provides injectable dependencies for testing.
func StructureCmd ¶ added in v0.1.0
StructureCmd creates the structure command (restructure an existing transcript). The env parameter provides injectable dependencies for testing.
func TranscribeCmd ¶
TranscribeCmd creates the transcribe command. The env parameter provides injectable dependencies for testing.
Types ¶
type ChunkerFactory ¶
ChunkerFactory creates audio chunkers.
type ConfigLoader ¶
ConfigLoader loads and provides access to configuration.
type Env ¶
type Env struct {
// I/O and environment
Stderr io.Writer
Getenv func(string) string
Now func() time.Time
// Factories for domain objects
FFmpegResolver FFmpegResolver
ConfigLoader ConfigLoader
TranscriberFactory TranscriberFactory
RestructurerFactory RestructurerFactory
ChunkerFactory ChunkerFactory
RecorderFactory RecorderFactory
}
Env holds injectable dependencies for CLI commands. This is the central injection point for testing CLI commands in isolation.
All fields have sensible defaults via DefaultEnv(). Tests can override specific fields using the With* options or by creating a custom Env.
Env must not be nil when passed to command functions. Use DefaultEnv() or NewEnv() to create a valid instance.
type EnvOption ¶
type EnvOption func(*Env)
EnvOption configures an Env.
func WithChunkerFactory ¶
func WithChunkerFactory(f ChunkerFactory) EnvOption
WithChunkerFactory sets the chunker factory.
func WithConfigLoader ¶
func WithConfigLoader(l ConfigLoader) EnvOption
WithConfigLoader sets the config loader.
func WithFFmpegResolver ¶
func WithFFmpegResolver(r FFmpegResolver) EnvOption
WithFFmpegResolver sets the FFmpeg resolver.
func WithGetenv ¶
WithGetenv sets the environment variable getter.
func WithRecorderFactory ¶
func WithRecorderFactory(f RecorderFactory) EnvOption
WithRecorderFactory sets the recorder factory.
func WithRestructurerFactory ¶
func WithRestructurerFactory(f RestructurerFactory) EnvOption
WithRestructurerFactory sets the restructurer factory.
func WithTranscriberFactory ¶
func WithTranscriberFactory(f TranscriberFactory) EnvOption
WithTranscriberFactory sets the transcriber factory.
type FFmpegResolver ¶
type FFmpegResolver interface {
Resolve(ctx context.Context) (string, error)
CheckVersion(ctx context.Context, ffmpegPath string)
}
FFmpegResolver resolves the path to the FFmpeg binary.
type Provider ¶ added in v0.3.0
type Provider struct {
// contains filtered or unexported fields
}
Provider represents a validated LLM provider for restructuring. Zero value is invalid and must not be used. Use ParseProvider to create from user input, or the pre-parsed constants.
func MustParseProvider ¶ added in v0.3.0
MustParseProvider parses a provider name, panicking if invalid. Use only for compile-time constants and tests.
func ParseProvider ¶ added in v0.3.0
ParseProvider validates and parses a provider name string. Returns ErrInvalidProvider if the name is not recognized. Empty string returns an error (unlike Language where empty means auto-detect).
func (Provider) IsDeepSeek ¶ added in v0.3.0
IsDeepSeek returns true if this provider is DeepSeek.
func (Provider) IsZero ¶ added in v0.3.0
IsZero returns true if this is the zero value (no provider set). Unlike Language.IsZero() which represents valid "auto-detect" mode, Provider.IsZero() indicates an invalid/unset state that must be defaulted before use (typically to DeepSeekProvider).
type RecorderFactory ¶
type RecorderFactory interface {
NewRecorder(ffmpegPath, device string) (audio.Recorder, error)
NewLoopbackRecorder(ctx context.Context, ffmpegPath string) (audio.Recorder, error)
NewMixRecorder(ctx context.Context, ffmpegPath, micDevice string) (audio.Recorder, error)
}
RecorderFactory creates audio recorders.
type RestructureOptions ¶ added in v0.1.0
type RestructureOptions struct {
// Template (required): validated template name
Template template.Name
// Provider (required): validated LLM provider
Provider Provider
// Output language (optional): zero value = English (template's native language)
OutputLang lang.Language
// Optional progress callback for long transcripts
OnProgress func(phase string, current, total int)
}
RestructureOptions configures transcript restructuring.
type RestructurerFactory ¶
type RestructurerFactory interface {
// NewMapReducer creates a MapReducer configured with the given provider, API key, and options.
// Provider must be a valid Provider (DeepSeekProvider or OpenAIProvider).
// This is the primary method for creating restructurers in CLI commands.
NewMapReducer(provider Provider, apiKey string, opts ...restructure.MapReduceOption) (restructure.MapReducer, error)
}
RestructurerFactory creates restructurers for transcript formatting.
type TranscriberFactory ¶
type TranscriberFactory interface {
NewTranscriber(apiKey string) transcribe.Transcriber
}
TranscriberFactory creates transcribers for audio-to-text conversion.