hashline_edit

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: 11 Imported by: 0

Documentation

Overview

Package hashline_edit implements LINE#ID-anchored file edits.

Each edit cites a position as "<lineNumber>#<3-char tag>" (e.g. "42#VKM"). The tag is the content-hash of the line as it existed when the model saw it (via view with hashline=true). Before applying, every claimed tag is recomputed against the live file. If any tag is stale, the whole batch is rejected and the file is left untouched, no partial writes.

Edits are applied bottom-up (highest line number first) so each edit's line number stays valid even after earlier edits change line counts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() tools.Tool

New returns a fresh hashline_edit tool.

func NewWithFilter

func NewWithFilter(pathRe *regexp.Regexp) tools.Tool

NewWithFilter constructs the hashline_edit tool with an optional path regex. When pathRe is nil, all paths are allowed (existing behavior). When pathRe is non-nil, edits to paths that do NOT match are rejected with a clear error and the file is left untouched. Paths are matched relative to the current working directory when possible.

Types

type Tool

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

Tool is the hashline_edit tool.

func (*Tool) Run

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

Run validates and applies the batch atomically.

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