Registry
Aalexbit-codemod avatar

angularjs-migration-effort-estimator

Mine AngularJS migration effort estimates from matched patterns; read-only metrics

alexbit-codemod0 executions

  • mining
  • metrics
  • angularjs
  • code-mining
  • migration-assessment
  • migration_effort_score

angularjs-migration-effort-estimator

Read-only mining codemod that detects AngularJS constructs and assigns each
one a Fibonacci effort estimate, a rough hours-per-occurrence heuristic, and
a recommended migration phase, so an assessment can roll up a total
migration-effort score for a codebase (or any slice of it).

Emits the migration_effort_score metric. Does not modify any files.

Patterns detected

PatternEffort pointsEstimated hoursPhaseCategory
module-or-component24-8hphase-3component
service-or-factory38-16hphase-2service
route-definition516-24hphase-4routing
directive-link824-40hphase-4directive
rootscope-event824-40hphase-2scope
directive-compile-fn1340-64hphase-5directive
$compile-service1340-64hphase-5directive

Detection rules:

  • module-or-component — angular.module(...) / .component(...)
    registration call sites.
  • service-or-factory — .service(...) / .factory(...) registration
    call sites.
  • route-definition — $routeProvider.when(...) or
    $stateProvider.state(...) call sites.
  • directive-link — a .directive(...) factory whose returned
    definition object has a link key.
  • directive-compile-fn — a .directive(...) factory whose returned
    definition object has a compile key (higher effort than link alone,
    since compile implies custom pre-linking/DOM manipulation).
  • $compile-service — direct usage of the injected $compile service
    ($compile(...)), independent of any directive definition.
  • rootscope-event — $rootScope.$broadcast(...),
    $rootScope.$emit(...), or $rootScope.$on(...).

Cardinalities

FieldDescription
fileRelative file path
line1-based line number of the match
snippetTruncated source snippet (whitespace-collapsed, 120 chars)
patternOne of the pattern names above
effort_pointsFibonacci estimate: 1, 2, 3, 5, 8, or 13
estimated_hoursRough hours-per-occurrence heuristic string (e.g. "24-40h")
recommended_phasephase-1 .. phase-5
migration_categorycomponent | service | routing | directive | scope
risklow | medium | high | critical
automationfull | partial | manual

estimated_hours is a per-occurrence heuristic, not a file- or
project-level estimate — sum effort_points (or midpoints of
estimated_hours) across all findings during assessment roll-up.

Known limitations

  • A .directive(...) with both link and compile keys produces two
    separate findings (directive-link and directive-compile-fn) — this
    is intentional, since each concern carries its own migration cost, but it
    means directive effort is not a single number per directive.
  • Object-identifier matching is exact ($routeProvider, $stateProvider,
    $rootScope, $compile), so a locally scoped variable with an unrelated
    purpose but an identical name would still be counted — this is rare in
    idiomatic AngularJS DI-driven code but worth spot-checking in unusual
    codebases.
  • $scope.$broadcast(...)/$scope.$on(...) (scoped, not global) are
    intentionally not counted here — only $rootScope-rooted event bus
    usage is treated as a rootscope-event finding, since that is what
    drives cross-cutting migration risk.

Installation

bash
# Install from registry
codemod run angularjs-migration-effort-estimator

# Or run locally
codemod run -w workflow.yaml

Development

bash
# Test the transformation
pnpm test

# Validate the workflow
codemod workflow validate -w workflow.yaml

# Publish to registry
codemod login
codemod publish

License

MIT

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.