fs — Filesystem

Read, write, list, move, and delete files and directories. Enable with "fs" in your tools array.

Functions

FunctionDescription
fs.read(path)Read a file and return its contents as a string
fs.write(path, content)Write content to a file, creating it if needed
fs.append(path, content)Append content to an existing file
fs.delete(path)Delete a file or empty directory
fs.list(dir)List files and directories in a path
fs.exists(path)Return true if the path exists
fs.mkdir(path)Create a directory (and parents) if it doesn't exist
fs.move(src, dest)Move or rename a file or directory
fs.copy(src, dest)Copy a file or directory

Example task

terminal
testy-claw run "add a .editorconfig file with 2-space indent for JS/TS files"

  ✓ fs.write(".editorconfig", "root = true\n[*.{js,ts}]\nindent_size = 2\n...")
  ✓ Done in 0.6s

Safety notes

The fs tool operates relative to the current working directory. It cannot read or write outside the project root by default. Absolute paths outside the CWD are blocked unless allowAbsolutePaths: true is set in config.