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.
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
Cardinality
Description
file
Relative path of the source file
line
1-based line number of the .component(...) call
snippet
Trimmed source snippet of the call (max 160 chars)
component_name
The component name string, e.g. invoiceList
has_bindings
true | false
has_controller
true | false
has_template
true | false
has_template_url
true | false
binding_count
Number of top-level properties in bindings
migration_category
Always component
risk
low | medium | high
automation
full | partial | manual
effort_points
1 | 2 | 3 | 5 | 8 | 13
recommended_phase
phase-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.