Skip to content

Commit b0fcaca

Browse files
committed
chore: update readme
1 parent 618886e commit b0fcaca

File tree

2 files changed

+104
-112
lines changed

2 files changed

+104
-112
lines changed

README.md

Lines changed: 51 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1,115 @@
11
# LP Agent CLI
22

3-
Command-line interface for the [LP Agent Open API](https://docs.lpagent.io). Manage Solana LP positions, discover pools, and generate add/remove liquidity transactions from the terminal.
3+
`lpagent` is the command-line interface for [LP Agent](https://lpagent.io). Manage Solana LP positions, discover pools, and generate liquidity transactions from your terminal or through AI agents.
44

5-
Single binary, no runtime dependencies. Works standalone or as a Claude agent skill.
5+
- Works standalone or as a Claude agent skill
6+
- Single binary, no runtime dependencies
7+
- JSON output for piping and automation
8+
- Colored table output for humans
69

7-
## Install
8-
9-
### From release binaries
10-
11-
Download the latest binary from [GitHub Releases](https://github.com/lpagent/cli/releases).
10+
## Quick Start
1211

1312
```bash
14-
# macOS (Apple Silicon)
15-
curl -sL https://github.com/lpagent/cli/releases/latest/download/lp-agent-cli_darwin_arm64.tar.gz | tar xz
16-
sudo mv lpagent /usr/local/bin/
13+
curl -fsSL https://raw.githubusercontent.com/lpagent/cli/main/install.sh | bash
14+
```
1715

18-
# macOS (Intel)
19-
curl -sL https://github.com/lpagent/cli/releases/latest/download/lp-agent-cli_darwin_amd64.tar.gz | tar xz
20-
sudo mv lpagent /usr/local/bin/
16+
That's it. Now set up your API key and start querying:
2117

22-
# Linux (amd64)
23-
curl -sL https://github.com/lpagent/cli/releases/latest/download/lp-agent-cli_linux_amd64.tar.gz | tar xz
24-
sudo mv lpagent /usr/local/bin/
18+
```bash
19+
lpagent auth set-key
20+
lpagent auth set-default-owner <wallet-address>
21+
lpagent positions open -o table --native
2522
```
2623

27-
### From source
24+
<details>
25+
<summary>Other installation methods</summary>
26+
27+
**Go install:**
2828

2929
```bash
3030
go install github.com/lpagent/cli/cmd/lpagent@latest
3131
```
3232

33-
### Build locally
33+
**Build from source:**
3434

3535
```bash
36-
git clone https://github.com/lpagent/cli.git
37-
cd lp-agent-cli
36+
git clone https://github.com/lpagent/cli.git && cd cli
3837
make build
3938
./bin/lpagent --help
4039
```
4140

42-
## Quick start
43-
44-
```bash
45-
# 1. Set your API key (get one at https://app.lpagent.io)
46-
lpagent auth set-key
47-
48-
# 2. Set a default wallet so you don't need --owner every time
49-
lpagent auth set-default-owner <wallet-address>
50-
51-
# 3. View open positions
52-
lpagent positions open -o table
53-
54-
# 4. View open positions in SOL
55-
lpagent positions open -o table --native
56-
57-
# 5. Check portfolio overview
58-
lpagent positions overview -o table --native
59-
```
41+
</details>
6042

6143
## Commands
6244

63-
### Auth
64-
65-
```bash
66-
lpagent auth set-key # Set API key (saved to ~/.lpagent/config.json)
67-
lpagent auth status # Show current config
68-
lpagent auth set-default-owner <addr> # Set default wallet
69-
```
70-
71-
### Positions
72-
7345
```bash
46+
# Positions
7447
lpagent positions open --owner <addr> # Open positions
48+
lpagent positions open -o table --native # Table view in SOL
7549
lpagent positions historical --owner <addr> --from 2025-01-01 # Closed positions
76-
lpagent positions overview --owner <addr> # Portfolio metrics
50+
lpagent positions overview -o table --native # Portfolio metrics
7751
lpagent positions logs --position <id> # Transaction logs
7852
lpagent positions get --position <id> # Position details
7953
lpagent positions revenue <addr> # Revenue data
80-
```
81-
82-
### Pools
8354

84-
```bash
85-
lpagent pools discover --chain SOL --sort-by tvl # Discover pools
86-
lpagent pools info <poolId> # Pool details
87-
lpagent pools positions <poolId> --status Open # Positions in a pool
88-
lpagent pools onchain-stats <poolId> # TVL, volume, fees
89-
lpagent pools top-lpers <poolId> # Top liquidity providers
90-
lpagent pools add-tx <poolId> --owner <addr> --strategy Spot --input-sol 1 # Zap-In tx
91-
lpagent pools landing-add-tx --file signed-tx.json # Submit signed tx
92-
```
93-
94-
### Token
55+
# Pools
56+
lpagent pools discover --chain SOL --sort-by tvl # Discover pools
57+
lpagent pools info <poolId> # Pool details
58+
lpagent pools positions <poolId> --status Open # Positions in a pool
59+
lpagent pools onchain-stats <poolId> # TVL, volume, fees
60+
lpagent pools top-lpers <poolId> # Top LPs
9561

96-
```bash
97-
lpagent token balance --owner <addr> # All token balances
98-
lpagent token balance --owner <addr> --ca <mint> # Specific tokens
99-
```
62+
# Zap-In (add liquidity)
63+
lpagent pools add-tx <poolId> --owner <addr> --strategy Spot --input-sol 1
64+
lpagent pools landing-add-tx --file signed-tx.json
10065

101-
### Transactions (Zap-Out)
102-
103-
```bash
104-
lpagent tx decrease-quotes --id <id> --bps 10000 # Get withdrawal quotes
66+
# Zap-Out (remove liquidity)
67+
lpagent tx decrease-quotes --id <id> --bps 10000
10568
lpagent tx decrease-tx --position-id <id> --bps 10000 --owner <addr> --slippage-bps 500
106-
lpagent tx landing-decrease-tx --file signed-tx.json # Submit signed tx
107-
```
69+
lpagent tx landing-decrease-tx --file signed-tx.json
10870

109-
### Raw API
71+
# Token
72+
lpagent token balance --owner <addr>
11073

111-
```bash
74+
# Raw API access
11275
lpagent api get /lp-positions/opening --query "owner=<addr>"
11376
lpagent api post /position/decrease-quotes --data '{"id":"...","bps":5000}'
11477
```
11578

116-
## Output formats
117-
118-
All commands support `--output` / `-o`:
79+
## Output Formats
11980

120-
| Format | Description |
121-
|---------|------------------------------------|
122-
| `json` | Full JSON response (default) |
123-
| `table` | Human-readable table with colors |
124-
| `quiet` | IDs only, one per line |
81+
All commands support `--output` / `-o`: `json` (default), `table`, `quiet`.
12582

12683
Use `--native` on `positions open` and `positions overview` to show values in SOL instead of USD.
12784

12885
## Configuration
12986

130-
Config stored at `~/.lpagent/config.json`:
87+
Config stored at `~/.lpagent/config.json`. Override with env vars or CLI flags:
13188

132-
```json
133-
{
134-
"api_key": "your-api-key",
135-
"api_base_url": "https://api.lpagent.io/open-api/v1",
136-
"default_owner": "your-wallet-address",
137-
"output_format": "json"
138-
}
139-
```
140-
141-
### Environment variables
89+
| Variable | Flag | Description |
90+
|------------------------|---------------|------------------------|
91+
| `LPAGENT_API_KEY` | `--api-key` | API key |
92+
| `LPAGENT_API_URL` | | Base URL |
93+
| `LPAGENT_DEFAULT_OWNER`| `--owner` | Default wallet address |
14294

143-
| Variable | Description |
144-
|------------------------|--------------------------------|
145-
| `LPAGENT_API_KEY` | API key (overrides config) |
146-
| `LPAGENT_API_URL` | Base URL (overrides config) |
147-
| `LPAGENT_DEFAULT_OWNER`| Default wallet (overrides config) |
148-
149-
CLI flags take highest priority, then env vars, then config file.
95+
Priority: CLI flags > env vars > config file.
15096

15197
## Development
15298

15399
```bash
154-
make build # Build binary to bin/lpagent
100+
make build # Build to bin/lpagent
155101
make test # Run tests
156-
make fmt # Format code
157-
make vet # Run go vet
158-
make lint # Run golangci-lint
159-
make check # All of the above
160-
make install # Install to $GOPATH/bin
102+
make check # fmt + vet + test
161103
```
162104

163105
## Release
164106

165-
Releases are automated via GitHub Actions + GoReleaser. To create a release:
107+
Automated via GitHub Actions + GoReleaser on version tags:
166108

167109
```bash
168-
git tag v0.1.0
169-
git push origin v0.1.0
110+
git tag v0.1.0 && git push origin v0.1.0
170111
```
171112

172-
This triggers the release workflow which builds cross-platform binaries (darwin/linux/windows, amd64/arm64), creates a GitHub Release, and publishes checksums.
173-
174113
## License
175114

176115
MIT

install.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
REPO="lpagent/cli"
5+
BINARY="lpagent"
6+
INSTALL_DIR="/usr/local/bin"
7+
8+
# Detect OS and architecture
9+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
10+
ARCH=$(uname -m)
11+
12+
case "$ARCH" in
13+
x86_64|amd64) ARCH="amd64" ;;
14+
arm64|aarch64) ARCH="arm64" ;;
15+
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
16+
esac
17+
18+
case "$OS" in
19+
darwin|linux) ;;
20+
*) echo "Unsupported OS: $OS"; exit 1 ;;
21+
esac
22+
23+
# Get latest release tag
24+
LATEST=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
25+
26+
if [ -z "$LATEST" ]; then
27+
echo "Failed to fetch latest release"
28+
exit 1
29+
fi
30+
31+
VERSION="${LATEST#v}"
32+
ARCHIVE="${BINARY}_${VERSION}_${OS}_${ARCH}.tar.gz"
33+
URL="https://github.com/${REPO}/releases/download/${LATEST}/${ARCHIVE}"
34+
35+
echo "Installing ${BINARY} ${LATEST} (${OS}/${ARCH})..."
36+
37+
TMP=$(mktemp -d)
38+
trap 'rm -rf "$TMP"' EXIT
39+
40+
curl -fsSL "$URL" -o "${TMP}/${ARCHIVE}"
41+
tar xzf "${TMP}/${ARCHIVE}" -C "$TMP"
42+
43+
if [ -w "$INSTALL_DIR" ]; then
44+
mv "${TMP}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
45+
else
46+
sudo mv "${TMP}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
47+
fi
48+
49+
echo "Installed ${BINARY} ${LATEST} to ${INSTALL_DIR}/${BINARY}"
50+
echo ""
51+
echo "Get started:"
52+
echo " lpagent auth set-key"
53+
echo " lpagent positions open --owner <wallet> -o table"

0 commit comments

Comments
 (0)