Skip to main content

CLI Reference

Full documentation for the treeship command-line tool.

Installation

npm install -g treeship-cli

Configuration

Environment Variables

export TREESHIP_API_KEY=your-api-key      # Required for attest
export TREESHIP_AGENT=my-agent            # Default agent slug
export TREESHIP_API_URL=https://api.treeship.dev  # API endpoint

Config File

treeship config set api-key your-api-key
treeship config set default-agent my-agent
treeship config list

Commands

treeship attest

Create a cryptographic attestation.
treeship attest --action "Description" --inputs-hash "sha256..."
Options:
OptionDescriptionRequired
--action <text>Description of the actionYes
--inputs-hash <hash>SHA256 hash of inputsYes
--agent <slug>Agent slug (or use TREESHIP_AGENT)No
--jsonOutput as JSONNo
--quietOutput only the verification URLNo
Examples:
# Basic attestation
treeship attest \
  --action "Processed order #123" \
  --inputs-hash "abc123..."

# With explicit agent
treeship attest \
  --agent my-agent \
  --action "Deployed v2.0" \
  --inputs-hash "def456..."

# JSON output for scripts
treeship attest \
  --action "..." \
  --inputs-hash "..." \
  --json

# Just the URL
treeship attest \
  --action "..." \
  --inputs-hash "..." \
  --quiet

treeship verify

Verify an attestation by ID.
treeship verify <attestation-id>
Options:
OptionDescription
--jsonOutput as JSON
--quietOutput only “valid” or “invalid”
Examples:
# Standard verification
treeship verify abc123-def456-ghi789

# JSON output
treeship verify abc123-def456-ghi789 --json

# Script-friendly (exits 0 if valid, 1 if invalid)
treeship verify abc123-def456-ghi789 --quiet

treeship whoami

Show current configuration.
treeship whoami
Output:
Treeship CLI

  API URL   https://api.treeship.dev
  API Key   set
  Agent     my-agent

  Feed      https://treeship.dev/verify/my-agent

treeship config

Manage CLI configuration.
treeship config set <key> <value>
treeship config get <key>
treeship config list
treeship config reset
Keys:
KeyDescription
api-keyAPI key for authentication
api-urlAPI base URL
default-agentDefault agent slug

Exit Codes

CodeMeaning
0Success
1Error or verification failed

Scripting Examples

# Create attestation and capture URL
URL=$(treeship attest --action "Deploy" --inputs-hash "..." --quiet)
echo "Attestation: $URL"

# Verify in CI/CD
if treeship verify $ATTESTATION_ID --quiet; then
  echo "Verified!"
else
  echo "Verification failed!"
  exit 1
fi

# Process JSON output
treeship attest --action "..." --inputs-hash "..." --json | jq '.attestation_id'