# CLI overview
Source: https://docs.treeship.dev/cli/overview

> Full command surface for the treeship CLI.

## Installation

```bash
curl -fsSL treeship.dev/install | sh
```

## All commands

```bash
# Identity
treeship init                           # set up a new Treeship
treeship status                         # show state, keys, hub status

# Sessions
treeship session start [--name NAME]    # start a new session
treeship session status                 # show current session state
treeship session close [--summary TEXT] # close the active session

# Attestation
treeship wrap -- <cmd>                  # attest any command execution
treeship attest action                  # record an action
treeship attest decision                # record an LLM decision
treeship attest approval                # record an approval
treeship attest handoff                 # record a handoff
treeship attest endorsement             # record an endorsement
treeship attest receipt                 # record a receipt

# Approvals
treeship pending                        # list pending approval requests
treeship approve [N]                    # approve a pending request
treeship deny [N]                       # deny a pending request

# Verification
treeship verify <id>                    # verify an artifact or chain, exit 0/1
treeship verify <id> --format json      # machine-readable output
treeship verify <id> --no-chain         # verify single artifact, skip chain walk

# Log
treeship log [--tail N]                 # list recent receipts
treeship log --follow                   # stream receipts in real time

# Bundle
treeship bundle create                  # create a bundle from artifacts
treeship bundle export <id>             # export a chain as a .treeship file
treeship bundle import <file>           # import a .treeship file locally

# Hub connections (treeship.dev Hub)
treeship hub attach                     # connect to Hub (or reconnect)
treeship hub attach --name acme-corp    # named hub for separate workspace
treeship hub detach                     # disconnect active hub (keeps keys)
treeship hub ls                         # list all known hub connections
treeship hub status                     # show active hub details
treeship hub use <name>                 # switch active hub connection
treeship hub push <id>                  # push artifact to active hub
treeship hub push <id> --hub <name>     # push to specific hub
treeship hub push <id> --all            # push to all hubs
treeship hub pull <id>                  # pull artifact from Hub
treeship hub open                       # open workspace in browser
treeship hub kill <name>                # remove a hub connection

# Daemon
treeship daemon start [--foreground]    # start the background watcher
treeship daemon stop                    # stop the daemon
treeship daemon status                  # check daemon state

# Merkle tree
treeship checkpoint                     # seal a signed Merkle root
treeship merkle proof <id>              # generate inclusion proof
treeship merkle verify <proof.json>     # verify proof offline
treeship merkle status                  # tree state and checkpoints
treeship merkle publish                 # push checkpoint + proofs to Hub

# Terminal UI
treeship ui                             # interactive dashboard

# Shell hooks
treeship install                        # install shell hooks
treeship uninstall                      # remove shell hooks

# Keys
treeship keys list                      # show key fingerprints

# OpenTelemetry (requires --features otel)
treeship otel test                      # verify OTLP connectivity
treeship otel status                    # show OTel config
treeship otel export <id>              # export artifact as span
treeship otel enable                    # enable export
treeship otel disable                   # disable export

# Diagnostics
treeship doctor                         # run 9 health checks
```

## Global flags

| Flag                    | Description                                      |
| ----------------------- | ------------------------------------------------ |
| `--config <path>`       | Config file (default: `~/.treeship/config.json`) |
| `--format <text\|json>` | Output format (default: `text`)                  |
| `--quiet`               | Suppress all output except errors                |
| `--no-color`            | Disable color output                             |

## Environment variables

| Variable           | Description                                         |
| ------------------ | --------------------------------------------------- |
| `TREESHIP_ACTOR`   | Default actor URI for all attestations              |
| `TREESHIP_PARENT`  | Default parent artifact ID for chain linking        |
| `TREESHIP_LAST`    | Most recent artifact ID, set after every operation  |
| `TREESHIP_DISABLE` | Set to `1` to disable all attestation (passthrough) |
| `TREESHIP_DEBUG`   | Set to `1` to log all activity to stderr            |
| `NO_COLOR`         | Disable color output                                |

<Callout type="info">
  `TREESHIP_LAST` is updated after every operation. Use it to chain commands without manually tracking artifact IDs.
</Callout>

## Exit codes

| Code | Meaning                                      |
| ---- | -------------------------------------------- |
| 0    | Success / chain verified clean               |
| 1    | Error / chain verification failed            |
| 3    | Not initialized -- run `treeship init` first |
| 4    | Usage error                                  |