util

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeClaudeProjectPath

func DecodeClaudeProjectPath(encoded string) string

func EncodeClaudeProjectPath

func EncodeClaudeProjectPath(absPath string) string

func EscapeLike added in v0.1.7

func EscapeLike(s string) string

EscapeLike escapes % and _ for use in SQL LIKE patterns with a fixed prefix/suffix.

func FileMtime

func FileMtime(path string) (time.Time, error)

func FirstUserSnippet

func FirstUserSnippet(text string, max int) string

func FormatRelative added in v0.1.4

func FormatRelative(t time.Time) string

FormatRelative returns a human-readable relative time (e.g. "3m ago", "5d ago").

func JSONMarshal

func JSONMarshal(v any) ([]byte, error)

func JSONUnmarshal

func JSONUnmarshal(data []byte, v any) error

func MatchID

func MatchID(id, query string) bool

func NormalizeProjectPath added in v0.1.4

func NormalizeProjectPath(path string) string

NormalizeProjectPath cleans a project path and resolves symlinks when possible.

func ParseTime

func ParseTime(s string) time.Time

func ReadJSONLLines

func ReadJSONLLines(path string, maxLines int, fn func(line []byte) error) error

func ScanJSONLEdges added in v0.1.3

func ScanJSONLEdges(path string, headLines int, tailChunk int64, match func(line []byte) bool) bool

ScanJSONLEdges checks the first headLines and trailing tailChunk bytes for a matching line.

func TailJSONLLines

func TailJSONLLines(path string, maxLines int) ([][]byte, error)

func TildePath added in v0.1.1

func TildePath(p string) string

TildePath replaces the user home directory prefix with ~.

func TruncateRunes added in v0.1.7

func TruncateRunes(s string, n int) string

TruncateRunes shortens s to at most n runes without splitting UTF-8 code points.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL