Modes: preview/apply or execute.
Use execute for routine changes.
Use preview/apply when learning a mutation command or inspecting a large multi-step request before writing files.

If a name is ambiguous, use selectors.
Run help selectors to refresh selector syntax.

refactor batch runs related mutation requests together.
Use it when one workflow needs ordered steps, such as rename plus move.

Use modulePlan when the main intent is only to split one large file into target modules.
Use refactor batch when the split also includes coordinated renames or mixed mutation steps.

refactor batch preview --stdin
refactor batch execute --stdin
refactor batch apply --stdin

Use preview/apply when you want to inspect a large mixed plan before writing files.
Use execute when you want to write immediately.
Use --from with captured input handles when rerunning edited large batches.

Example: rename and move in one request

Run:
aib refactor batch execute --stdin

Input:
{
  "sourceFile": "src/service.ts",
  "requests": [
    {
      "op": "rename",
      "renames": {
        "oldHelper": "newHelper",
        "oldType": "newType"
      }
    },
    {
      "op": "move",
      "targetFile": "src/service.helpers.ts",
      "entities": ["newHelper"]
    },
    {
      "op": "move",
      "targetFile": "src/service.types.ts",
      "entities": ["newType"]
    }
  ]
}

If a large or partial refactor batch fails, edit the captured input file and rerun with --from.
For small one-off refactor requests, write a corrected request instead.

Latest refactor input:
<session-dir>/inputs/refactor/_last.json

Handle:
aib:input:refactor:last

Example:
refactor batch execute --from aib:input:refactor:last
