Registry
Aalexbit-codemod avatar

angularjs-component-inventory

Mine AngularJS .component() definitions, bindings, controllers, templates; read-only metrics

alexbit-codemod0 executions

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

angularjs-component-inventory

Read-only mining codemod that inventories AngularJS .component('name', { ... })
definitions for migration assessment. It does not modify any source files — it
only emits metrics that can be aggregated into a migration report.

What it mines

For every .component('name', { ... }) call whose config argument is an object
literal, the codemod inspects the top-level bindings, controller,
template, and templateUrl properties and emits one angularjs_component
metric entry.

A complexity score is computed as:

text
complexity = binding_count + (has_controller ? 1 : 0) + (has_template ? 1 : 0) + (has_template_url ? 1 : 0)

which drives risk, automation, effort_points, and recommended_phase:

  • risk: high when complexity >= 6, medium when >= 3, else low.
  • automation: manual when binding_count > 5 (many inputs/outputs to
    re-wire by hand), partial when a controller is present (behavior needs
    review), otherwise full.
  • effort_points: a Fibonacci-like scale (1/2/3/5/8/13) that
    grows with complexity.
  • recommended_phase: phase-4 for high-risk components (bundled with
    core route work), phase-3 (leaf feature migration) otherwise.

Components whose second argument is not an object literal (e.g. a shared
config variable) are intentionally skipped, since bindings/controller/template
cannot be statically resolved.

Metric: angularjs_component

CardinalityDescription
fileRelative path of the source file
line1-based line number of the .component(...) call
snippetTrimmed source snippet of the call (max 160 chars)
component_nameThe component name string, e.g. invoiceList
has_bindingstrue | false
has_controllertrue | false
has_templatetrue | false
has_template_urltrue | false
binding_countNumber of top-level properties in bindings
migration_categoryAlways component
risklow | medium | high
automationfull | partial | manual
effort_points1 | 2 | 3 | 5 | 8 | 13
recommended_phasephase-1 .. phase-5

Installation

bash
# Install from registry
codemod run angularjs-component-inventory

# Or run locally
codemod run -w workflow.yaml

Development

bash
# Test the transformation
pnpm test

# Check types
pnpm run check-types

# 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.