بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ

Keep your code organized as it grows

Move files and rename symbols with every reference updated, in one call. Your agent keeps its tokens for the actual work.

Pre-alpha, and for Linux only.

Why a clean file tree is worth keeping

A tidy tree is easier to work in

Folders that say what lives in them make a project quicker to read for you and quicker to search for an agent. The more your code grows, the more that structure is worth.

Keeping it tidy should not be costly

Moving a file by hand means a search, then a read and an edit for every file that imports it. Done through an agent, all of that goes through its context. With refac it is one call, and the agent keeps its tokens for the actual work.

The rewriting is not guesswork

refac asks each language's own tooling, a language server where there is one, which references point at the thing, and rewrites those. Add --dry-run to see the plan first. After a change your project should inshallah build the way it did before.

Move a file, and every import follows

Here is a move in TypeScript. The import lines in the three files that use it are rewritten by the same call.

Terminal
refac move --source-path src/utils/format.ts --target-path src/lib/format.ts
Project
  • src
  • app.ts
  • cart
  • cart.ts
  • lib
  • tax.ts
  • order
  • order.ts
  • utils
  • date.ts
  • format.ts
Files that import it
  • src/app.ts
    import { money } from "./utils/format";
  • src/cart/cart.ts
    import { money } from "../utils/format";
  • src/order/order.ts
    import { money } from "../utils/format";
One call moves the file and rewrites the 3 imports that point at it.

By hand, typically 9 calls

  1. 1mv src/utils/format.ts src/lib/format.ts
  2. 2rg utils/format
  3. 3read src/app.ts
  4. 4edit src/app.ts
  5. 5read src/cart/cart.ts
  6. 6edit src/cart/cart.ts
  7. 7read src/order/order.ts
  8. 8edit src/order/order.ts
  9. 9tsc --noEmit

With refac, 1 call

1refac move --source-path src/utils/format.ts --target-path src/lib/format.ts

The more files import the one you move, the longer the left column grows. The right one stays a single line.

Made for the agent that has no IDE

refac is a plain command. A language server is started for one command and stopped when it ends, so nothing stays running.

A skill file, no MCP server
The repository ships a skill folder, .agents/skills/refac-cli/. Drop it into your agent setup and it loads only when it is relevant, with no server to run and no standing context. How to get it.
Output an agent can parse
With --json a command prints one document with status, operation and the fields of that operation. A failure prints status and error on stderr.
Help in three depths
refac move -h is a few lines, refac move --help is everything about one command, and refac guide holds the in-depth topics.
refac move --dry-run --json …
{
  "status": "ok",
  "operation": "move",
  "dry_run": true,
  "moved_paths": 1,
  "edited_files": 3,
  "edits": 3,
  "files": [
    { "path": "src/app.ts", "edits": 1 },
    { "path": "src/cart/cart.ts", "edits": 1 },
    { "path": "src/order/order.ts", "edits": 1 }
  ],
  "moves": [
    { "from": "src/utils/format.ts", "to": "src/lib/format.ts" }
  ],
  "notes": []
}

Seven languages, each with its own tooling

refac asks the tool that already understands your language, so a move follows that language's own rules.

Try it on a branch.

refac is pre-alpha and built for the author's own use first. Commands, output and behavior change when the author needs them to. Run it on a branch, read the diff, and let your own build and tests tell you the rest.

I am Javed. More about me and my work is at javedab.com.