Scope
scope
Scope loader for the echo corpus.
Reads the optional ~/axm/echo.toml config to decide which workspace
roots the corpus extractor walks. Self-contained: only tomllib +
pathlib, zero external dependency (AC5).
Graceful degradation is the hard contract: a missing file, a missing
workspace_roots key, or a malformed TOML never raises -- it falls
back to the current working directory as the single root. There is no
upward disk auto-discovery.
NOTE (rule of three): a future axm-config package may own this
loading once a third consumer appears. Until then we deliberately avoid
coupling to an unbuilt package and keep the loader local.
config_path()
Return the path to the echo config (~/axm/echo.toml).
Does not check existence; callers degrade gracefully when absent.
load_scope()
Return the workspace roots to scan, with graceful degradation.
Reads workspace_roots from ~/axm/echo.toml when present and
well-formed. On any failure (file absent, unreadable, invalid TOML,
missing or empty workspace_roots) returns [Path.cwd()] so the
caller still has the current workspace to scan -- never an exception.
Returns:
| Type | Description |
|---|---|
list[Path]
|
Resolved, de-duplicated workspace root paths. Always non-empty. |