Commit text
commit_text
Text renderers for GitCommitTool dual-format ToolResult.
These helpers transform the structured data dict produced by
:class:axm_git.tools.commit.GitCommitTool into a compact, token-efficient
text representation suitable for MCP consumers.
The header pattern follows the AXM convention
(see axm_ast.tools.search_text)::
Text Only
git_commit | {status} | {succeeded}/{total} commits [· {extra}]
format_commit_line(result)
Format one successful commit record as {sha} [↻ ]{message}.
Source code in packages/axm-git/src/axm_git/tools/commit_text.py
| Python | |
|---|---|
format_text_header(*, status, succeeded, total, retried_count=0, extra=None)
Build the header line for a git_commit text rendering.
When total is 0 and extra is given, emit the pure-error shape
git_commit | error: {extra} (used for early failures with no
commit list available).
Source code in packages/axm-git/src/axm_git/tools/commit_text.py
render_failure_text(*, error, data)
Render the failure-path text representation.
Branches:
- data is
None→ plaingit_commit | error: {error}line. - data has
suggestions→ M4 not-a-repo hint. - data has
failed_commit→ M7 pre-commit failure with optional auto-fixed list and indented hook output. - otherwise → M5/M6 validation or git-add failure.
Source code in packages/axm-git/src/axm_git/tools/commit_text.py
render_text(data)
Render the success-path data dict.
Header + one format_commit_line per entry in data['results'].