smartedit

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package smartedit implements the file editing tool with atomic multi-file transactions, formatting, compiler gates, and spelling aids.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteEdits

func ExecuteEdits(ctx context.Context, session *mcp.ServerSession, edits []FileEdit) (*mcp.CallToolResult, error)

ExecuteEdits performs a set of file edits atomically in a compiler-verified transaction.

func Handler added in v0.33.0

Handler handles the smart_edit tool execution.

func Register

func Register(server *mcp.Server)

Register registers the smart_edit tool with the server.

Types

type FileBackup added in v0.34.0

type FileBackup struct {
	Content []byte
	Mode    os.FileMode
	Existed bool
}

FileBackup stores original file state for rollback and permission restoration.

type FileEdit

type FileEdit struct {
	Filename   string  `json:"filename" jsonschema:"Absolute file path to edit. Required. Relative paths are rejected."`
	OldContent string  `json:"old_content,omitempty" jsonschema:"The block of code to find (ignores whitespace)"`
	NewContent string  `json:"new_content" jsonschema:"The new code to insert"`
	StartLine  int     `json:"start_line,omitempty" jsonschema:"Restrict search window to line number >= start_line"`
	EndLine    int     `json:"end_line,omitempty" jsonschema:"Restrict search window to line number <= end_line"`
	Threshold  float64 `json:"threshold,omitempty" jsonschema:"Similarity threshold (0.0-1.0) for fuzzy match"`
	Append     bool    `json:"append,omitempty" jsonschema:"Append new_content to end of file"`
}

FileEdit represents a single edit operation inside an atomic transaction.

type SingleEditParams

type SingleEditParams = FileEdit

SingleEditParams defines the input parameters for the smart_edit single file edit tool.

Jump to

Keyboard shortcuts

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