fs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDirectoryTool

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

CreateDirectoryTool creates directories (mkdir -p equivalent).

func NewCreateDirectoryTool

func NewCreateDirectoryTool(workingDir string) *CreateDirectoryTool

func (*CreateDirectoryTool) BackfillInput

func (t *CreateDirectoryTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*CreateDirectoryTool) Call

func (t *CreateDirectoryTool) Call(
	ctx context.Context,
	input tool.CallInput,
	permissionCheck types.CanUseToolFn,
) (tool.CallResult, error)

func (*CreateDirectoryTool) CheckPermissions

func (*CreateDirectoryTool) Definition

func (t *CreateDirectoryTool) Definition() tool.Definition

func (*CreateDirectoryTool) Description

func (t *CreateDirectoryTool) Description(_ context.Context) (string, error)

func (*CreateDirectoryTool) FormatResult

func (t *CreateDirectoryTool) FormatResult(data any) string

func (*CreateDirectoryTool) IsConcurrencySafe

func (t *CreateDirectoryTool) IsConcurrencySafe(_ map[string]any) bool

func (*CreateDirectoryTool) IsEnabled

func (t *CreateDirectoryTool) IsEnabled() bool

func (*CreateDirectoryTool) IsReadOnly

func (t *CreateDirectoryTool) IsReadOnly(_ map[string]any) bool

func (*CreateDirectoryTool) PreparePermissionMatcher

func (t *CreateDirectoryTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error)

func (*CreateDirectoryTool) ValidateInput

func (t *CreateDirectoryTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type DirEntry

type DirEntry struct {
	Name        string `json:"name"`
	IsDirectory bool   `json:"is_directory"`
	IsFile      bool   `json:"is_file"`
	IsSymlink   bool   `json:"is_symlink"`
	SizeBytes   int64  `json:"size_bytes"`
	Mode        string `json:"mode"`
}

DirEntry represents a single entry in a directory listing.

type FileMetadata

type FileMetadata struct {
	Path        string `json:"path"`
	IsFile      bool   `json:"is_file"`
	IsDirectory bool   `json:"is_directory"`
	IsSymlink   bool   `json:"is_symlink"`
	// SymlinkTarget is set when IsSymlink is true.
	SymlinkTarget string    `json:"symlink_target,omitempty"`
	SizeBytes     int64     `json:"size_bytes"`
	Mode          string    `json:"mode"`
	ModifiedAt    time.Time `json:"modified_at"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	Exists        bool      `json:"exists"`
}

FileMetadata is the structured metadata returned by GetMetadataTool.

type GetMetadataTool

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

GetMetadataTool returns metadata (stat) for a path without reading its content.

func NewGetMetadataTool

func NewGetMetadataTool(workingDir string) *GetMetadataTool

func (*GetMetadataTool) BackfillInput

func (t *GetMetadataTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*GetMetadataTool) Call

func (*GetMetadataTool) CheckPermissions

func (*GetMetadataTool) Definition

func (t *GetMetadataTool) Definition() tool.Definition

func (*GetMetadataTool) Description

func (t *GetMetadataTool) Description(_ context.Context) (string, error)

func (*GetMetadataTool) FormatResult

func (t *GetMetadataTool) FormatResult(data any) string

func (*GetMetadataTool) IsConcurrencySafe

func (t *GetMetadataTool) IsConcurrencySafe(_ map[string]any) bool

func (*GetMetadataTool) IsEnabled

func (t *GetMetadataTool) IsEnabled() bool

func (*GetMetadataTool) IsReadOnly

func (t *GetMetadataTool) IsReadOnly(_ map[string]any) bool

func (*GetMetadataTool) PreparePermissionMatcher

func (t *GetMetadataTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error)

func (*GetMetadataTool) ValidateInput

func (t *GetMetadataTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type ListDirectoryTool

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

ListDirectoryTool lists the entries of a directory.

func NewListDirectoryTool

func NewListDirectoryTool(workingDir string) *ListDirectoryTool

func (*ListDirectoryTool) BackfillInput

func (t *ListDirectoryTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*ListDirectoryTool) Call

func (*ListDirectoryTool) CheckPermissions

func (*ListDirectoryTool) Definition

func (t *ListDirectoryTool) Definition() tool.Definition

func (*ListDirectoryTool) Description

func (t *ListDirectoryTool) Description(_ context.Context) (string, error)

func (*ListDirectoryTool) FormatResult

func (t *ListDirectoryTool) FormatResult(data any) string

func (*ListDirectoryTool) IsConcurrencySafe

func (t *ListDirectoryTool) IsConcurrencySafe(_ map[string]any) bool

func (*ListDirectoryTool) IsEnabled

func (t *ListDirectoryTool) IsEnabled() bool

func (*ListDirectoryTool) IsReadOnly

func (t *ListDirectoryTool) IsReadOnly(_ map[string]any) bool

func (*ListDirectoryTool) PreparePermissionMatcher

func (t *ListDirectoryTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error)

func (*ListDirectoryTool) ValidateInput

func (t *ListDirectoryTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type RemoveTool

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

RemoveTool deletes a file or directory with safety checks.

func NewRemoveTool

func NewRemoveTool(workingDir string) *RemoveTool

func (*RemoveTool) BackfillInput

func (t *RemoveTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*RemoveTool) Call

func (t *RemoveTool) Call(
	ctx context.Context,
	input tool.CallInput,
	permissionCheck types.CanUseToolFn,
) (tool.CallResult, error)

func (*RemoveTool) CheckPermissions

func (t *RemoveTool) CheckPermissions(_ context.Context, _ map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*RemoveTool) Definition

func (t *RemoveTool) Definition() tool.Definition

func (*RemoveTool) Description

func (t *RemoveTool) Description(_ context.Context) (string, error)

func (*RemoveTool) FormatResult

func (t *RemoveTool) FormatResult(data any) string

func (*RemoveTool) IsConcurrencySafe

func (t *RemoveTool) IsConcurrencySafe(_ map[string]any) bool

func (*RemoveTool) IsEnabled

func (t *RemoveTool) IsEnabled() bool

func (*RemoveTool) IsReadOnly

func (t *RemoveTool) IsReadOnly(_ map[string]any) bool

func (*RemoveTool) PreparePermissionMatcher

func (t *RemoveTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error)

func (*RemoveTool) ValidateInput

func (t *RemoveTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

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