Documentation
¶
Overview ¶
Package tee provides raw output recovery for command failures.
The tee system saves unfiltered command output to disk when commands fail, allowing LLMs to access the full output without re-executing the command. This is especially useful for debugging failed tests or builds.
Based on RTK's tee system, ported to Go for TokMan.
Index ¶
- Constants
- func CleanupTeeFiles(maxAge time.Duration) (int, error)
- func ForceTeeHint(raw string, commandSlug string) string
- func GetTeeDir() (string, error)
- func TeeAndHint(raw string, commandSlug string, exitCode int) string
- func TeeRaw(raw string, commandSlug string, exitCode int) string
- func WriteAndHint(content string, commandSlug string, exitCode int) string
- type TeeConfig
- type TeeFileInfo
- type TeeMode
Constants ¶
const ( // MinTeeSize is the minimum output size to tee (smaller outputs don't need recovery). MinTeeSize = 500 // DefaultMaxFiles is the default maximum number of tee files to keep. DefaultMaxFiles = 20 // DefaultMaxFileSize is the default maximum file size (1MB). DefaultMaxFileSize = 1_048_576 )
Variables ¶
This section is empty.
Functions ¶
func CleanupTeeFiles ¶ added in v0.28.0
CleanupTeeFiles removes all tee files older than the specified duration.
func ForceTeeHint ¶ added in v0.28.0
ForceTeeHint forces tee output regardless of exit code (used when filters truncate). Always writes file if size >= MinTeeSize and tee is enabled. Returns hint string if file was written, empty string if skipped/disabled.
Used by filters when FilterResult.truncated = true, ensuring the LLM has access to full untruncated output via the hint path.
func GetTeeDir ¶ added in v0.28.0
GetTeeDir returns the current tee directory path. Useful for displaying to users or for testing.
func TeeAndHint ¶ added in v0.28.0
TeeAndHint writes raw output to a tee file and returns a formatted hint. Returns the hint string if file was written, empty string if skipped.
Example output: "[full output: ~/.local/share/tokman/tee/1234567890_cargo_test.log]"
func TeeRaw ¶ added in v0.28.0
TeeRaw writes raw output to a tee file if conditions are met. Returns the file path on success, empty string if skipped/failed.
This is the main entry point for tee functionality. It checks: - TOKMAN_TEE=0 env override (disables tee) - TOKMAN_TEE_MODE env override (failures/always/never) - Config enabled flag - Tee mode (failures/always/never) - Output size >= MinTeeSize
Types ¶
type TeeConfig ¶ added in v0.28.0
type TeeConfig struct {
Enabled bool `toml:"enabled" mapstructure:"enabled"`
Mode TeeMode `toml:"mode" mapstructure:"mode"`
MaxFiles int `toml:"max_files" mapstructure:"max_files"`
MaxFileSize int `toml:"max_file_size" mapstructure:"max_file_size"`
Directory string `toml:"directory,omitempty" mapstructure:"directory"`
}
TeeConfig holds configuration for the tee feature.
func DefaultTeeConfig ¶ added in v0.28.0
func DefaultTeeConfig() TeeConfig
DefaultTeeConfig returns the default tee configuration.
type TeeFileInfo ¶ added in v0.28.0
TeeFileInfo represents information about a tee file.
func ListTeeFiles ¶ added in v0.28.0
func ListTeeFiles() ([]TeeFileInfo, error)
ListTeeFiles returns a list of existing tee files with their paths and modification times.