edit

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package edit provides targeted string replacement in files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inputs

type Inputs struct {
	FilePath   string `` /* 136-byte string literal not displayed */
	OldString  string `` /* 136-byte string literal not displayed */
	NewString  string `` /* 136-byte string literal not displayed */
	ReplaceAll bool   `json:"replace_all" jsonschema:"description=Replace all occurrences of old_string (default false)"`
}

Inputs defines the parameters for the Edit tool.

type Tool

type Tool struct {
	tool.Base
}

Tool implements targeted string replacement.

func New

func New() *Tool

New creates a new Edit tool.

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, args map[string]any) (string, error)

Execute performs the string replacement.

func (*Tool) Name

func (t *Tool) Name() string

Name returns the tool's identifier.

func (*Tool) Paths

func (t *Tool) Paths(ctx context.Context, args map[string]any) (read, write []string, err error)

Paths returns the filesystem paths this tool call will access.

func (*Tool) Post

func (t *Tool) Post(ctx context.Context, args map[string]any)

Post records that the file content is known after editing.

func (*Tool) Pre

func (t *Tool) Pre(ctx context.Context, args map[string]any) error

Pre enforces read-before-edit policy.

func (*Tool) Preview

func (t *Tool) Preview(ctx context.Context, args map[string]any) (string, error)

Preview generates a unified diff preview for confirmation dialogs.

func (*Tool) Schema

func (t *Tool) Schema() tool.Schema

Schema returns the provider-agnostic tool definition.

func (*Tool) WantsLSP

func (t *Tool) WantsLSP() bool

WantsLSP indicates that Edit produces source changes that benefit from LSP diagnostics.

Jump to

Keyboard shortcuts

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