Detect
detect
Stdlib-only detection of external tools and third-party auth state.
Tool/auth probing (:func:detect_tool, :func:detect_auth) depends on the
standard library and pydantic only — no AXM package is imported at module
load, so this layer runs as the bootstrap probe before the rest of AXM is
installable. The git-identity check (:func:detect_git_identity) additionally
resolves the central axm-config store ([git].default) to know whether a
committer identity exists; that import is deferred to the function body so the
module stays importable on a machine where axm-config is not yet present.
The value is never read, only its presence. All detection is strictly
read-only: it inspects an exit code or the existence of a credential/store
entry, and never reads the token or identity value.
AuthStatus
Bases: BaseModel
Frozen read-only auth state for a third-party binary.
Carries the command to recover from logged_out (login_cmd) but
NEVER a token value — detection is existence/exit-code only.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
GhConfigStatus
Bases: BaseModel
Frozen verdict on whether gh carries a base configuration.
configured when gh config get git_protocol exits 0, unconfigured
otherwise, not_installed when the gh binary is absent. The config
value itself is never read.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
GitIdentityStatus
Bases: BaseModel
Frozen verdict on whether a git committer identity is resolvable.
state is decided from the presence of a [git].default store entry
or the exit code of git config --get user.email — the identity value
itself is never read.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
ToolStatus
Bases: BaseModel
Frozen result of probing a single external tool on PATH.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
detect_auth(tool)
Report read-only auth state for a third-party binary.
gh is probed via the exit code of gh auth status; credential-file
tools (claude, codex) via the existence of their credential file
under ~ — the file is never opened, so no token is ever read.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
detect_gh_config()
Report whether gh carries a base config, value-free.
Probes the exit code of gh config get git_protocol (its stdout is
captured and discarded). gh absent → not_installed; any
OSError / SubprocessError degrades to unconfigured. This is
distinct from and additional to the gh auth status login check.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
detect_git_identity()
Report whether a git committer identity is resolvable, value-free.
Cheapest source first: a truthy [git].default in the axm-config
store means an identity exists. Otherwise fall back to the exit code of
git config --get user.email (its stdout — the email — is captured and
discarded, never returned). Any missing binary / OSError /
SubprocessError degrades to unconfigured without raising.
Source code in packages/axm-doctor/src/axm_doctor/detect.py
detect_tool(name)
Probe name on PATH and parse <name> --version.
Returns present with the parsed version string when found, absent
otherwise. Never raises on a missing or misbehaving tool.