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 | |
|---|---|
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 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
DEPENDENCY_ENVIRONMENT_VERSION = 1
class-attribute
Versioned capability: execute consumes the declared dependency runtime.
name
property
Tool name used for MCP registration.
execute(*, path='.', commits=None, profile=None, strict=False, dependency_environment=None, **kwargs)
Commit with an optional explicit, invocation-local dependency runtime.
The interpreter stays lexical; candidate sources precede the declared dependency paths. The environment applies to every subprocess and retry, then is restored even after an exception. Invalid contracts refuse before staging. This transports an environment; it does not certify arbitrary hooks as bootstrap-free or change their veto/autofix semantics.