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 *core.JsonSchema) any
- func ReduceSchemaByMatchImportance(schema *core.JsonSchema) *core.JsonSchema
- 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 TruncateWithEllipsis(text string, maxWidth int) string
- func WrapLine(text string, maxWidth int) []string
- func WrapText(content string, maxWidth int) string
- type ProgressBar
- type ProgressTracker
- 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 ¶
func ReduceByMatchImportance(value any, schema *core.JsonSchema) any
ReduceByMatchImportance returns a copy of 'value' keeping only fields with matchImportance != 0. Schema is a JsonSchema proto with optional per-field "matchImportance": 0|1 (default 1). Supports nested objects and arrays (uses 'items' schema for arrays if present).
func ReduceSchemaByMatchImportance ¶ added in v0.1.6
func ReduceSchemaByMatchImportance(schema *core.JsonSchema) *core.JsonSchema
ReduceSchemaByMatchImportance returns a copy of the schema with only fields that have matchImportance != 0 Theoretically match importance could be a decimal, but we don't support that yet.
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
func TruncateWithEllipsis ¶ added in v0.1.16
Types ¶
type ProgressBar ¶ added in v0.1.13
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar shows a progress bar based on current/total counts
func NewProgressBar ¶ added in v0.1.13
func NewProgressBar(message string) *ProgressBar
NewProgressBar creates a new progress bar that outputs to stderr
func (*ProgressBar) Add ¶ added in v0.1.13
func (p *ProgressBar) Add(count int)
Add increments the current count by the given amount
func (*ProgressBar) Finish ¶ added in v0.1.13
func (p *ProgressBar) Finish(finalMessage string)
Finish stops the progress bar and shows a completion message
func (*ProgressBar) SetCurrent ¶ added in v0.1.13
func (p *ProgressBar) SetCurrent(current int)
SetCurrent sets the current count directly
func (*ProgressBar) SetTotal ¶ added in v0.1.13
func (p *ProgressBar) SetTotal(total int)
SetTotal sets the total count for the progress bar
func (*ProgressBar) Start ¶ added in v0.1.13
func (p *ProgressBar) Start()
Start initializes the progress bar (shows empty bar)
func (*ProgressBar) Stop ¶ added in v0.1.13
func (p *ProgressBar) Stop()
Stop clears the progress bar without a final message
type ProgressTracker ¶ added in v0.1.14
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker handles progress reporting for paginated fetches
func NewProgressTracker ¶ added in v0.1.14
func NewProgressTracker(message string, interactive, quiet bool) *ProgressTracker
func (*ProgressTracker) Finish ¶ added in v0.1.14
func (pt *ProgressTracker) Finish(finalMessage string)
func (*ProgressTracker) SetTotal ¶ added in v0.1.14
func (pt *ProgressTracker) SetTotal(total int)
func (*ProgressTracker) Stop ¶ added in v0.1.14
func (pt *ProgressTracker) Stop()
func (*ProgressTracker) Update ¶ added in v0.1.14
func (pt *ProgressTracker) Update(current int)
type SpanFilter ¶
SpanFilter is a function type for filtering spans during parsing