Batch edit
batch_edit
BatchEditTool — atomic batch file editing for AI agents.
Registered as batch_edit via the axm.tools entry point.
BatchEditTool
Atomic batch file editing for AI agents.
Replaces, rewrites, creates, and deletes files in a single atomic
operation.
Registered as batch_edit via axm.tools entry point.
Source code in packages/axm-edit/src/axm_edit/tools/batch_edit.py
| Python | |
|---|---|
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | |
name
property
Tool name used for MCP registration.
execute(*, path='.', operations=None, lint=True, lint_diff=True, lint_diff_max_ratio=0.5, **kwargs)
Execute a batch of file operations atomically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Project root directory. |
'.'
|
operations
|
list[dict[str, object]] | None
|
List of operation dicts with |
None
|
lint
|
bool
|
Run ruff --fix on changed Python files after apply. |
True
|
lint_diff
|
bool
|
Surface per-file diffs of post-lint mutations. |
True
|
lint_diff_max_ratio
|
float
|
Fallback threshold (diff / file size). |
0.5
|
Returns:
| Type | Description |
|---|---|
ToolResult
|
ToolResult with applied counts, the |
ToolResult
|
payload (a JSON string, not a SHA) to pass back to |
ToolResult
|
|
ToolResult
|
warnings and blocking verdict). A blocking preflight refuses the |
ToolResult
|
batch before any checkpoint or write, so the payload then |
ToolResult
|
carries no checkpoint at all. |
Source code in packages/axm-edit/src/axm_edit/tools/batch_edit.py
render_text(result, parsed, data)
Render a compact, git-style LLM-facing view of a batch result.
The header carries the global status — ✓ on success, or
✗ ROLLBACK on failure so a partial/aborted batch is impossible to
miss — followed by the modified/created/deleted/edits counts. Each
operated-on file is then listed with its op sigil and edit count, every
validation error is surfaced verbatim, and the full lint summary
(fixes, remaining errors, warnings, diffs) is appended. Nothing in
data is dropped; only its JSON structure is.