filesystem

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxReadSize  int64    // maximum file size to read
	AllowedPaths []string // allowed base paths (empty = all)
	BlockedPaths []string // paths that are always denied
}

Config holds filesystem tool configuration

type FileInfo

type FileInfo struct {
	Path    string `json:"path"`
	Name    string `json:"name"`
	Size    int64  `json:"size"`
	IsDir   bool   `json:"isDir"`
	ModTime int64  `json:"modTime"`
	Mode    string `json:"mode"`
}

FileInfo represents file metadata

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool provides filesystem operations

func New

func New(cfg Config) *Tool

New creates a new filesystem tool

func (*Tool) Copy

func (t *Tool) Copy(src, dst string) error

Copy copies a file

func (*Tool) Delete

func (t *Tool) Delete(path string) error

Delete removes a file or directory

func (*Tool) Edit

func (t *Tool) Edit(path string, startLine, endLine int, newContent string) error

Edit replaces content in a file between specified lines

func (*Tool) Exists

func (t *Tool) Exists(path string) (bool, error)

Exists checks if a path exists

func (*Tool) ListDir

func (t *Tool) ListDir(path string) ([]FileInfo, error)

ListDir lists contents of a directory

func (*Tool) Mkdir

func (t *Tool) Mkdir(path string) error

Mkdir creates a directory

func (*Tool) Read

func (t *Tool) Read(path string) (string, error)

Read reads a file and returns its contents

func (*Tool) ReadLines

func (t *Tool) ReadLines(path string, startLine, endLine int) (string, error)

ReadLines reads specific lines from a file

func (*Tool) Write

func (t *Tool) Write(path, content string) error

Write writes content to a file (atomic write)

Jump to

Keyboard shortcuts

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