@juanscilingo/vaults-cli 0.1.1-alpha.0

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/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # smart-yield — the agent CLI for Sentora vaults
2
+
3
+ Discover vaults, evaluate yield, and build unsigned transaction plans from the
4
+ command line. Designed for AI agents and automation first: JSON output,
5
+ branchable exit codes, self-describing commands. Every command is a query —
6
+ nothing here signs or sends.
7
+
8
+ ```sh
9
+ npm run build # bundles to dist/cli.mjs (esbuild, single file)
10
+ npx smart-yield --help
11
+ ```
12
+
13
+ ## A yield evaluation in four commands
14
+
15
+ ```sh
16
+ # 1. What vaults exist? (filter by chain, family, curator; project fields)
17
+ smart-yield yields list --chain 1 --fields name,family,contracts
18
+
19
+ # 2. How do candidates perform? (summary stats, not raw series)
20
+ smart-yield yields analytics --chain-id 1 --address 0xVAULT --days 30 --summary
21
+
22
+ # 3. Preflight several vaults in ONE call: family + meta + gates + your position
23
+ smart-yield snapshot --vault 0xA,0xB,0xC --owner 0xYOU --rpc-url $RPC
24
+
25
+ # 4. Build the deposit — unsigned steps, previewed outcome, named blockers
26
+ smart-yield upshift-financial plan-deposit --vault 0xA --amount 10000 --human --owner 0xYOU --rpc-url $RPC
27
+ ```
28
+
29
+ Plans return ordered unsigned `{to, data, value}` steps for any signer, with
30
+ `expected` outcomes (plus `expectedFormatted` human-decimal twins) and
31
+ `blockers`. **Non-empty blockers ⇒ exit code 7 ⇒ do not execute.**
32
+
33
+ ## Commands
34
+
35
+ ```
36
+ smart-yield <family> <command> [flags]
37
+ ```
38
+
39
+ | scope | commands |
40
+ |---|---|
41
+ | top-level | `describe [--family <f>]` · `detect --vault 0x…` · `snapshot --vault 0xA[,0xB…] [--owner]` |
42
+ | `yields` (API) | `list` · `get` · `analytics` · `risk` · `balance` · `activity` · `positions` · `blockchains` |
43
+ | `upshift-financial` | `meta` · `position` · `gates` · `plan-deposit` · `plan-redeem [--instant]` · `plan-claim` · `epoch` |
44
+ | `boring` (Veda) | `discover` · `position` · `plan-deposit` · `plan-withdraw` |
45
+ | `morpho` | `meta` · `position` · `gates` · `plan-deposit` · `plan-redeem` |
46
+
47
+ `describe` dumps the full surface as JSON (flags, requirements, examples, exit
48
+ codes) — point an agent at it once and it knows the whole tool. `detect`
49
+ classifies any address on-chain and refuses to guess unknown architectures
50
+ (exit 3). Typos at any level get "did you mean" suggestions.
51
+
52
+ ## Output contract
53
+
54
+ - **stdout is data**: compact JSON, bigints as decimal strings; `--pretty` for
55
+ humans, `--output text` for one `path=value` per line (grep-friendly).
56
+ - **stderr is everything else**: errors as
57
+ `{"error":{"code","message","retryable","hint"}}`; `--verbose` diagnostics
58
+ prefixed `# ` (endpoint provenance, per-RPC timing, unit conversions).
59
+ - **Exit codes**: `0` ok · `1` unexpected · `2` usage · `3` not found ·
60
+ `4` rpc/network (retryable) · `5` upstream api · `6` contract revert ·
61
+ `7` plan blocked (plan still printed).
62
+ - Plan results and `describe` carry `schemaVersion` — bumped on any breaking
63
+ shape change; pin automations to it.
64
+ - Amounts are base units by default (`1000000` = 1 USDC); `--human` accepts
65
+ decimals (`100.5`) and scales by on-chain token decimals. Outputs always
66
+ include human twins where decimals are known.
67
+
68
+ ## Performance
69
+
70
+ Reads batch through Multicall3 — one RPC round trip per command instead of
71
+ one per contract call (`--no-multicall` opts out on chains without the
72
+ canonical deployment). `--timeout <ms>` bounds every network call (default
73
+ 30s). `yields analytics --summary` / `--last N` and `list --fields/--limit/
74
+ --offset` keep responses small; truncation is always announced.
75
+
76
+ ## Configuration
77
+
78
+ | what | flag | env (flags win) |
79
+ |---|---|---|
80
+ | RPC endpoint | `--rpc-url` | `VAULTS_RPC_URL`, `SENTORA_RPC_URL`, `ETH_RPC_URL` |
81
+ | yields API base | `--base-url` | `YIELDS_BASE_URL`, `SENTORA_API_URL` (default: production) |
82
+ | yields API key | — (env only, never a flag) | `YIELDS_API_KEY`, `SENTORA_API_KEY` |
83
+
84
+ Shell note: pipes mask exit codes (`$?` is the last pipeline element) — branch
85
+ on `${PIPESTATUS[0]}` or run unpiped. `npm run cli` flattens exit codes; invoke
86
+ `npx smart-yield` or the bundle directly when branching.
87
+
88
+ > **Note:** `yields list` currently serves an embedded catalog snapshot in the
89
+ > [next API schema](../../docs/api-vault-schema-proposal.md); every response
90
+ > carries a `notice` field saying so. All other `yields` commands hit the live
91
+ > API.
92
+
93
+ ## Using from agent frameworks
94
+
95
+ Shell-capable coding agents use this CLI directly (below). Frameworks that
96
+ consume tools instead of binaries (LangChain, CrewAI, OpenAI Agents SDK, IDE
97
+ MCP configs, …) use [`@sentora/vaults-mcp`](../vaults-mcp/README.md) — an MCP
98
+ stdio server generated from this CLI's command registry. This package itself
99
+ stays dependency-free either way.
100
+
101
+ The package ships an [Agent Skill](skills/smart-yield/SKILL.md) (open SKILL.md
102
+ standard — Claude Code, Codex, Copilot CLI). Install it by copying the folder:
103
+
104
+ ```sh
105
+ # Claude Code (project) # Codex
106
+ .claude/skills/smart-yield/ .agents/skills/smart-yield/
107
+ ```
108
+
109
+ Paste into the consuming repo's `AGENTS.md` (Codex, Cursor, Copilot, Gemini
110
+ CLI, …) or `CLAUDE.md`:
111
+
112
+ ```markdown
113
+ ## smart-yield CLI
114
+ Read-only Sentora vault CLI: discovery, yield analytics, positions, and
115
+ UNSIGNED tx plans as JSON. Run `smart-yield describe` for the full surface.
116
+ Exit codes: 0 ok · 2 usage · 3 not found · 4 rpc/network (retryable) ·
117
+ 5 upstream api · 6 contract revert · 7 plan blocked (NEVER execute a blocked
118
+ plan). Auth: YIELDS_API_KEY env (never a flag). RPC: VAULTS_RPC_URL env or
119
+ --rpc-url. Plans are unsigned — hand them to the signer; never sign a plan
120
+ with non-empty blockers.
121
+ ```
122
+
123
+ Permission allowlists (the CLI is read-only, safe to pre-approve):
124
+
125
+ - Claude Code `.claude/settings.json`:
126
+ `{"permissions": {"allow": ["Bash(smart-yield *)", "Bash(npx smart-yield *)"]}}`
127
+ - Gemini CLI `settings.json`:
128
+ `{"tools": {"core": ["run_shell_command(smart-yield)"]}}`
129
+ - Codex: network egress is off in the default sandbox — set
130
+ `[sandbox_workspace_write] network_access = true` in `~/.codex/config.toml`
131
+ (error hints say this too). In Codex cloud, install in the setup script and
132
+ allowlist the API/RPC domains with POST permitted.
133
+
134
+ ---
135
+
136
+ Architecture in one line: this package is argv parsing, JSON serialization,
137
+ and exit codes — all vault logic lives in the family SDKs
138
+ (`@sentora/vaults-{upshift-financial,boring,morpho}`), plans in
139
+ `@sentora/vaults-plan`, API access in `@sentora/yields-client`. Built per
140
+ [docs/agent-cli-guidelines.md](../../docs/agent-cli-guidelines.md).