edit_diff

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package edit_diff implements the edit_diff tool: literal find/replace. One occurrence, all occurrences, or an expected-count guard for safety. Result echoes anchored lines around each affected region so a follow-up edit needs no re-read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tool

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

Tool is the edit_diff tool.

func New

func New(root string) *Tool

New returns an edit_diff tool rooted at root. Root is currently informational — callers pass absolute paths.

func NewWithFilter

func NewWithFilter(root string, pathRe *regexp.Regexp) *Tool

NewWithFilter constructs the edit_diff tool with an optional path regex. When pathRe is nil, all paths are allowed. When non-nil, edits to paths (relative to root when possible) that do NOT match are rejected before the file is touched.

func (*Tool) Run

func (t *Tool) Run(ctx context.Context, in map[string]any) (tools.Result, error)

Run performs the edit.

func (*Tool) Spec

func (t *Tool) Spec() llm.ToolSpec

Spec advertises the tool to the model.

Jump to

Keyboard shortcuts

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