Commit spec
commit_spec
Shared commit spec validation and Git hook autofix-retry plumbing.
AutofixRetry
dataclass
Outcome of an autofix-aware commit retry.
Attributes:
| Name | Type | Description |
|---|---|---|
result |
_GitResultLike
|
The final GitResult-like object (returncode/stdout/stderr). |
retried |
bool
|
Whether a re-stage + retry was actually performed. |
auto_fixed |
list[str]
|
Files the commit hook modified, captured before
re-staging (the subsequent |
Source code in packages/axm-git/src/axm_git/core/commit_spec.py
attempt_commit_with_autofix_retry(cmd, files, git_root, first_result, *, working_dir=None)
Re-stage + retry cmd once when a commit hook auto-fixed files.
Detection is on the combined stdout+stderr of first_result: when the
canonical "files were modified" marker is present, the modified
files are captured (git diff --name-only before re-staging), the
spec files are re-staged via the subdir-aware resolver, and cmd is
retried once. Otherwise first_result is returned unchanged.
Source code in packages/axm-git/src/axm_git/core/commit_spec.py
validate_commit_spec(spec)
Validate a commit_spec dict (pure; stricter merged contract).
Requires a non-empty message AND a non-empty files list — the
stricter of the two prior per-surface validators. Returns
(spec, error_message) where spec is None when an error is set;
each surface wraps the error string in its own result type.