@upshiftfinance/cli 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +185 -2
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +19 -0
- package/lib/commands/chain.d.ts +2 -0
- package/lib/commands/chain.js +42 -0
- package/lib/commands/config.d.ts +2 -0
- package/lib/commands/config.js +107 -0
- package/lib/commands/docs.d.ts +2 -0
- package/lib/commands/docs.js +407 -0
- package/lib/commands/init.d.ts +2 -0
- package/lib/commands/init.js +124 -0
- package/lib/commands/login.d.ts +2 -0
- package/lib/commands/login.js +57 -0
- package/lib/commands/ops.d.ts +2 -0
- package/lib/commands/ops.js +149 -0
- package/lib/commands/points.d.ts +2 -0
- package/lib/commands/points.js +52 -0
- package/lib/commands/profile.d.ts +2 -0
- package/lib/commands/profile.js +82 -0
- package/lib/commands/rpc.d.ts +11 -0
- package/lib/commands/rpc.js +93 -0
- package/lib/commands/skill.d.ts +2 -0
- package/lib/commands/skill.js +83 -0
- package/lib/commands/user.d.ts +2 -0
- package/lib/commands/user.js +93 -0
- package/lib/commands/vault.d.ts +2 -0
- package/lib/commands/vault.js +326 -0
- package/lib/commands/whoami.d.ts +2 -0
- package/lib/commands/whoami.js +45 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +9 -0
- package/lib/lib/flags.d.ts +14 -0
- package/lib/lib/flags.js +46 -0
- package/lib/lib/output.d.ts +7 -0
- package/lib/lib/output.js +218 -0
- package/lib/lib/prompts.d.ts +24 -0
- package/lib/lib/prompts.js +51 -0
- package/lib/lib/resolve-vault.d.ts +10 -0
- package/lib/lib/resolve-vault.js +137 -0
- package/lib/lib/version.d.ts +2 -0
- package/lib/lib/version.js +27 -0
- package/lib/lib/watch.d.ts +4 -0
- package/lib/lib/watch.js +38 -0
- package/lib/main.d.ts +3 -0
- package/lib/main.js +55 -0
- package/lib/notify-update.d.ts +1 -0
- package/lib/notify-update.js +38 -0
- package/package.json +66 -3
- package/skills/upshift.md +212 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: upshift
|
|
3
|
+
description: |
|
|
4
|
+
Query Upshift vaults and pools via the `upshift` CLI
|
|
5
|
+
(@upshiftfinance/cli) and/or the `upshift-mcp` server
|
|
6
|
+
(@upshiftfinance/mcp). Use for vault APY, TVL, positions, loans,
|
|
7
|
+
allocations, redemption windows, points, and lifetime PnL across EVM,
|
|
8
|
+
Solana, and Stellar. TRIGGER when the user mentions Upshift or
|
|
9
|
+
Upshift vaults/pools, asks about positions or redemptions in those
|
|
10
|
+
vaults, Upshift points, or vault yields/TVL. SKIP for general DeFi
|
|
11
|
+
questions unrelated to Upshift, or for any on-chain write or
|
|
12
|
+
signing action — nothing here signs or broadcasts a transaction (the
|
|
13
|
+
only write anywhere is `jira_create_ticket`, which files a Jira issue).
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Upshift
|
|
17
|
+
|
|
18
|
+
You have two paired tools that share the same on-disk config under
|
|
19
|
+
`~/.upshift/` and emit the same JSON envelope:
|
|
20
|
+
|
|
21
|
+
- **`upshift`** — CLI (`@upshiftfinance/cli`). One subcommand per read
|
|
22
|
+
operation. Invoke via `Bash` with `--json`.
|
|
23
|
+
- **`upshift-mcp`** — local stdio MCP server (`@upshiftfinance/mcp`).
|
|
24
|
+
When present, it exposes the same operations as MCP tools
|
|
25
|
+
(`whoami`, `chain_list`, `rpc_test`, the `vault_*` set, the
|
|
26
|
+
`user_*` set) plus institutional reads, revert decoding, docs
|
|
27
|
+
search, and GitHub/Jira helpers — 70 tools in total.
|
|
28
|
+
|
|
29
|
+
**Prefer the MCP tools when they appear in your tool list** — lower
|
|
30
|
+
latency, no shell parsing, structured I/O. Fall back to `Bash` +
|
|
31
|
+
`upshift … --json`.
|
|
32
|
+
|
|
33
|
+
## Setup check
|
|
34
|
+
|
|
35
|
+
Run once at the start of a conversation that needs Upshift data:
|
|
36
|
+
|
|
37
|
+
1. `upshift --version` via `Bash`. Not found? Tell the user to install:
|
|
38
|
+
`npm install -g @upshiftfinance/cli`.
|
|
39
|
+
2. `upshift whoami --json`. If `data.apiKey.source === "none"`, suggest
|
|
40
|
+
`upshift init`. If they have `UPSHIFT_API_KEY` exported, nothing to
|
|
41
|
+
do — env vars override the keystore.
|
|
42
|
+
|
|
43
|
+
If only the MCP is available, call `whoami` for the same check.
|
|
44
|
+
|
|
45
|
+
## Envelope
|
|
46
|
+
|
|
47
|
+
Every CLI `--json` response and every MCP tool result:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"schemaVersion": 1,
|
|
52
|
+
"command": "vault.apy",
|
|
53
|
+
"ok": true,
|
|
54
|
+
"data": {
|
|
55
|
+
/* command-specific payload */
|
|
56
|
+
},
|
|
57
|
+
"meta": { "chainId": 8453, "durationMs": 312, "generatedAt": "..." }
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
On failure: `ok: false`, `error: { code, message, remediation? }`.
|
|
62
|
+
**Match on `error.code` — never parse `error.message`.**
|
|
63
|
+
|
|
64
|
+
## Command / tool map
|
|
65
|
+
|
|
66
|
+
| Purpose | CLI | MCP |
|
|
67
|
+
| ------------------ | -------------------------------------------------------------------------------- | --------------------------- |
|
|
68
|
+
| Identity / config | `upshift whoami` | `whoami` |
|
|
69
|
+
| Supported chains | `upshift chain list` | `chain_list` |
|
|
70
|
+
| RPC health | `upshift rpc test [--chain <id>]` | `rpc_test` |
|
|
71
|
+
| Vault metadata | `upshift vault get <vault> [--chain <id>]` | `vault_get` |
|
|
72
|
+
| Vault APY | `upshift vault apy <vault> [--chain <id>]` | `vault_apy` |
|
|
73
|
+
| Vault TVL | `upshift vault tvl <vault> [--chain <id>]` | `vault_tvl` |
|
|
74
|
+
| Vault positions | `upshift vault positions <vault> [--user <wallet>] [--chain <id>]` | `vault_positions` |
|
|
75
|
+
| Vault loans | `upshift vault loans <vault> [--chain <id>]` | `vault_loans` |
|
|
76
|
+
| Vault allocations | `upshift vault allocations <vault> [--chain <id>]` | `vault_allocations` |
|
|
77
|
+
| Vault redemptions | `upshift vault redemptions <vault> [--user <wallet>] [--chain <id>]` | `vault_redemptions` |
|
|
78
|
+
| Vault history | `upshift vault history <vault> [--days <n>] [--chain <id>]` | `vault_history` |
|
|
79
|
+
| Vault summary | `upshift vault summary <vault> [--chain <id>]` | `vault_summary` |
|
|
80
|
+
| User points | `upshift user points <wallet> --chain <id>` | `user_points` |
|
|
81
|
+
| User positions | `upshift user positions <wallet> --chain <id>` | `user_positions` |
|
|
82
|
+
| User PnL | `upshift user pnl <wallet> --vault <vault> [--chain <id>]` | `user_pnl` |
|
|
83
|
+
| Vault directory | `upshift vault list [--chain <id>]` | `vault_list` (paginated) |
|
|
84
|
+
| Vault search | — (use `vault list` + grep) | `vault_search` |
|
|
85
|
+
| Points leaderboard | `upshift points leaderboard [--page <n>] [--per-page <n>] [--sort-by <f>]` | `points_leaderboard` |
|
|
86
|
+
| Redemption queue | `upshift vault pending-redemptions <vault> [--past-days <n>] [--future-days <n>]` | `vault_pending_redemptions` |
|
|
87
|
+
| Vault PnL series | `upshift vault pnl-history <vault> [--limit <n>]` | `vault_pnl_history` |
|
|
88
|
+
| All-vault PnL | `upshift vault pnl-latest` | `pnl_latest` |
|
|
89
|
+
| Subaccount directory | — (admin API key) | `subaccount_list` |
|
|
90
|
+
| Loan book (global) | — (admin API key) | `dashboard_loans` |
|
|
91
|
+
| Discount factors | — (API key) | `risk_discount_factors` |
|
|
92
|
+
| Collateral excess | — (public) | `risk_collateral_excess` |
|
|
93
|
+
| Collateral simulation | — (public) | `risk_collateral_simulate` |
|
|
94
|
+
| Subaccount txs | — (owner or admin API key) | `subaccount_transactions` |
|
|
95
|
+
| Loan by address | — (admin API key) | `subaccount_loan_by_address`|
|
|
96
|
+
| Subaccount DeBank | — (public) | `subaccount_debank` |
|
|
97
|
+
| Tx revert reason | — (public) | `tx_revert_reason` |
|
|
98
|
+
| OTC positions | — (admin API key) | `otc_positions_list` |
|
|
99
|
+
| OTC margins | — (admin API key) | `otc_margin_requirements` |
|
|
100
|
+
| Curator subaccounts| — (curator/admin API key) | `curator_vault_subaccounts` |
|
|
101
|
+
| Curator whitelist | — (curator/admin API key) | `curator_vault_whitelist` |
|
|
102
|
+
| Timelock requests | — (public) | `timelock_requests_list` |
|
|
103
|
+
| Vault perf fees | — (public) | `vault_performance_fees` |
|
|
104
|
+
| Oracle classification | — (public) | `vault_oracle_classification`|
|
|
105
|
+
| Ops sweep | `upshift ops health [--vault <v>...]` (exit 2 on anomaly) | `ops_health` |
|
|
106
|
+
| Queue health | `upshift ops redemptions <vault>` (exit 2 on anomaly) | `ops_redemptions` |
|
|
107
|
+
| Protocol TVL | — | `total_deposited` |
|
|
108
|
+
| Token price | — | `token_price` |
|
|
109
|
+
| Vault withdrawals | — | `vault_withdrawals` |
|
|
110
|
+
| Vault PnL | — | `vault_pnl` |
|
|
111
|
+
| Annualized APY | — | `vault_annualized_apy` |
|
|
112
|
+
| Withdrawal status | — | `withdrawal_requests_status`|
|
|
113
|
+
| Vault flow feed | — | `vault_activity` |
|
|
114
|
+
| Activity ranking | — | `activity_ranking` |
|
|
115
|
+
| User activity | — | `user_activity` |
|
|
116
|
+
| User transfers | — | `user_transfers` |
|
|
117
|
+
| Subaccount summary | — (admin API key) | `subaccount_summary` |
|
|
118
|
+
| Subaccount health | — (admin API key) | `subaccount_health_factor` |
|
|
119
|
+
| Subaccount loans | — (admin API key) | `subaccount_loans` |
|
|
120
|
+
| Subaccount CeFi | — (admin API key) | `subaccount_cefi_positions` |
|
|
121
|
+
| Subaccount OTC | — (admin API key) | `subaccount_otc_positions` |
|
|
122
|
+
| LayerZero deposits | — | `layerzero_deposits` |
|
|
123
|
+
| LayerZero redeems | — | `layerzero_redeems` |
|
|
124
|
+
| Decode revert blob | — (public) | `decode_revert_data` |
|
|
125
|
+
| Replay a call | — (RPC for the chain) | `simulate_call` |
|
|
126
|
+
| ERC-20 holder state| — (RPC for the chain) | `read_token_state` |
|
|
127
|
+
| Docs index | `upshift docs list` | `docs_list` |
|
|
128
|
+
| Docs search | `upshift docs search <query>` | `docs_search` |
|
|
129
|
+
| Docs page | `upshift docs open <site> <path>` | `docs_fetch` |
|
|
130
|
+
| GitHub repos | — (`UPSHIFT_GITHUB_TOKEN`) | `github_list_repos` |
|
|
131
|
+
| GitHub file | — (`UPSHIFT_GITHUB_TOKEN`) | `github_get_file` |
|
|
132
|
+
| GitHub code search | — (`UPSHIFT_GITHUB_TOKEN`) | `github_search_code` |
|
|
133
|
+
| GitHub PRs | — (`UPSHIFT_GITHUB_TOKEN`) | `github_list_prs`, `github_get_pr` |
|
|
134
|
+
| GitHub issues | — (`UPSHIFT_GITHUB_TOKEN`) | `github_list_issues` |
|
|
135
|
+
| Jira projects | — (`JIRA_*` env) | `jira_list_projects` |
|
|
136
|
+
| Jira ticket (write)| — (`JIRA_*` env + Upshift session) | `jira_create_ticket` |
|
|
137
|
+
|
|
138
|
+
`<vault>` accepts a raw `0x…` address, a bare symbol (`coreusdc`), or a
|
|
139
|
+
chain-prefixed symbol (`eth-coreusdc`, `avax-upausd`, `hyperevm-hbbtc`).
|
|
140
|
+
When you pass a name, the CLI fills in the chain from the upshift
|
|
141
|
+
metadata endpoint, so `--chain` is optional. Discover names with
|
|
142
|
+
`upshift vault list --json`.
|
|
143
|
+
|
|
144
|
+
Always pass `--json` to CLI commands. Other global flags: `--chain`,
|
|
145
|
+
`--rpc`, `--profile`, `--config-dir`. Run `upshift <cmd> --help` to see
|
|
146
|
+
per-command flags.
|
|
147
|
+
|
|
148
|
+
## Workflows
|
|
149
|
+
|
|
150
|
+
**Current APY on a vault.** Call `vault_apy`. Report `data.currentApy`
|
|
151
|
+
and (if present) `data.annualizedApy`. On `RPC_MISSING`, suggest
|
|
152
|
+
`UPSHIFT_RPC_<chainId>=…` or `upshift config set rpcs.<chainId> <url>`.
|
|
153
|
+
|
|
154
|
+
**Wallet positions across Upshift.** Call `user_positions`. The
|
|
155
|
+
`data.positions` array has one entry per `{vault, chainId}`. Group by
|
|
156
|
+
chain or vault when summarising.
|
|
157
|
+
|
|
158
|
+
**Diagnose a flaky command.** Call `rpc_test`. Report per-chain
|
|
159
|
+
`latencyMs` and any non-`ok` results. If everything is healthy, call
|
|
160
|
+
`whoami` to verify API-key source and config dir.
|
|
161
|
+
|
|
162
|
+
**Compare vaults.** Call `vault_summary` for each address in parallel
|
|
163
|
+
(MCP) or background (`&` in `Bash`). Render the key fields in a table.
|
|
164
|
+
|
|
165
|
+
**Is anything wrong right now?** Run `upshift ops health --vault <v> --json`.
|
|
166
|
+
Exit code 2 means anomalies — read `data.checks[]` for which check failed
|
|
167
|
+
(`rpc`, `vault_summary`, or `redemptions`) and report `detail`. Cron-able.
|
|
168
|
+
|
|
169
|
+
**Watch a redemption queue.** `upshift ops redemptions <vault> --watch 30
|
|
170
|
+
--json` emits one envelope per tick (NDJSON). `data.flags` contains
|
|
171
|
+
`overdue` and/or `insufficient-liquidity` when unhealthy.
|
|
172
|
+
|
|
173
|
+
**Monetary units.** `pending-redemptions` amounts (`totalPending`,
|
|
174
|
+
`shortfall`, `liquidity.available`, `redemptionsByDate[].assets`) are
|
|
175
|
+
integers in the vault asset's smallest unit — divide by
|
|
176
|
+
`10^asset.decimals` before showing them to a human.
|
|
177
|
+
|
|
178
|
+
## Error codes
|
|
179
|
+
|
|
180
|
+
| Code | Meaning | Suggest |
|
|
181
|
+
| --------------------------- | ------------------------------------------ | --------------------------------------------------------------------- |
|
|
182
|
+
| `API_KEY_MISSING` | No API key from flag / env / session, or the backend rejected it. | `upshift login` or set `UPSHIFT_API_KEY`. |
|
|
183
|
+
| `API_KEY_FORBIDDEN` | The key is valid but lacks the scope this endpoint needs. | Use a key with the required scope; admin endpoints need an admin key. |
|
|
184
|
+
| `KEYSTORE_WRONG_PASSPHRASE` | Decryption failed. | Re-prompt; or `upshift init --force` to recreate. |
|
|
185
|
+
| `KEYSTORE_NOT_FOUND` | No keystore file. | `upshift init`. |
|
|
186
|
+
| `SESSION_EXPIRED` | Cached session aged out. | `upshift login`. |
|
|
187
|
+
| `RPC_MISSING` | No RPC for the requested chain. | `UPSHIFT_RPC_<chainId>=…` or `upshift config set rpcs.<chainId> <url>`. |
|
|
188
|
+
| `PROFILE_NOT_FOUND` | `--profile` references an unknown profile. | `upshift profile list`. |
|
|
189
|
+
| `VAULT_NAME_NOT_FOUND` | Vault name (or `chain-name`) is unknown. | `upshift vault list` to see known names. |
|
|
190
|
+
| `VAULT_NAME_AMBIGUOUS` | Bare name matches multiple chains. | Prefix with a chain (e.g. `eth-coreusdc`) or pass `--chain`. |
|
|
191
|
+
| `CONFIG_INVALID` | `config.json` failed schema validation. | `upshift init` (rewrites it). |
|
|
192
|
+
| `SCHEMA_MISMATCH` | SDK returned an unexpected shape. | Likely an SDK regression — report the command + `meta`. |
|
|
193
|
+
| `INTERNAL` | Uncategorised. | Include `error.message` when escalating. |
|
|
194
|
+
|
|
195
|
+
## Safety
|
|
196
|
+
|
|
197
|
+
Nothing here signs or broadcasts a transaction. The only write is
|
|
198
|
+
`jira_create_ticket`, which files a Jira issue — confirm with the user
|
|
199
|
+
before calling it.
|
|
200
|
+
|
|
201
|
+
- Don't invent vault or wallet addresses. Validate with `vault_get`
|
|
202
|
+
before reasoning about a vault.
|
|
203
|
+
- Don't invent chain ids. Use `chain_list`.
|
|
204
|
+
- Don't attempt deposits, approvals, redemptions, or any signing
|
|
205
|
+
action — those commands don't exist here.
|
|
206
|
+
- Don't echo the user's API key, passphrase, or `.session` contents.
|
|
207
|
+
- Always parse `--json` output. Never scrape the human/table format.
|
|
208
|
+
|
|
209
|
+
## Links
|
|
210
|
+
|
|
211
|
+
- CLI — https://www.npmjs.com/package/@upshiftfinance/cli
|
|
212
|
+
- MCP — https://www.npmjs.com/package/@upshiftfinance/mcp
|