gotool

package
v0.0.68 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadFileFuncID      = "github.com/flexigpt/flexigpt-app/internal/builtin/gotool/fs.ReadFile"
	ListDirectoryFuncID = "github.com/flexigpt/flexigpt-app/internal/builtin/gotool/fs.ListDirectory"
	SearchFilesFuncID   = "github.com/flexigpt/flexigpt-app/internal/builtin/gotool/fs.SearchFiles"
	StatPathFuncID      = "github.com/flexigpt/flexigpt-app/internal/builtin/gotool/fs.StatPath"
	InspectImageFuncID  = "github.com/flexigpt/flexigpt-app/internal/builtin/gotool/fs.InspectImage"
)

Variables

This section is empty.

Functions

func ReadFile

ReadFile reads a file from disk and returns its contents. If Encoding == "binary" the output is base64-encoded.

Types

type InspectImageArgs

type InspectImageArgs struct {
	Path string `json:"path"`
}

type InspectImageOut

type InspectImageOut struct {
	Exists    bool       `json:"exists"`
	Width     int        `json:"width,omitempty"`
	Height    int        `json:"height,omitempty"`
	Format    string     `json:"format,omitempty"`
	SizeBytes int64      `json:"sizeBytes,omitempty"`
	ModTime   *time.Time `json:"modTime,omitempty"`
}

func InspectImage

func InspectImage(ctx context.Context, args InspectImageArgs) (*InspectImageOut, error)

InspectImage inspects an image file and returns its intrinsic metadata.

type ListDirectoryArgs

type ListDirectoryArgs struct {
	Path    string `json:"path,omitempty"`    // default "."
	Pattern string `json:"pattern,omitempty"` // Optional glob
}

type ListDirectoryOut

type ListDirectoryOut struct {
	Entries []string `json:"entries"`
}

func ListDirectory

func ListDirectory(_ context.Context, args ListDirectoryArgs) (*ListDirectoryOut, error)

ListDirectory lists files / dirs in Path. If Pattern is supplied, the results are filtered via filepath.Match.

type ReadFileArgs

type ReadFileArgs struct {
	Path     string `json:"path"`               // required
	Encoding string `json:"encoding,omitempty"` // "text" (default) | "binary"
}

type SearchFilesArgs

type SearchFilesArgs struct {
	Root       string `json:"root,omitempty"` // default "."
	Pattern    string `json:"pattern"`        // required (RE2)
	MaxResults int    `json:"maxResults,omitempty"`
}

type SearchFilesOut

type SearchFilesOut struct {
	Matches []string `json:"matches"`
}

func SearchFiles

func SearchFiles(_ context.Context, args SearchFilesArgs) (*SearchFilesOut, error)

SearchFiles walks Root (recursively) and returns up to MaxResults files whose *path* or *UTF-8 text content* match the supplied regexp.

type StatPathArgs

type StatPathArgs struct {
	Path string `json:"path"`
}

type StatPathOut

type StatPathOut struct {
	Exists    bool       `json:"exists"`
	IsDir     bool       `json:"isDir"`
	SizeBytes int64      `json:"sizeBytes,omitempty"`
	ModTime   *time.Time `json:"modTime,omitempty"`
}

func StatPath

func StatPath(_ context.Context, args StatPathArgs) (*StatPathOut, error)

StatPath returns basic metadata for the supplied path without mutating the file system.

Jump to

Keyboard shortcuts

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