Documentation
¶
Index ¶
- Constants
- func ExecuteDeleteFile(path string) (string, string, error)
- func ExecuteListBackups(path string) string
- func ExecuteListDir(path string) string
- func ExecuteReadFile(path string, startLine, endLine int) string
- func ExecuteRestoreBackup(path, backupPath string) (string, error)
- func ExecuteStrReplace(path, oldStr, newStr, startLineStr, endLineStr string) (string, string, error)
- func ExecuteWriteFile(path string, content string) (string, string, error)
- func RegisterTools(r *tools.Registry)
- type DeleteFileTool
- type ListBackupsTool
- type ListDirTool
- type ReadFileTool
- type RestoreBackupTool
- type StrReplaceTool
- type WriteFileTool
Constants ¶
const MaxReadLines = 200
MaxReadLines はデフォルトの最大読み込み行数
Variables ¶
This section is empty.
Functions ¶
func ExecuteDeleteFile ¶
ExecuteDeleteFile deletes a file permanently (with backup for Undo)
func ExecuteListBackups ¶
ExecuteListBackups はファイルのバックアップ一覧を表示
func ExecuteReadFile ¶
ExecuteReadFile はファイルを読み込む(行範囲指定対応) startLine, endLine が指定されている場合はその範囲のみ返す 指定がない場合は最初のMaxReadLines行を返す
func ExecuteRestoreBackup ¶
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 ¶
ExecuteWriteFile はファイルに書き込む
func RegisterTools ¶
RegisterTools registers all file tools to the given registry
Types ¶
type DeleteFileTool ¶
type DeleteFileTool struct{}
DeleteFileTool wraps delete_file execution
func (*DeleteFileTool) Name ¶
func (t *DeleteFileTool) Name() string
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) Name ¶
func (t *ListBackupsTool) Name() string
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) Name ¶
func (t *ListDirTool) Name() string
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) Name ¶
func (t *ReadFileTool) Name() string
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) Name ¶
func (t *RestoreBackupTool) Name() string
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) Name ¶
func (t *StrReplaceTool) Name() string
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) Name ¶
func (t *WriteFileTool) Name() string
func (*WriteFileTool) Run ¶
func (t *WriteFileTool) Run(args map[string]string) (string, *tools.FileChange, error)