WardrikWorkspace.Tools (wardrik_workspace v0.1.0-rc.1)

Copy Markdown

Builds the six file tools.

ToolArgumentsAnswers
read_filepath, offset, limitNumbered lines, at most 2,000 or 128 KB, and the version
write_filepath, content, version, appendThe new version
edit_filepath, old, new, allHow many places changed
list_filespattern (a glob)Paths, newest first, at most 500
search_filespattern (a regex), glob, contextMatching lines, at most 200
delete_filepathWhether the file was there

write_file needs the version read to replace an existing file. With append, it needs none. edit_file needs old to appear exactly once, unless all is true.

A tool that fails answers %{ok: false, error: %{code: ..., message: ...}}. The turn carries on.

Each call's :resources is its path, or the glob it lists or searches. A policy can match it, as write_file(notes/*).

Summary

Functions

Returns the file tools over spec.

Returns a tool's failure answer, with code and message.

Functions

build(spec)

Returns the file tools over spec.

failed(code, message)

@spec failed(atom(), String.t()) :: {:ok, map()}

Returns a tool's failure answer, with code and message.