Skip to content

atlas.core.config

atlas.core.config

Configuration hierarchy: project .atlas/config.json > global ~/.atlas/config.json > defaults.

AtlasConfig dataclass

AtlasConfig(
    retrieve_links: dict[str, list[str]] = dict(),
    ignore_patterns: list[str] = list(),
    detection_overrides: dict[str, str] = dict(),
    package_manager_override: str = "",
    auto_add_recommendations: bool = False,
)

Atlas configuration with three-level hierarchy.

load_config

load_config(project_dir: str = '.') -> AtlasConfig

Load config with hierarchy: project > global > defaults.

Source code in src/atlas/core/config.py
def load_config(project_dir: str = ".") -> AtlasConfig:
    """Load config with hierarchy: project > global > defaults."""
    config = AtlasConfig()

    # Global config (~/.atlas/config.json)
    global_path = os.path.expanduser("~/.atlas/config.json")
    if os.path.isfile(global_path):
        _merge_config(config, _load_json(global_path))

    # Project config (.atlas/config.json)
    project_config = os.path.join(os.path.abspath(project_dir), ".atlas", "config.json")
    if os.path.isfile(project_config):
        _merge_config(config, _load_json(project_config))

    return config

save_config

save_config(data: dict, path: str) -> None

Save config dict to JSON file.

Source code in src/atlas/core/config.py
def save_config(data: dict, path: str) -> None:
    """Save config dict to JSON file."""
    os.makedirs(os.path.dirname(path), exist_ok=True)
    with open(path, "w") as f:
        json.dump(data, f, indent=2, ensure_ascii=False)
        f.write("\n")