---
title: Prep for Publish
description: Inline local imports and validate publish rules with thru abi prep-for-publish
source_url:
  html: https://thru.org/docs/cli-reference/abi-prep-for-publish/
  md: https://thru.org/docs/cli-reference/abi-prep-for-publish.md
---

# Prep for Publish

Use `thru abi prep-for-publish` when you need a publishable ABI YAML artifact before `thru abi account create` or `upgrade`.

## Use This When

- you have local path imports that need to be inlined before publishing
- you want to enforce that remaining imports are valid on-chain imports for one network
- you need a stable artifact to review before pushing ABI contents on-chain

Choose another ABI command when:

- you only need one flattened YAML file without publish rules: [Flatten](https://thru.org/docs/cli-reference/abi-flatten.md)
- you want to publish immediately: [Account](https://thru.org/docs/cli-reference/abi-account.md)

## Syntax

```bash
thru abi prep-for-publish \
  --file <FILE> \
  --target-network <NETWORK> \
  --output <FILE> \
  [--include-dir <DIR>...] \
  [--verbose]
```

## Publish Rules

| Rule | Result |
| - | - |
| Local path imports | inlined into the output file. |
| On-chain imports on the target network | Kept in the output file. |
| On-chain imports on another network | Command fails. |
| `git` imports | Command fails. |
| `http` imports | Command fails. |

## Minimal Pattern

```bash
thru abi prep-for-publish \
  --file ./program.abi.yaml \
  --include-dir ./abi \
  --target-network testnet \
  --output ./dist/program.publish.abi.yaml \
  --verbose
```

## Notes

- This command is the safest handoff point before `abi account create` because it strips out local-only packaging assumptions.
- The `thru` command uses `--target-network`. The standalone `abi` binary uses the same workflow with a shorter `--network` flag.
- Verbose mode prints which local imports were inlined and how many packages were resolved.
