write

package
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package write provides full-file write operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inputs

type Inputs struct {
	Path    string `json:"path"    jsonschema:"required,description=File path to write (absolute or relative)" validate:"required"`
	Content string `json:"content" jsonschema:"required,description=Complete file content to write"             validate:"required"`
}

Inputs defines the parameters for the Write tool.

type Tool

type Tool struct {
	tool.Base
}

Tool implements full-file writing.

func New

func New() *Tool

New creates a new Write tool.

func (*Tool) Execute

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

Execute writes content to the specified file path.

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 (the LLM just provided it).

func (*Tool) Pre

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

Pre enforces read-before-write on existing files when policy.Write is true.

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 Write produces source files that benefit from LSP diagnostics.

Jump to

Keyboard shortcuts

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