# Inspect Usages

Use usages to find who references a file, directory, or entity inside a scope.
It reports real references, not unused imports or text matches.
For broad impact checks, target-local usages are hidden automatically when the target is inside a wider scope.
Use includeTarget only when references inside the target file or directory matter.

Good for:
- checking impact before changing behavior
- finding consumers of an entity or module area
- confirming whether extracted or renamed code still has callers
- getting caller locations or caller code without broad file scans

Use detail=code directly when you already need caller code.
Use detail=loc + save when the first question is impact shape and you may expand only part of it later.

Controls:
target, scope, entity, entities, parent, detail, limit, all, save, includeTarget

Specific:
includeTarget  include references inside the target file/directory; +includeTarget

Prefs:
inspect.usages.maxLocations
inspect.usages.maxCodeBlocks

Run:
aib inspect --stdin

Input:
usages target=@svc/service.ts entities=[createService,normalize,Service.{render,reset}] scope=[src/app,src/tests] detail=loc >service-usages

Expand saved usages when needed:
inspect usages --from-file aib:usages:service-usages --focus createService --detail code --limit 20

inspect usages src/service.ts createService --scope src --detail locations [--limit N] [--all] [--save name]

Expand saved usages by focusing the reusable usages index:
inspect usages --from-file aib:usages:service-usages --focus createService --detail code

Use the saved usages handle with --from-file/from to focus or expand the reusable index.

Directory target:
Run:
aib inspect --stdin

Input:
usages target=src/shared scope=[src/app,src/renderer] detail=sum >shared-usages
