---
title: Analyze
description: Inspect resolved ABI types, shared layout IR, and helper previews
  with thru abi analyze
source_url:
  html: https://thru.org/docs/cli-reference/abi-analyze/
  md: https://thru.org/docs/cli-reference/abi-analyze.md
---

# Analyze

Use `thru abi analyze` when you need to understand how ABI types resolve before you generate code, publish an ABI, or debug a reflection failure.

## Use This When

- you want to confirm imports and type resolution succeed
- you need the shared layout IR in JSON or protobuf form
- you want to preview generated footprint or validate helpers for one type

Choose another ABI command when:

- you want generated source code: [Codegen](https://thru.org/docs/cli-reference/abi-codegen.md)
- you want to decode real bytes: [Reflect](https://thru.org/docs/cli-reference/abi-reflect.md)
- you want to prepare a file for publishing: [Prep for Publish](https://thru.org/docs/cli-reference/abi-prep-for-publish.md)

## Syntax

```bash
thru abi analyze \
  --files <FILE>... \
  [--include-dir <DIR>...] \
  [--print-ir] \
  [--ir-format json|protobuf] \
  [--print-footprint <TYPE>] \
  [--print-validate <TYPE>]
```

## Important Flags

| Flag | Use it for |
| - | - |
| `--print-ir` | Print the shared layout IR after analysis. |
| \`—ir-format json | protobuf\` |
| `—print-footprint <TYPE>` | Preview the generated legacy and IR footprint helpers for one type. |
| `—print-validate <TYPE>` | Preview the generated legacy and IR validate helpers for one type. |

## What It Prints

Even without optional flags, `analyze` prints:

- loaded files and resolved packages
- discovered type definitions
- detailed type analysis from the resolved graph

Optional flags add focused output on top of that base analysis.

## Minimal Patterns

**Load and analyze an ABI set:**

```bash
thru abi analyze \
  --files ./program.abi.yaml \
  --include-dir ./abi
```

**Print shared layout IR as JSON:**

```bash
thru abi analyze \
  --files ./program.abi.yaml \
  --print-ir
```

**Preview helpers for one type:**

```bash
thru abi analyze \
  --files ./program.abi.yaml \
  --print-footprint TransferArgs \
  --print-validate TransferArgs
```

## Notes

- `analyze` is a good first stop when codegen or reflection fails because it exercises the same import and type-resolution path.
- `--print-ir` is the most useful flag when you need to compare multiple ABIs or inspect cross-language layout behavior.
- If you only care whether an input file is ready for on-chain publishing, use [Prep for Publish](https://thru.org/docs/cli-reference/abi-prep-for-publish.md) instead of loading the whole analysis output into context.
