Runner
runner
Subprocess runners for git, gh, and uv commands.
detect_package_name(project_path)
Read the package name from pyproject.toml.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Project root containing |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
Package name or |
Source code in packages/axm-git/src/axm_git/core/runner.py
find_git_root(path)
Find the git repository root containing path.
Uses git rev-parse --show-toplevel which walks up the directory
tree, supporting mono-repo and workspace layouts where .git
lives above the package directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Any directory that may be inside a git repository. |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
Repository root as a |
Path | None
|
inside a git repository. |
Source code in packages/axm-git/src/axm_git/core/runner.py
gh_available()
Check whether the GitHub CLI is installed and authenticated.
Source code in packages/axm-git/src/axm_git/core/runner.py
not_a_repo_error(stderr, path)
Build a ToolResult for a failed git command.
If stderr contains "not a git repository" and path has
child directories that are git repos, the error message is enriched
with suggestions. Otherwise a standard error is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stderr
|
str
|
Stderr output from the failed git command. |
required |
path
|
Path
|
Directory that was used as |
required |
Returns:
| Type | Description |
|---|---|
ToolResult
|
|
Source code in packages/axm-git/src/axm_git/core/runner.py
run_gh(args, cwd, **kwargs)
Run a GitHub CLI command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
list[str]
|
gh subcommand and arguments. |
required |
cwd
|
Path
|
Working directory (project root). |
required |
**kwargs
|
Any
|
Extra arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
CompletedProcess[str]
|
Completed process result. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in packages/axm-git/src/axm_git/core/runner.py
run_git(args, cwd, **kwargs)
Run a git command in the given directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
list[str]
|
Git subcommand and arguments (e.g. |
required |
cwd
|
Path
|
Working directory (project root). |
required |
**kwargs
|
Any
|
Extra arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
CompletedProcess[str]
|
Completed process result. |
Source code in packages/axm-git/src/axm_git/core/runner.py
suggest_git_repos(path)
Find immediate child directories that are git repositories.
Scans one level deep for subdirectories containing a .git dir.
Returns a sorted list of directory names. If path is itself a
git repository (has .git/ at root), returns an empty list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Directory to scan. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of child directory names that are git repos. |