Skip to content

atlas.core.detection

atlas.core.detection

Language, framework, and database detection engine.

detect_project

detect_project(project_dir: str) -> ProjectDetection

Run full project detection and return a ProjectDetection result.

Parameters:

Name Type Description Default
project_dir str

Absolute or relative path to the project root.

required

Returns:

Type Description
ProjectDetection

Populated ProjectDetection dataclass.

Source code in src/atlas/core/detection.py
def detect_project(project_dir: str) -> ProjectDetection:
    """Run full project detection and return a ProjectDetection result.

    Args:
        project_dir: Absolute or relative path to the project root.

    Returns:
        Populated ProjectDetection dataclass.
    """
    project_dir = os.path.abspath(project_dir)

    if not os.path.isdir(project_dir):
        return ProjectDetection()

    languages, primary = _detect_languages(project_dir)
    package_manager = _detect_package_manager(project_dir, languages)
    existing_tools = _detect_existing_tools(project_dir)
    frameworks, stack = _detect_frameworks_and_stack(project_dir, languages)
    databases = _detect_databases(project_dir, languages)
    infrastructure = _detect_infrastructure(project_dir)
    structure_type, workspace_manager = _detect_structure(project_dir)

    return ProjectDetection(
        languages=languages,
        primary_language=primary,
        package_manager=package_manager,
        existing_tools=existing_tools,
        frameworks=frameworks,
        stack=stack,
        databases=databases,
        infrastructure=infrastructure,
        structure_type=structure_type,
        workspace_manager=workspace_manager,
        system_tools=detect_system_tools(),
    )