# Inspect

Inspect helps you turn an unknown code area into a small working model.

Use it to understand what exists, how pieces connect, what repeats, where a change can spread, and which exact code should enter context next.

One useful flow:
map -> focus -> code

map: learn what exists and how it connects
focus: choose files/entities/usages that matter
code: fetch exact code needed

Choose inspect operation:

declarations in one file         file
static/dynamic imports           imports
public API                       exports
methods/properties of parent     members
exact implementation             code
outgoing deps of one entity      deps
incoming references/callers      usages
file/module connectivity         graph
compact directory layout         tree
repeated declarations/helpers    duplicates

Prefer one batch JSON request for related questions.
Top-level fields are defaults for every request.
A request without op uses the top-level op.
A request without file/scope/target uses the top-level value when applicable.
Each request may override any default.

Batch example:

Run:
aib inspect --stdin

Input:
{
  "file": "src/service.ts",
  "requests": [
    { "op": "file" },
    { "op": "members", "entity": "Service" },
    {
      "op": "code",
      "entities": [
        { "parent": "Service", "entities": ["render", "reset"] },
        "normalize"
      ],
      "show": true,
      "save": "service-focus"
    },
    {
      "op": "usages",
      "target": "src/service.ts",
      "entity": "normalize",
      "scope": "src",
      "detail": "locations"
    },
    {
      "op": "duplicates",
      "scope": "src/scripts",
      "detail": "summary",
      "limit": 20
    }
  ]
}

Inspect controls:

file        default file for requests
target      file, dir, or symbol area to analyze
scope       where to search; JSON scope:string|string[]
entity      one symbol
entities    several target symbols; JSON entities:[...]
parent      class/interface parent for methods/properties
ranges      include line/range metadata; JSON ranges:boolean; CLI --ranges
localOnly   show local declarations and reexports without resolving facade API; JSON localOnly:boolean; CLI --local-only
resolveStar resolve export * through re-exported modules; JSON resolveStar:boolean; CLI --resolve-star
limit       max items in one page; JSON limit:N; CLI --limit N
offset      page offset; JSON offset:N; CLI --offset N
all         return all items; JSON all:boolean; CLI --all
detail      output level; JSON detail:summary|locations|code; CLI --detail summary|locations|code
show        include code output; JSON show:boolean; CLI --show
save        save reusable output; JSON save:"name"; CLI --save name
exclude     skip names/selectors; JSON exclude:[...]
kinds       restrict selector kinds; JSON kinds:["f","t"]
