util

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLineNumbers

func AddLineNumbers(content string) string

AddLineNumbers takes a string of content and returns a new string with line numbers prefixed

func ExpandGlob

func ExpandGlob(pattern, path string) ([]string, error)

ExpandGlob enumerates files under path using ripgrep, then filters them by the given glob pattern using doublestar. Returns matching paths sorted by modification time.

func IsPathContained

func IsPathContained(directory string, path string) (bool, error)

isPathContained attempts to verify whether `path` is the same as or contained within `directory`. It is overly cautious, returning false even if `path` IS contained within `directory`, but the two paths use different casing, and we happen to be on a case-insensitive filesystem. This is ultimately to attempt to stop an LLM from going outside of where I tell it to. Additional layers of security should be considered.. run in a VM/container.

func IsPathWithinCWD

func IsPathWithinCWD(path string) (bool, string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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