Docs v1.2.0

Find & Replace

When a change has to land in many files at once (renaming a function everywhere, updating a version string, swapping an old API for a new one), TatsuCode doesn't run a risky script. It previews every single edit first, leaves out the ones that shouldn't change, writes the rest, and can undo the whole batch in one step.

It can also add a license or copyright header to a whole folder of files.


What You Can Ask

Rename GetUserById to FindUser across the project
Replace the old API base URL with the new one in every config file
Change "Copyright 2025" to "Copyright 2026" in all source files
Add an MIT license header to every .ts file under src
Undo that rename


How It Works

StepWhat happens
1. PreviewTatsuCode finds every match and shows each edit as a line before and after, with the change marked. Nothing is written yet.
2. ReviewThe agent (or you) leaves out any edit, file, or path that shouldn't change, or keeps only the ones that should.
3. ApplyThe remaining edits are written. The chat shows the changed files' diffs (the first 20), and every changed file gets an undo snapshot.
4. Undo, if neededThe whole batch goes back in one step.

The chat shows each step as its own card: Replace: Preview, Replace: Apply, and Replace: Revert.

Safe by design

  • Files that changed after the preview are skipped, never overwritten. If you or another tool edited a file between the preview and the apply, that file is left alone and listed.
  • Binary, read-only, and version-control files are never touched. Neither are protected system folders.
  • Every file keeps its format: its text encoding, byte-order mark, and line endings stay exactly as they were, so your diffs show only the real change.
  • Matching is case-sensitive by default, so User doesn't also change user.
  • Outside your project, it asks first. Applying edits to files outside the project needs your approval.
  • No half-done plans: if a change would touch more than 2,000 files or make more than 20,000 edits, the agent is asked to narrow it down instead of applying part of it. A single file with more than 5,000 matches is skipped and listed.

Undoing a batch

Undo puts back every file in the batch that hasn't changed since. A file you've edited since is skipped and stays in the batch, so it can be undone later, for example after undoing a newer batch that also changed it. Individual files can still be undone on their own through File History.

A preview stays ready for 30 minutes (the three newest are kept), and the ten most recent batches can be undone during the session.


Adding Headers

Ask for a header on a set of files and TatsuCode previews it like any other change:

  • It goes at the top of each file, after anything that must stay first: a #! line, an XML, PHP, or DOCTYPE opener, a @charset rule, a YAML version line, an encoding comment, or a batch file's @echo off.
  • It can be wrapped in each file's own comment style (//, #, <!-- -->, and so on).
  • It's never added twice: files that already contain it are skipped.
  • It can include the year, the date, the date and time, or the file's name ({year}, {date}, {datetime}, {file}), filled in per file.

Add "Copyright {year} Studio Example. All rights reserved." as a comment at the top of every .cs file


Patterns and Regular Expressions

Plain text is the default. For changes that follow a pattern, the agent can use .NET regular expressions, reuse what it matched in the replacement ($1 for the first group, ${name} for a named group, $$ for a literal dollar sign), and match text that spans several lines, even when its indentation differs from file to file. It can also limit the change to whole words, to code comments only, or to certain file types and folders.


Instead of Shell Scripts

When an agent reaches for an in-place rewrite (sed -i, perl -pi, PowerShell -replace piped into Set-Content, or a Python find-and-replace loop), TatsuCode points it to Find & Replace instead. A single wrong pattern in a script can silently damage many files at once; a preview shows exactly what will change before anything does.

Claude Code has Find & Replace too, alongside its own editing tools. See Claude Code.


Next Steps

Type to search documentation

Use ↑ ↓ to navigate, Enter to select