fileedittool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package fileedittool implements the Edit tool — targeted string replacement in files. Mirrors src/tools/FileEditTool/FileEditTool.ts.

Core contract (from TS source + decoded binary):

  • old_string must appear exactly once in the file (or replace_all=true)
  • old_string == new_string is rejected
  • old_string == "" creates a new file with new_string as content
  • Quote normalization: curly quotes in file match straight quotes from model
  • Atomic write: temp file + rename, preserves permissions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	FilePath   string `json:"file_path"`
	OldString  string `json:"old_string"`
	NewString  string `json:"new_string"`
	ReplaceAll bool   `json:"replace_all,omitempty"`
}

Input is the typed view of the JSON input.

type Tool

type Tool struct{}

Tool implements the Edit tool.

func New

func New() *Tool

New returns a fresh Edit tool.

func (*Tool) Description

func (*Tool) Description() string

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, raw json.RawMessage) (tool.Result, error)

Execute applies the edit.

func (*Tool) InputSchema

func (*Tool) InputSchema() json.RawMessage

func (*Tool) IsConcurrencySafe

func (*Tool) IsConcurrencySafe(json.RawMessage) bool

func (*Tool) IsReadOnly

func (*Tool) IsReadOnly(json.RawMessage) bool

func (*Tool) Name

func (*Tool) Name() string

Jump to

Keyboard shortcuts

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