smartedit

package
v0.33.0 Latest Latest
Warning

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

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

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 FileEdit

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

FileEdit represents a single edit operation inside an atomic transaction.

type SingleEditParams

type SingleEditParams struct {
	//nolint:lll
	Filename string `json:"filename" jsonschema:"The absolute path to the file to edit. Required. Relative paths are rejected."`
	//nolint:lll
	OldContent string `json:"old_content,omitempty" jsonschema:"Optional: The block of code to find (ignores whitespace)"`
	NewContent string `json:"new_content" jsonschema:"The new code to insert"`
	//nolint:lll
	StartLine int `json:"start_line,omitempty" jsonschema:"Optional: restrict search window to line number >= start_line"`
	//nolint:lll
	EndLine int `json:"end_line,omitempty" jsonschema:"Optional: restrict search window to line number <= end_line"`
	//nolint:lll
	Threshold float64 `json:"threshold,omitempty" jsonschema:"Optional: similarity threshold (0.0-1.0) for fuzzy matching (default 0.95)"`
	//nolint:lll
	Append bool `json:"append,omitempty" jsonschema:"Optional: append new_content to end of file"`
}

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