# Imports Normalize

Use imports normalize for explicit import-style cleanup.
It rewrites resolved local import/export specifiers inside a chosen file or directory.

Use importNormalize in aib.json for repeated defaults.

Good for:
- converting one area to aliases or relative imports
- cleaning import style after manual edits or broad refactors
- applying the same import style to a directory without hand-editing files
- applying new tsconfig aliases after they are added

Controls:
scope        file/dir scope to normalize
to           relative|alias|shortestAlias
preferAlias  select one tsconfig paths pattern when several aliases can resolve the same file
exclude      files, directories, or glob-like patterns to skip
all          show all planned edits; avoid on broad directory scopes

Run:
aib imports normalize preview --stdin

Input:
{
  "scope": "src/services",
  "to": "shortestAlias",
  "exclude": ["src/services/generated", "**/* copy.ts"]
}

Rewrite imports found inside src/core.
When an imported file can be expressed through @features/*, prefer that alias.

Run:
aib imports normalize preview --stdin

Input:
{
  "scope": "src/core",
  "to": "alias",
  "preferAlias": "@features/*"
}

With matching importNormalize config for this scope or a parent scope, use inline CLI commands:

imports normalize preview @svc
imports normalize execute @svc
