Commit
commit
GitCommitTool — batched atomic commits with commit-hook handling.
GitCommitTool
Bases: AXMTool
Execute one or more atomic commits in a single call.
Each commit in the batch is processed sequentially: stage files,
run git commit (the repo's commit hooks fire automatically), and
capture the result. If a commit fails (e.g. a hook rejects it),
processing stops and the error is returned alongside any commits
that already succeeded.
When a commit hook auto-fixes files (e.g. ruff --fix),
the tool automatically re-stages and retries the commit once.
Verdict-Carrying Patch invariant — when a hook mutates staged
content on the autofix-retry path, ToolResult.data reports exactly
which files changed under hook_autofixed_files: list[str] (repo-root
relative). The field is always present: it is an empty list on the
clean path (no hooks, or no mutation) and never None. This lets a
consumer see that the patch it committed is not byte-for-byte the patch
it staged — the commit still carries a truthful verdict of what landed.
The hook runner is whatever the repo installs at
.git/hooks/pre-commit (pre-commit OR prek); axm-git never
invokes the runner directly — git does.
Registered as git_commit via axm.tools entry point.
Source code in packages/axm-git/src/axm_git/tools/commit.py
| Python | |
|---|---|
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
name
property
Tool name used for MCP registration.
execute(*, path='.', commits=None, profile=None, strict=False, **kwargs)
Execute batched commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Project root (required). |
'.'
|
commits
|
list[dict[str, object]] | None
|
List of commit specs, each a dict with keys:
- |
None
|
profile
|
str | None
|
Optional identity profile name. Overrides
schedule-based resolution from |
None
|
strict
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
ToolResult
|
ToolResult with a list of committed results, an |
ToolResult
|
( |
ToolResult
|
( |
ToolResult
|
commit hook mutated during the autofix-retry — always present, |
ToolResult
|
|
Source code in packages/axm-git/src/axm_git/tools/commit.py
| Python | |
|---|---|
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |