Skip to content

hedge-layer/hedge-layer-cli

Repository files navigation

@hedge-layer/cli

npm version license

Command-line interface for Hedge Layer — hedge real-world risks on Polymarket prediction markets.

Install

npm install -g @hedge-layer/cli

Requires Node.js 22 or later.

Quick Start

# 1. Create an API token at https://hedgelayer.ai/settings → API Tokens
# 2. Authenticate the CLI
hl auth login

# 3. Start an interactive risk assessment
hl assess

Authentication

The CLI uses API tokens created in the Hedge Layer web app. Tokens are stored locally in ~/.hedgelayer/config.json.

hl auth login      # Paste your API token (interactive)
hl auth status     # Check current authentication
hl auth logout     # Remove stored token

You can also pass a token inline for CI/scripts:

hl --token hl_abc123... assess list

Commands

Markets

Polymarket orderbook tools.

# View orderbook for a specific CLOB token
hl markets orderbook <tokenId>
hl markets orderbook <tokenId> --size 1000

Assess

Run AI-powered risk assessments interactively.

# Start an interactive chat assessment
hl assess

# List past assessments
hl assess list
hl assess list --status completed

# View a specific assessment
hl assess show <id>

# Delete an assessment
hl assess delete <id>

Hedge

Calculate hedge positions from a risk profile JSON file.

# From a file
hl hedge profile.json

# From stdin
echo '{
  "location": "33109",
  "assetType": "residential",
  "riskTypes": ["hurricane", "flood"],
  "assetValue": 500000
}' | hl hedge -

Profile

hl profile

Global Options

Flag Description
--json Machine-readable JSON output
--api-url <url> Override API base URL (default: https://hedgelayer.ai)
--token <token> Override stored API token
--verbose Show HTTP request/response details
--no-color Disable colored output

JSON output

Every command supports --json for pipe-friendly output:

hl --json assess list | jq '.[0].id'

Development

git clone https://github.com/hedge-layer/hedge-layer-cli.git
cd hedge-layer-cli
npm install
npm run build        # Build with tsup
npm run dev          # Watch mode

# Test against local dev server
node dist/index.mjs --api-url http://localhost:3000 assess list

Publishing

Releases are automated via GitHub Actions. To publish a new version:

npm version patch    # or minor / major
git push --tags

The workflow builds and publishes to npm when a version tag (v*) is pushed. Authentication uses npm's OIDC trusted publishers — no secrets required.

Changelog

See CHANGELOG.md for release history.

License

MIT

About

CLI for Hedge Layer — hedge real-world risks on Polymarket

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors