<!-- 0Gkit docs — @foundryprotocol/0gkit-cli
     Source: https://docs.0gkit.com/packages/cli
     LLM-friendly Markdown twin of the page. -->

# @foundryprotocol/0gkit-cli

> The neutral `0g` command line — `init`, `doctor`, `chain`, `storage`,
> `infer`, `da`, `attest`. Language-agnostic; `--json` for scripting.

## What it does

Ships a single binary, `0g`, that exposes every 0G primitive as a subcommand.
It is a thin, faithful wrapper over the primitive packages — any stack (Python,
Go, shell) can shell out and parse `--json`. Foundry is a separate, opt-in,
hidden plugin (`0g foundry …`), never required.

## When to use it

- You are not in TypeScript (Python, Go, Rust, shell) — the CLI is the
  universal surface.
- CI / scripts — `--json` gives machine-readable output and meaningful exit
  codes.
- Quick preflight (`0g doctor`) or scaffolding (`0g init`).

## Where to use it

A terminal, a CI runner, or any process that can shell out. Node `>=20.10`.

## Install

```bash
npm install -g @foundryprotocol/0gkit-cli   # provides `0g`
# or run ad-hoc with no install (note the full scope — `npx 0g` resolves
# to an unrelated package on npm):
npx @foundryprotocol/0gkit-cli <command>
```

## Quick taste

```bash
npx @foundryprotocol/0gkit-cli init my-app && cd my-app && npm install
npx @foundryprotocol/0gkit-cli doctor                              # preflight every 0G surface
npx @foundryprotocol/0gkit-cli chain faucet 0xYourAddress          # galileo → points at faucet.0g.ai
ROOT=$(npx @foundryprotocol/0gkit-cli storage put model.bin --json | jq -r .root)
npx @foundryprotocol/0gkit-cli storage exists "$ROOT" --json
```

The full command set, every flag, exit codes, and the env-var matrix are in
the dedicated **[CLI reference](/cli)**.

## API surface

This package is primarily a binary. It also exports `buildProgram(deps)`,
`runCommand`, `ctxOf`, and `VERSION` for embedding/testing the commander
program with injected dependencies (`ProgramDeps`) — see the source if you
need to embed the CLI.

## Related

Wraps every primitive: [core](/packages/core), [chain](/packages/chain),
[storage](/packages/storage), [compute](/packages/compute), [da](/packages/da),
[attestation](/packages/attestation). Full guide: **[CLI reference](/cli)**.
