Skip to Content

Files

Four tools, list_files, read_files, write_files and delete_files, read and write the app/ tree; each write is all-or-nothing, saves an automatic copy and returns a check result.

Writing files never deploys. The dashboard preview updates after each write; the live app changes only on deploy.

list_files

Lists file paths with their kind (page, layout, handler…) and size in bytes.

  • Parameters: project; prefix to list one folder only, for example app/orders/.
  • Returns: one line per file: path, kind, size.
  • When the agent calls it: before changing an existing project, to see where things are.

read_files

Reads one or more files.

  • Parameters: project; paths: 1–50 paths.
  • Returns: each file’s content, up to 90 KB per call. Files past that are listed as skipped, to read in another call. A single file bigger than 90 KB comes back cut to its first part, marked with its full size.
  • When the agent calls it: before editing a file, to get the exact current text.

Files manh.run generates (app/api.ts, app/hooks.ts, the users files generated from app/auth.ts) can be read and are marked read-only. To change them, change the source: handlers for app/api.ts, app/auth.ts for the users files.

write_files

Creates files, replaces whole files, patches parts of existing files and deletes files in one write. Then it runs the first three check layers on the new tree.

  • Parameters:
    • files: full contents, as [{ "path": "app/x/get.ts", "content": "…" }] or { "app/x/get.ts": "…" }.
    • edits: patches { path, find, replace, all? }. find must match the current text exactly, whitespace included, and only once; all: true replaces every match.
    • delete: paths to remove.
    • npm: picks the version of a backend npm package, for example { "jose": "^5" }. Without it, a new package is pinned to its latest version on first import.
  • Returns: how many files were written, patched and deleted; the automatic copy’s id, if one was saved; renamed files; newly pinned packages; the check result; the Progress section.
  • When the agent calls it: once or twice per phase: tables and repositories, then handlers, then the layout and pages. For a few-line fix it sends edits, not the whole file.

A write is all-or-nothing: one bad path or one patch that does not match, and nothing is written. Only paths under app/ are accepted. A .ts file is renamed to .tsx only when it is clearly frontend: it holds JSX, or a .tsx file imports it, and no backend file imports it. Every rename is listed in the result. A .ts helper written on its own keeps .ts.

Before a write changes or removes an existing file, manh.run saves an automatic copy of the whole tree, so every write can be undone. The 10 newest automatic copies are kept.

delete_files

Removes files from app/, then checks the remaining tree. Only on the /directory URL; the full set deletes with the delete argument of write_files.

  • Parameters: project; paths: paths to remove, for example app/orders/delete.ts.
  • Returns: the same as write_files.
  • When the agent calls it: when it drops a feature or moves files.

Next steps

Last updated