Skip to content

Scope

scope

Scope loader for the echo corpus.

Reads the workspace_roots echo setting from the shared ~/.axm/config.toml [echo] section via :mod:axm_config (the single source of truth, env > file > default). echo is the first real consumer of axm-config: the hand-rolled per-file TOML loader is gone -- echo only keeps the resolve + de-duplicate + filter post-processing on top of the raw value.

Graceful degradation is the hard contract, unchanged from the legacy loader: a missing section, a missing/empty/ill-typed workspace_roots value, or any axm-config failure never raises -- it falls back to the current working directory as the single root. There is no upward disk auto-discovery.

The env layer round-trips too: AXM_ECHO_WORKSPACE_ROOTS arrives as a raw string (axm-config returns env values verbatim), so it is split on os.pathsep before resolution.

load_scope()

Return the workspace roots to scan, with graceful degradation.

Resolves workspace_roots from the shared ~/.axm/config.toml [echo] section through :func:axm_config.get. On any failure (absent section, missing/empty/ill-typed value, or an axm-config error) returns [Path.cwd().resolve()] 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.

Source code in packages/axm-echo/src/axm_echo/scope.py
Python
def load_scope() -> list[Path]:
    """Return the workspace roots to scan, with graceful degradation.

    Resolves ``workspace_roots`` from the shared ``~/.axm/config.toml``
    ``[echo]`` section through :func:`axm_config.get`. On any failure (absent
    section, missing/empty/ill-typed value, or an axm-config error) returns
    ``[Path.cwd().resolve()]`` so the caller still has the current workspace to
    scan -- never an exception.

    Returns:
        Resolved, de-duplicated workspace root paths. Always non-empty.
    """
    roots = _read_configured_roots()
    if not roots:
        return [Path.cwd().resolve()]
    return roots