file

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxReadLines = 200

MaxReadLines はデフォルトの最大読み込み行数

Variables

This section is empty.

Functions

func ExecuteDeleteFile

func ExecuteDeleteFile(path string) (string, string, error)

ExecuteDeleteFile deletes a file permanently (with backup for Undo)

func ExecuteListBackups

func ExecuteListBackups(path string) string

ExecuteListBackups はファイルのバックアップ一覧を表示

func ExecuteListDir

func ExecuteListDir(path string) string

ExecuteListDir はディレクトリ一覧を取得

func ExecuteReadFile

func ExecuteReadFile(path string, startLine, endLine int) string

ExecuteReadFile はファイルを読み込む(行範囲指定対応) startLine, endLine が指定されている場合はその範囲のみ返す 指定がない場合は最初のMaxReadLines行を返す

func ExecuteRestoreBackup

func ExecuteRestoreBackup(path, backupPath string) (string, error)

ExecuteRestoreBackup はバックアップファイルからファイルを復元 path: 復元対象のファイルパス(オリジナルファイル) backupPath: 特定のバックアップファイルパス(オプション)

func ExecuteStrReplace

func ExecuteStrReplace(path, oldStr, newStr, startLineStr, endLineStr string) (string, string, error)

ExecuteStrReplace はファイル内の文字列を置換

Behavior: - old_str が非空の場合: 既存の文字列置換モード(old_str優先、従来挙動を維持) - old_str が空 かつ start_line/end_line が両方指定の場合: 行レンジ置換モード

NOTE: - 行レンジは 1-indexed inclusive(start_line=1 は先頭行) - start/end は範囲外の場合エラー(delete_lines とは異なりクランプしない)

func ExecuteWriteFile

func ExecuteWriteFile(path string, content string) (string, string, error)

ExecuteWriteFile はファイルに書き込む

func RegisterTools

func RegisterTools(r *tools.Registry)

RegisterTools registers all file tools to the given registry

Types

type DeleteFileTool

type DeleteFileTool struct{}

DeleteFileTool wraps delete_file execution

func (*DeleteFileTool) Description added in v0.44.0

func (t *DeleteFileTool) Description() string

func (*DeleteFileTool) Name

func (t *DeleteFileTool) Name() string

func (*DeleteFileTool) Parameters added in v0.44.0

func (t *DeleteFileTool) Parameters() map[string]interface{}

func (*DeleteFileTool) Run

func (t *DeleteFileTool) Run(args map[string]string) (string, *tools.FileChange, error)

type ListBackupsTool

type ListBackupsTool struct{}

ListBackupsTool wraps list_backups execution

func (*ListBackupsTool) Description added in v0.44.0

func (t *ListBackupsTool) Description() string

func (*ListBackupsTool) Name

func (t *ListBackupsTool) Name() string

func (*ListBackupsTool) Parameters added in v0.44.0

func (t *ListBackupsTool) Parameters() map[string]interface{}

func (*ListBackupsTool) Run

func (t *ListBackupsTool) Run(args map[string]string) (string, *tools.FileChange, error)

type ListDirTool

type ListDirTool struct{}

ListDirTool wraps list_dir execution

func (*ListDirTool) Description added in v0.44.0

func (t *ListDirTool) Description() string

func (*ListDirTool) Name

func (t *ListDirTool) Name() string

func (*ListDirTool) Parameters added in v0.44.0

func (t *ListDirTool) Parameters() map[string]interface{}

func (*ListDirTool) Run

func (t *ListDirTool) Run(args map[string]string) (string, *tools.FileChange, error)

type ReadFileTool

type ReadFileTool struct{}

ReadFileTool needs special handling for optional line range

func (*ReadFileTool) Description added in v0.44.0

func (t *ReadFileTool) Description() string

func (*ReadFileTool) Name

func (t *ReadFileTool) Name() string

func (*ReadFileTool) Parameters added in v0.44.0

func (t *ReadFileTool) Parameters() map[string]interface{}

func (*ReadFileTool) Run

func (t *ReadFileTool) Run(args map[string]string) (string, *tools.FileChange, error)

type RestoreBackupTool

type RestoreBackupTool struct{}

RestoreBackupTool wraps restore_backup execution

func (*RestoreBackupTool) Description added in v0.44.0

func (t *RestoreBackupTool) Description() string

func (*RestoreBackupTool) Name

func (t *RestoreBackupTool) Name() string

func (*RestoreBackupTool) Parameters added in v0.44.0

func (t *RestoreBackupTool) Parameters() map[string]interface{}

func (*RestoreBackupTool) Run

func (t *RestoreBackupTool) Run(args map[string]string) (string, *tools.FileChange, error)

type StrReplaceTool

type StrReplaceTool struct{}

StrReplaceTool wraps str_replace execution

func (*StrReplaceTool) Description added in v0.44.0

func (t *StrReplaceTool) Description() string

func (*StrReplaceTool) Name

func (t *StrReplaceTool) Name() string

func (*StrReplaceTool) Parameters added in v0.44.0

func (t *StrReplaceTool) Parameters() map[string]interface{}

func (*StrReplaceTool) Run

func (t *StrReplaceTool) Run(args map[string]string) (string, *tools.FileChange, error)

type WriteFileTool

type WriteFileTool struct{}

WriteFileTool wraps write_file execution

func (*WriteFileTool) Description added in v0.44.0

func (t *WriteFileTool) Description() string

func (*WriteFileTool) Name

func (t *WriteFileTool) Name() string

func (*WriteFileTool) Parameters added in v0.44.0

func (t *WriteFileTool) Parameters() map[string]interface{}

func (*WriteFileTool) Run

func (t *WriteFileTool) Run(args map[string]string) (string, *tools.FileChange, error)

Jump to

Keyboard shortcuts

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