Documentation
¶
Index ¶
- Constants
- Variables
- func CopyToClipboard(text string) error
- func EnsureDir(dir string) error
- func EnvDefault(k, def string) string
- func FindTraceFile(traceID string, filename string) (string, error)
- func FindTuskRoot() string
- func FormatJSONDiff(expected, actual any) string
- func FormatJSONForDiff(v any) string
- func GenerateDeterministicHash(value any) string
- func GenerateSchemaAndHash(value any) (schema any, valueHash string, schemaHash string)
- func GetLogsDir() string
- func GetPossibleTraceDirs() []string
- func GetTracesDir() string
- func GetTuskDir() string
- func GetTuskRoot() string
- func IsTerminal() bool
- func MarkNonWrappable(text string) string
- func ParseProtobufSpanFromJSON(jsonData []byte) (*core.Span, error)
- func ParseSpansFromFile(filename string, filter SpanFilter) ([]*core.Span, error)
- func ReduceByMatchImportance(value any, schema *structpb.Struct) any
- func RemoveHeadersFromInputValue(inputValue any) any
- func RenderMarkdown(markdown string) string
- func ResolveTuskPath(path string) string
- func SetTracesDirOverride(dir string)
- func StripNoWrapMarker(text string) string
- func WrapLine(text string, maxWidth int) []string
- func WrapText(content string, maxWidth int) string
- type SpanFilter
Constants ¶
const ( TuskDirName = ".tusk" TracesSubDir = "traces" LogsSubDir = "logs" ConfigFileName = "config.yaml" )
const NoWrapMarker = "\x00NOWRAP\x00"
Variables ¶
var PossibleTraceDirs = []string{
".tusk/traces",
"traces",
"tmp",
".",
}
List of directories to search for trace files
Functions ¶
func CopyToClipboard ¶
CopyToClipboard copies text to the system clipboard. It tries OSC52 first (for remote terminals), then falls back to OS clipboard.
func EnvDefault ¶
func FindTraceFile ¶
FindTraceFile searches for a JSONL trace file containing the given trace ID. If filename is provided, it tries that first before searching
func FindTuskRoot ¶ added in v0.1.1
func FindTuskRoot() string
FindTuskRoot traverses up the directory tree looking for a .tusk directory Returns the directory containing .tusk, or empty string if not found
func FormatJSONDiff ¶ added in v0.1.4
FormatJSONDiff creates a git-style unified diff between two JSON values
func FormatJSONForDiff ¶ added in v0.1.4
FormatJSONForDiff formats a JSON value with proper indentation for diff display
func GenerateDeterministicHash ¶
GenerateDeterministicHash creates a deterministic hash of any JSON-serializable value
func GenerateSchemaAndHash ¶
GenerateSchemaAndHash generates JSON schema and deterministic hash for any value
func GetPossibleTraceDirs ¶
func GetPossibleTraceDirs() []string
GetPossibleTraceDirs returns the list of directories to search for trace files, preferring override first.
func GetTuskDir ¶
func GetTuskDir() string
GetTuskDir returns the .tusk directory path (either local or in home directory)
func GetTuskRoot ¶ added in v0.1.1
func GetTuskRoot() string
GetTuskRoot returns the root directory containing .tusk, or current directory if not found
func IsTerminal ¶
func IsTerminal() bool
func MarkNonWrappable ¶ added in v0.1.4
MarkNonWrappable adds an invisible marker to indicate text should not be wrapped
func ParseProtobufSpanFromJSON ¶
ParseProtobufSpanFromJSON parses a JSON line into a protobuf Span
func ParseSpansFromFile ¶
func ParseSpansFromFile(filename string, filter SpanFilter) ([]*core.Span, error)
ParseSpansFromFile reads a JSONL trace file and returns spans matching the filter. If the file is malformed, it returns an error.
func ReduceByMatchImportance ¶
ReduceByMatchImportance returns a copy of 'value' keeping only fields with matchImportance != 0. Schema is a structpb.Struct with optional per-field "matchImportance": 0|1 (default 1). Supports nested objects and arrays (uses 'items' schema for arrays if present).
func RemoveHeadersFromInputValue ¶
RemoveHeadersFromInputValue removes non-critical headers for header-agnostic matching but preserves headers that affect response format like Accept and Content-Type
func RenderMarkdown ¶
func ResolveTuskPath ¶ added in v0.1.1
ResolveTuskPath resolves a path relative to the tusk root if it's relative, or returns it as-is if it's already absolute
func SetTracesDirOverride ¶
func SetTracesDirOverride(dir string)
SetTracesDirOverride sets an explicit traces directory to use.
func StripNoWrapMarker ¶ added in v0.1.4
StripNoWrapMarker removes the non-wrappable marker from text before display
Types ¶
type SpanFilter ¶
SpanFilter is a function type for filtering spans during parsing