Paths
paths
Shared filesystem roots, owned by axm-config and only read elsewhere.
The galaxy declared the same roots over and over: ~/axm/sessions in five
packages, ~/axm/quality in three, ~/axm/protocols in three, and the
~/.axm/warden.sock resolution copy-pasted across four sites in two repos.
Each copy is a place the value can silently drift. This module is the single
owner: consumers call a getter here instead of rebuilding Path.home() / ....
Two properties make adoption safe, and they are the whole point:
- The default stays in the caller's code. Every getter takes the caller's
current constant as
default, so with no~/.axm/config.tomlthe resolved value is byte-for-byte what it is today. Wiring a package up is therefore purely additive -- no behaviour changes until someone actually configures a path. - Normalisation happens here, once. :func:
get_pathturns the resolver's raw value (an env var is always astr; a TOML value keeps its parsed type) into an expanded, resolved :class:~pathlib.Path. If each consumer did its ownPath(...)/expanduser(), the duplication would simply move up one level instead of disappearing.
Precedence is the resolver's own env > file > default, so an existing
override such as AXM_PATHS_WARDEN_SOCKET keeps working unchanged.
Security: a configured path is passed through
:func:axm_config.home.resolve_safe, which refuses anything resolving inside a
git checkout -- runtime state (session traces, quality reports, a socket) must
never land in a repo where it can be committed. The default is never
checked: it is code, not user input, and validating it would turn a
working installation into a failing one, breaking the additive guarantee above.
get_bool(key, default, *, namespace=PATHS_NAMESPACE)
Resolve a configured boolean while preserving an untouched default.
Source code in packages/axm-config/src/axm_config/paths.py
get_int(key, default, *, namespace=PATHS_NAMESPACE)
Resolve a configured integer while preserving an untouched default.
Source code in packages/axm-config/src/axm_config/paths.py
get_path(key, default, *, namespace=PATHS_NAMESPACE)
Resolve key in [paths] as a normalised :class:~pathlib.Path.
default is the caller's existing constant and is returned unchanged
when nothing is configured -- neither expanded nor validated -- so wiring a
consumer up cannot alter today's behaviour.
A configured value (env or file) is expanded (~), resolved to an
absolute path, and refused via :func:resolve_safe if it sits inside a git
checkout. Raises :class:ConfigError on a non-string/non-path value or an
in-repo path, so a bad config fails loudly at the boundary rather than
writing runtime state somewhere unintended.
Source code in packages/axm-config/src/axm_config/paths.py
get_str(key, default, *, namespace=PATHS_NAMESPACE)
Resolve a configured value as text while preserving an untouched default.
Source code in packages/axm-config/src/axm_config/paths.py
| Python | |
|---|---|
protocols_dir(*, default=None)
The legacy YAML protocol directory read by the engine and briefings.
Source code in packages/axm-config/src/axm_config/paths.py
quality_dir(*, default=None)
The quality-trace directory written by axm-audit / axm-init.
Source code in packages/axm-config/src/axm_config/paths.py
sessions_root(*, default=None)
The loom sessions root -- where runs write manifests, traces, artifacts.
Declared identically in axm-loom, axm-knowledge and axm-orison
(whose docstrings already say they mirror loom); this is the seam those
three delegate to. default overrides the built-in ~/axm/sessions
for a caller that must keep its own constant during migration.
Source code in packages/axm-config/src/axm_config/paths.py
warden_autostart(*, default=None)
Return whether consumers should start the warden automatically.
Source code in packages/axm-config/src/axm_config/paths.py
warden_binary_path(*, default=None)
Return the configured or interpreter-relative warden executable path.
Source code in packages/axm-config/src/axm_config/paths.py
warden_log_path(*, default=None)
Return the configured or AXM-home-relative warden log path.
Source code in packages/axm-config/src/axm_config/paths.py
warden_max_concurrent(*, default=None)
Return the strictly positive warden concurrency limit.
Source code in packages/axm-config/src/axm_config/paths.py
warden_mode(*, default=None)
Return the configured warden execution mode.
Source code in packages/axm-config/src/axm_config/paths.py
warden_socket(*, default=None)
The warden control-plane socket bound by axm-warden serve.
Note the precedence a consumer must preserve. Callers layer an explicit
argument on top of this (--socket on the CLI, the socket= kwarg on
the tools), which outranks everything here; this function covers only the
env > file > default tail below it. Collapsing the explicit argument
into the config lookup would silently change behaviour, so callers keep
their own if socket is not None: return socket guard and delegate the
rest.