Skip to main content

Module tools

Module tools 

Source
Expand description

First-class Rust tool implementations for Lua.

Provides native Rust implementations of common operations, exposed as orcs.* functions in Lua. These replace subprocess-based equivalents (cat, grep, find) with type-safe, structured results.

§Available Tools

Lua APIDescription
orcs.read(path)Read file contents
orcs.write(path, content)Write file contents (atomic)
orcs.grep(pattern, path)Search file contents with regex
orcs.glob(pattern, dir?)Find files by glob pattern
orcs.mkdir(path)Create directory (with parents)
orcs.remove(path)Remove file or directory
orcs.mv(src, dst)Move / rename

§Security

All file operations are sandboxed via SandboxPolicy. Paths are validated through the sandbox before any I/O occurs. The sandbox is injected at registration time — no implicit current_dir() dependency.

Functions§

register_tool_functions
Registers all tool functions in the Lua orcs table.