fstools

package
v0.0.0-...-dc91ecb Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReadDirTool chat.Tool = readDirTool{}

ReadDirTool is the tool definition for the ReadDir function

View Source
var ReadFileTool chat.Tool = readFileTool{}

ReadFileTool is the tool definition for the ReadFile function

View Source
var WriteFileTool chat.Tool = writeFileTool{}

WriteFileTool is the tool definition for the WriteFile function

Functions

func GetFS

func GetFS(ctx context.Context) (fs.FS, error)

GetFS retrieves the filesystem from the context.

func WithFS

func WithFS(ctx context.Context, f fs.FS) context.Context

WithFS adds an fs.FS to the context for downstream tool calls.

Types

type FileInfo

type FileInfo struct {
	Name  string `json:"name"`
	IsDir bool   `json:"isDir"`
	Size  int64  `json:"size"`
}

FileInfo contains information about a file

type ReadDirRequest

type ReadDirRequest struct {
	Path string `json:"path,omitzero"` // Directory path to read (defaults to "." for root)
}

ReadDirRequest is the input for ReadDir

type ReadDirResult

type ReadDirResult struct {
	Files []FileInfo `json:"files"`
}

ReadDirResult is the output of ReadDir

func ReadDir

func ReadDir(ctx context.Context, req ReadDirRequest) (ReadDirResult, error)

ReadDir reads a directory from the test filesystem

type ReadFileRequest

type ReadFileRequest struct {
	FileName string `json:"fileName"`
}

ReadFileRequest is the input for ReadFile

type ReadFileResult

type ReadFileResult struct {
	Content string `json:"content"`
}

ReadFileResult is the output of ReadFile

func ReadFile

func ReadFile(ctx context.Context, req ReadFileRequest) (ReadFileResult, error)

ReadFile reads a file from the test filesystem

type WriteFileRequest

type WriteFileRequest struct {
	FileName string `json:"fileName"`
	Content  string `json:"content"`
}

WriteFileRequest is the input for WriteFile

type WriteFileResult

type WriteFileResult struct {
	Success bool `json:"success"`
}

WriteFileResult is the output of WriteFile

func WriteFile

func WriteFile(ctx context.Context, req WriteFileRequest) (WriteFileResult, error)

WriteFile writes a file to the test filesystem

Jump to

Keyboard shortcuts

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