WardrikWorkspace. Tools
(wardrik_workspace v0.1.0-rc.1)
Copy Markdown
Builds the six file tools.
| Tool | Arguments | Answers |
|---|---|---|
read_file | path, offset, limit | Numbered lines, at most 2,000 or 128 KB, and the version |
write_file | path, content, version, append | The new version |
edit_file | path, old, new, all | How many places changed |
list_files | pattern (a glob) | Paths, newest first, at most 500 |
search_files | pattern (a regex), glob, context | Matching lines, at most 200 |
delete_file | path | Whether 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
@spec build(WardrikWorkspace.Spec.t()) :: [WardrikCore.Tool.t()]
Returns the file tools over spec.
Returns a tool's failure answer, with code and message.