@angular-health-check/cli
@angular-health-check/cli
Angular code quality analyzer — detects missing ChangeDetectionStrategy.OnPush, *ngFor without trackBy, RxJS subscriptions without unsubscribe, absence of Angular Signals, and 15+ more Angular-specific patterns. Outputs a health score 0–100 normalized by project size and optionally pushes results to a cloud dashboard.
Install
# npm
npm install -g @angular-health-check/cli
# pnpm
pnpm add -g @angular-health-check/cli
# or run without installing
npx @angular-health-check/cli scan .
pnpm dlx @angular-health-check/cli scan .
Usage
# Scan current directory
ahc scan .
# Scan a specific path
ahc scan /path/to/my-angular-app
# Output JSON (machine-readable)
ahc scan . --json
# Generate HTML report
ahc scan . --report --output ./health-report.html
# Authenticate to push scans to dashboard
ahc login
# CI/CD (no browser, set env var or flag)
AHC_API_KEY=ahc_xxx ahc scan .
ahc scan . --api-key ahc_xxx
# CI quality gate — exit 1 if score drops below threshold
ahc scan . --fail-under 70
# Auto-fix issues (OnPush, console.log) — preview first
ahc fix . --dry-run
ahc fix .
# Modernization readiness (standalone, signals, control flow)
ahc migrate-check .
Rules are version-aware: the CLI reads your @angular/core version and only applies rules your Angular version supports (e.g. Signals rules require 16+, @if/@for suggestions require 17+).
What it detects
| Category | Rules | Severity |
|---|---|---|
| Signals & Reactivity | Missing Angular Signals adoption | info |
| Performance | Missing ChangeDetectionStrategy.OnPush |
warning |
| Performance | *ngFor without trackBy |
warning |
| Performance | console.log / console.error in production code |
info |
| RxJS | Subscriptions without unsubscribe / takeUntil |
error |
| RxJS | Missing async pipe where applicable |
warning |
20+ rules across Signals, RxJS, and Performance categories.
How scoring works
issueScore = (errors × 10) + (warnings × 3) + (info × 0.5)
density = issueScore / filesAnalyzed
score = max(0, round(100 − density × 10))
Score is density-normalized — a 100-file project with 10 warnings scores the same as a 10-file project with 1 warning. Large codebases aren't unfairly penalized.
| Score | Label |
|---|---|
| 90–100 | Excellent |
| 70–89 | Good |
| 50–69 | Fair |
| 25–49 | Poor |
| 0–24 | Critical |
Dashboard & Pro features
Sign up free at angularhc.dev:
- Store and browse scan history
- Score history charts per project (Pro)
- Compare two scans side-by-side (Pro)
- GitHub PR integration — auto-comment on every PR (Pro)
- Team dashboard sharing (Pro)
- API keys for CI/CD (Pro)
Pro: $9/month
Auth options
# Interactive (browser OAuth, saves to ~/.ahcrc)
ahc login
# Environment variable (CI/CD)
export AHC_API_KEY=ahc_...
ahc scan .
# Inline flag
ahc scan . --api-key ahc_...
Priority: --api-key > AHC_API_KEY > ~/.ahcrc
FAQ
Q: How do I detect Angular performance issues via CLI?
ahc scan . — lists every issue with file, line, and fix hint.
Q: Does it detect missing OnPush?
Yes — flagged as warning with exact component file and line.
Q: Does it work without creating an account? Yes — local scanning and HTML/JSON reports work without auth. An account is only needed to push scans to the cloud dashboard.
Q: CI/CD support?
Set AHC_API_KEY in your CI environment. Results upload automatically on ahc scan ..
Q: Angular version requirements? Any Angular project with TypeScript source files. Signals rules apply to Angular 16+.