Documentation
¶
Overview ¶
Package smartedit implements the file editing tool with atomic multi-file transactions, formatting, compiler gates, and spelling aids.
Index ¶
- func ExecuteEdits(ctx context.Context, session *mcp.ServerSession, edits []FileEdit) (*mcp.CallToolResult, error)
- func Handler(ctx context.Context, req *mcp.CallToolRequest, args SingleEditParams) (*mcp.CallToolResult, any, error)
- func Register(server *mcp.Server)
- type FileBackup
- type FileEdit
- type SingleEditParams
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
func Handler( ctx context.Context, req *mcp.CallToolRequest, args SingleEditParams, ) (*mcp.CallToolResult, any, error)
Handler handles the smart_edit tool execution.
Types ¶
type FileBackup ¶ added in v0.34.0
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.
Click to show internal directories.
Click to hide internal directories.