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 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 ErrUnsupportedProvider = fmt.Errorf("unsupported provider (use %q or %q)", ProviderDeepSeek, ProviderOpenAI)
ErrUnsupportedProvider indicates an invalid provider was specified.
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 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 name (required): brainstorm, meeting, lecture, notes
Template string
// LLM provider: "deepseek" (default) or "openai"
Provider string
// Output language (optional): ISO 639-1 code, empty = English
OutputLang string
// 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 ProviderDeepSeek or ProviderOpenAI.
// This is the primary method for creating restructurers in CLI commands.
NewMapReducer(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.