Skip to content

[FEATURE] Extract language-specific assessor logic into separate modules #329

@kami619

Description

@kami619

Problem Statement

The StandardLayoutAssessor in structure.py contains Python-specific logic (pyproject.toml parsing, __init__.py detection, PEP 621/Poetry support) mixed with generic assessor code. As we add support for more languages (JavaScript, Java, Go, Rust), this file will become increasingly difficult to maintain.

This was identified in PR #322 review comment.

Proposed Solution

Extract language-specific detection logic into dedicated modules:

src/agentready/assessors/ ├── langs/ │ ├── init.py │ ├── python.py # pyproject.toml parsing, 
init.py detection │ ├── javascript.py # package.json parsing, 
node_modules detection │ └── java.py # Maven/Gradle detection,
src/main/java structure ├── structure.py # Generic StandardLayoutAssessor (delegates to langs/) └── ...

The StandardLayoutAssessor would become an orchestrator that:

  1. Detects primary language from repository.languages
  2. Delegates to appropriate language module
  3. Falls back to generic heuristics if no language module exists

Alternatives Considered

  1. Keep everything in structure.py — Simpler but doesn't scale
  2. Use strategy pattern with language classes — More OOP but similar outcome
  3. Configuration-driven detection — Too complex for initial implementation

Use Cases

  1. Adding JavaScript/TypeScript project detection (package.json, index.js)
  2. Adding Java/Kotlin detection (pom.xml, build.gradle, src/main/java)
  3. Adding Go detection (go.mod, main.go)
  4. Adding Rust detection (Cargo.toml, src/lib.rs)

Additional Context

Related to the .arsrc configuration file work in PR #322, which externalizes the blocklist. This refactoring would pair well with that change by making language-specific blocklists possible (e.g., Python.arsrc, JavaScript.arsrc).

Acceptance Criteria

  • Create src/agentready/assessors/langs/ directory structure
  • Extract Python-specific logic to langs/python.py
  • StandardLayoutAssessor delegates to language modules
  • Existing tests continue to pass
  • Add tests for language module selection
  • Document pattern for adding new language support

Priority

  • Medium (nice to have)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions