Registry
Aalexbit-codemod avatar

angularjs-di-patterns

Mine AngularJS DI patterns (inline, array annotation, implicit, $inject); read-only metrics

alexbit-codemod0 executions

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

angularjs-di-patterns

Read-only mining codemod that scans AngularJS JavaScript source for dependency-injection
annotation styles and emits a di_pattern metric for migration assessment, including
minification-safety classification. It never modifies files โ€” every match is reported via
codemod:metrics and the transform always returns null.

What it detects

di_styleExampleMinification safe
array['$http', function ($http) {}]yes
inject_propertyFoo.$inject = ['$http'];yes
inline.service('Foo', function ($http) {}) โ€” anonymous function passed directly to a registration callno
implicitfunction Foo($http) {} referenced by name in a registration call, with no $inject annotation anywhereno

inline and implicit both rely on parameter names for injection, so they break once a
minifier renames those parameters โ€” flagged as the primary automation targets before a
production build pipeline is minified.

Metric cardinality

Each finding increments di_pattern with:

ts
{
  file: "app/invoices/invoice.service.js",
  line: "9",
  snippet: "function ($http) { ... }",
  di_style: "array" | "inject_property" | "inline" | "implicit",
  minification_safe: "true" | "false",
  migration_category: "di",
  risk: "low" | "medium" | "high",
  automation: "full" | "partial",
  effort_points: "1" | "2" | "3",
  recommended_phase: "phase-1",
}

Installation

bash
# Install from registry
codemod run angularjs-di-patterns

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