-
Notifications
You must be signed in to change notification settings - Fork 9
docs: launch Mintlify docs site with CI and branding refinements #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a58183f
0b98577
f4ee783
c445604
222cc4e
f9b4fd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: docs | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - 'docs/**' | ||
| - '.github/workflows/docs.yml' | ||
| pull_request: | ||
| paths: | ||
| - 'docs/**' | ||
| - '.github/workflows/docs.yml' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| mintlify-checks: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| env: | ||
| MINT_CLI_VERSION: '4.2.378' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docs CI uses unpinned Node 22Medium Severity The docs workflow pins |
||
|
|
||
| - name: Validate docs build | ||
| working-directory: docs | ||
| run: npx --yes mint@${MINT_CLI_VERSION} validate | ||
|
|
||
| - name: Check broken links | ||
| working-directory: docs | ||
| run: npx --yes mint@${MINT_CLI_VERSION} broken-links | ||
|
|
||
| - name: Check accessibility | ||
| working-directory: docs | ||
| run: npx --yes mint@${MINT_CLI_VERSION} a11y | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| /bin/ | ||
| /dist/ | ||
| /defi | ||
| .mintlify/ | ||
| *.test | ||
| *.out | ||
| .coverprofile | ||
| .DS_Store | ||
| TODO.md | ||
| TODO.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| title: Agent Overview | ||
| description: Build robust agent workflows on top of deterministic CLI contracts. | ||
| --- | ||
|
|
||
| ## Why agents like defi-cli | ||
|
|
||
| - Stable envelope schema (`version`, `success`, `error`, `meta`) | ||
| - Stable exit code mapping | ||
| - Canonical chain and asset IDs | ||
| - Provider-scoped retrieval IDs on lend/yield rows (`provider_native_id`, `provider_native_id_kind`) | ||
| - Deterministic `--select` projections | ||
| - Machine-readable command schema (`defi schema`) | ||
|
|
||
| ## Recommended request pattern | ||
|
|
||
| 1. Resolve all chain/asset inputs (`assets resolve` where useful). | ||
| 2. Execute command with `--json --results-only` for success payloads. | ||
| 3. Handle non-zero exit codes using `error.code` and `error.type`. | ||
| 4. Persist canonical IDs and base-unit amounts. | ||
|
|
||
| ## Suggested defaults | ||
|
|
||
| ```bash | ||
| --timeout 12s --retries 2 --max-stale 5m | ||
| ``` | ||
|
|
||
| For strict workflows: | ||
|
|
||
| ```bash | ||
| --strict --no-stale | ||
| ``` | ||
|
|
||
| ## Command allowlist mode | ||
|
|
||
| Use `--enable-commands` to constrain executable commands in agent sandboxes. | ||
|
|
||
| ```bash | ||
| defi --enable-commands "providers list,yield opportunities" providers list --results-only | ||
| ``` | ||
|
|
||
| If a command is blocked, exit code `16` (`command_blocked`) is returned. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| title: Reliability Patterns | ||
| description: Error handling, retries, stale policy, and strict-mode strategies for production agents. | ||
| --- | ||
|
|
||
| ## Error-first flow | ||
|
|
||
| When command exit code is non-zero: | ||
|
|
||
| 1. Parse error envelope from stderr. | ||
| 2. Branch on `error.code`. | ||
| 3. Decide retry/fallback/abort. | ||
|
|
||
| ## Core retry and fallback guidance | ||
|
|
||
| - Retry on `11` (`rate_limited`) and `12` (`provider_unavailable`) with backoff. | ||
| - Do not retry on `2` (`usage_error`) until input is corrected. | ||
| - Retry on `10` (`auth_error`) only after key provisioning. | ||
| - Treat `14` (`stale_data`) as SLO breach. | ||
|
|
||
| ## Cache/staleness strategy | ||
|
|
||
| - Default cache mode is usually best for interactive and agent loops. | ||
| - Use `--no-stale` for strict freshness. | ||
| - Use `--max-stale` to control tolerated stale window on temporary provider failures. | ||
|
|
||
| ## Strict-mode strategy | ||
|
|
||
| - Use `--strict` when partial provider aggregation is unacceptable. | ||
| - In strict mode, partial results fail with code `15`. | ||
|
|
||
| ## Suggested wrapper behavior | ||
|
|
||
| - Always capture stdout and stderr separately. | ||
| - Treat stdout as success payload only when exit code is `0`. | ||
| - Persist `meta.request_id` for trace correlation. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| title: Schema-Driven Integration | ||
| description: Use the machine-readable command schema to generate dynamic tooling. | ||
| --- | ||
|
|
||
| ## Fetch schema | ||
|
|
||
| ```bash | ||
| defi schema --results-only | ||
| ``` | ||
|
|
||
| Scope to a specific command path: | ||
|
|
||
| ```bash | ||
| defi schema "yield opportunities" --results-only | ||
| defi schema "bridge quote" --results-only | ||
| ``` | ||
|
|
||
| ## Schema model | ||
|
|
||
| Each node contains: | ||
|
|
||
| - `path` | ||
| - `use` | ||
| - `short` | ||
| - `flags[]` (`name`, `type`, `usage`, `default`, optional `shorthand`) | ||
| - `subcommands[]` | ||
|
|
||
| ## Practical uses | ||
|
|
||
| - Generate UI forms from flag metadata. | ||
| - Validate requested flags before execution. | ||
| - Produce autocomplete for command builders. | ||
| - Build policy-aware execution layers with `--enable-commands`. | ||
|
|
||
| ## Notes | ||
|
|
||
| - Hidden commands are not included. | ||
| - Flag defaults are serialized as strings in schema output. | ||
| - Runtime constraints (for example, mutually exclusive amount flags) still require command execution validation. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| title: Config and Cache | ||
| description: Configure precedence, retries/timeouts, and stale fallback semantics. | ||
| --- | ||
|
|
||
| ## Config precedence | ||
|
|
||
| `flags > env > config file > defaults` | ||
|
|
||
| Default config path: | ||
|
|
||
| ```text | ||
| ${XDG_CONFIG_HOME:-~/.config}/defi/config.yaml | ||
| ``` | ||
|
|
||
| Minimal config example: | ||
|
|
||
| ```yaml | ||
| output: json | ||
| strict: false | ||
| timeout: 10s | ||
| retries: 2 | ||
| cache: | ||
| enabled: true | ||
| max_stale: 5m | ||
| ``` | ||
|
|
||
| ## Useful env vars | ||
|
|
||
| | Variable | Purpose | | ||
| | --- | --- | | ||
| | `DEFI_OUTPUT` | `json` or `plain` | | ||
| | `DEFI_TIMEOUT` | Provider timeout | | ||
| | `DEFI_RETRIES` | Retries per request | | ||
| | `DEFI_MAX_STALE` | Stale fallback window | | ||
| | `DEFI_NO_STALE` | Disable stale fallback | | ||
| | `DEFI_NO_CACHE` | Disable cache | | ||
| | `DEFI_CACHE_PATH` | Cache DB path | | ||
| | `DEFI_CACHE_LOCK_PATH` | Cache lock path | | ||
|
|
||
| ## Cache behavior | ||
|
|
||
| - Fresh cache hits (`age <= ttl`) return immediately. | ||
| - After TTL expires, CLI refetches providers. | ||
| - Stale data is served only when providers fail temporarily (`unavailable` or `rate_limited`) and within `max_stale`. | ||
| - Cache writes use SQLite WAL + busy timeout + lock/backoff retries to reduce lock contention in parallel runs. | ||
| - If cache init fails (path/permissions), commands continue with cache disabled. | ||
| - Metadata commands (`version`, `schema`, `providers list`) bypass cache initialization. | ||
|
|
||
| ## Command TTLs | ||
|
|
||
| | Command | TTL | | ||
| | --- | --- | | ||
| | `chains top`, `chains assets`, `protocols top`, `protocols categories` | `5m` | | ||
| | `lend markets`, `yield opportunities`, `bridge list`, `bridge details` | `60s` | | ||
| | `lend rates` | `30s` | | ||
| | `bridge quote`, `swap quote` | `15s` | | ||
|
|
||
| ## Strict mode | ||
|
|
||
| If any selected provider fails and partial results occur, `--strict` returns exit code `15` (`partial_results`). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| title: IDs and Amounts | ||
| description: Use canonical chain/asset IDs and normalized amount fields. | ||
| --- | ||
|
|
||
| ## Chain IDs | ||
|
|
||
| `--chain`, `--from`, and `--to` accept: | ||
|
|
||
| - CAIP-2: `eip155:1` | ||
| - Numeric EVM chain ID: `1` | ||
| - Alias: `ethereum`, `base`, `hyperevm`, `megaeth`, `gnosis`, `taiko`, etc. | ||
| - Solana mainnet alias/CAIP-2: `solana` or `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | ||
|
|
||
| `defi-cli` normalizes these to canonical CAIP-2 IDs in output. | ||
|
|
||
| ## Asset IDs | ||
|
|
||
| Asset inputs accept: | ||
|
|
||
| - Symbol: `USDC` | ||
| - Token address: `0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` | ||
| - CAIP-19: `eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` | ||
| - Solana CAIP-19: `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | ||
|
|
||
| Output always returns canonical CAIP-19 in fields like `asset_id`, `from_asset_id`, `to_asset_id`. | ||
|
|
||
| ## Amount semantics | ||
|
|
||
| For swap and bridge quotes: | ||
|
|
||
| - `--amount` is base units (recommended for automation) | ||
| - `--amount-decimal` is human decimal form | ||
| - passing both returns a usage error | ||
|
|
||
| Output includes both normalized forms: | ||
|
|
||
| ```json | ||
| "input_amount": { | ||
| "amount_base_units": "1000000", | ||
| "amount_decimal": "1", | ||
| "decimals": 6 | ||
| } | ||
| ``` | ||
|
|
||
| ## Important caveats | ||
|
|
||
| - Symbol parsing depends on the local bootstrap token registry. | ||
| - On chains without symbol coverage, pass address or CAIP-19 directly. | ||
| - Solana support is mainnet-only (`solana` / `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`). | ||
| - Solana devnet/testnet aliases and custom Solana CAIP-2 references are rejected. | ||
| - MegaETH bootstrap symbol support currently includes `MEGA`, `WETH`, and `USDT` (`USDT` resolves to the chain `USDT0` contract). | ||
|
|
||
| See [Chain Aliases](/reference/chain-aliases). |


Uh oh!
There was an error while loading. Please reload this page.