Angular Modernizer
    Preparing search index...

    Library extraction scanner.

    Finds artifacts in the target folders that could move into dedicated Angular libraries with secondary entry points:

    1. Computes metrics per artifact (cross-folder importers resolved through barrels, spec file, external imports, barrel export, data-only file)
    2. Keeps artifacts whose reusability score (location bonus, cross-module usage, public export, few dependencies, test evidence) reaches minReusabilityScore
    3. Clusters them by LibraryCategory; large clusters are split by domain folder, data-only files form their own models cluster
    4. Keeps clusters whose cohesion score reaches minCohesionScore and reports each as a LibraryExtractionOpportunity

    Pure TypeScript weighted scoring, no external ML dependency.

    Index

    Constructors

    Methods

    • Internal

      Cohesion score = weighted average of:

      • Location cohesion: % members in same/related folder (weight 0.5)
      • Naming cohesion: % members sharing a common prefix/suffix (weight 0.3)
      • Import cohesion: % members importing each other (weight 0.2)

      Location is weighted highest: for library extraction, artifacts in the same shared folder belong in the same library regardless of whether they import each other (most UI components are independent by design).

      Parameters

      Returns number

    • Calculate reusability score (0-100).

      Formula: score = locationBonus + crossModuleUsage * 0.3 + isPubliclyExported * 0.15 + minimalDependencies * 0.15 + hasTestFile * 0.1

      locationBonus: 30 points for any file already placed in a shared/libs/common/core folder — the developer already decided it belongs there.

      crossModuleUsage is normalized to min(count/3, 1): each additional importer above 1 increases the score (3+ usages = max contribution).

      minimalDependencies = 1 - min(dependencyCount / 10, 1) — uses /10 instead of /5 so Angular components importing @angular/core etc. aren't penalised as heavily.

      Data-only artifacts (interfaces / types / enums / consts) never have spec files, so their 10-point test slot is filled with importer evidence instead: min(crossModuleUsage / 5, 1). A model imported from 5+ other folders is as proven as a tested component.

      Parameters

      Returns number