Add transcript passthrough processing

This commit is contained in:
2026-05-10 23:27:54 +00:00
parent 8f3c2ec5fd
commit 2cf2d390da
6 changed files with 173 additions and 28 deletions

29
internal/core/io/files.go Normal file
View File

@@ -0,0 +1,29 @@
package io
import (
"encoding/json"
"fmt"
"os"
)
func ReadRequiredFile(path string, label string) ([]byte, error) {
contents, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("failed to read %s file %q: %w", label, path, err)
}
return contents, nil
}
func ValidateWellFormedJSON(raw []byte) error {
if !json.Valid(raw) {
return fmt.Errorf("transcript file is not valid JSON")
}
return nil
}
func WriteFile(path string, contents []byte) error {
if err := os.WriteFile(path, contents, 0o644); err != nil {
return fmt.Errorf("failed to write output file %q: %w", path, err)
}
return nil
}