Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e80df96
docs: add Go→Rust migration design spec
ggonzalez94 May 28, 2026
eb32b95
docs: add Go→Rust migration implementation plan
ggonzalez94 May 28, 2026
af72160
chore(rust): scaffold cargo workspace (empty, green)
ggonzalez94 May 28, 2026
d0a6d7a
feat(rust): port L0 crates (TDD)
ggonzalez94 May 28, 2026
2fe4f60
feat(rust): port L1 crates (TDD)
ggonzalez94 May 28, 2026
3553958
feat(rust): port L2 crates (TDD)
ggonzalez94 May 28, 2026
5001263
feat(rust): port L3 crates (TDD)
ggonzalez94 May 28, 2026
24e03c6
feat(rust): port L4 crates (TDD)
ggonzalez94 May 29, 2026
43b7b65
feat(rust): port L5 crates (TDD)
ggonzalez94 May 29, 2026
7338064
feat(rust): port L6 crates (TDD)
ggonzalez94 May 29, 2026
9c951b7
test(rust): golden CLI parity vs Go
ggonzalez94 May 29, 2026
39d5a8f
docs(rust): final verification report + remainder plan
ggonzalez94 May 29, 2026
1960623
docs: add Rust migration current-state + completion plan (to 100%)
ggonzalez94 May 29, 2026
40b60c2
feat(rust): WS0 clap parser + full dispatch skeleton + plumbing
ggonzalez94 May 29, 2026
ff72d43
feat(rust): wire market-data (protocols top, protocols categories, pr…
ggonzalez94 May 29, 2026
c0794b6
feat(rust): wire lend-reads (lend markets, lend rates, lend positions)
ggonzalez94 May 29, 2026
0087171
feat(rust): wire yield-reads (yield opportunities, yield positions, y…
ggonzalez94 May 29, 2026
c82b62f
feat(rust): wire swap-quote (swap quote)
ggonzalez94 May 29, 2026
a7ad438
feat(rust): wire bridge-reads (bridge quote, bridge list, bridge deta…
ggonzalez94 May 29, 2026
bed5667
feat(rust): wire chains-extra (chains top, chains assets)
ggonzalez94 May 29, 2026
9b7eee9
feat(rust): wire wallet-balance (wallet balance)
ggonzalez94 May 29, 2026
7992175
test(rust): harden Reads (WS1-2)
ggonzalez94 May 29, 2026
28fd615
feat(rust): wire approvals-plan (approvals plan)
ggonzalez94 May 29, 2026
f5cd966
feat(rust): wire transfer-plan (transfer plan)
ggonzalez94 May 29, 2026
eff15f9
feat(rust): wire lend-plan (lend supply plan, lend withdraw plan, len…
ggonzalez94 May 29, 2026
0b1065b
feat(rust): wire yield-plan (yield deposit plan, yield withdraw plan)
ggonzalez94 May 29, 2026
a3fe3d0
test(rewards): RED app-level tests for rewards claim/compound plan (WS3)
ggonzalez94 May 29, 2026
eb8c7bd
feat(rust): wire rewards-plan (rewards claim plan, rewards compound p…
ggonzalez94 May 29, 2026
af44636
feat(rust): wire swap-plan (swap plan)
ggonzalez94 May 29, 2026
e2c5a74
feat(rust): wire bridge-plan (bridge plan)
ggonzalez94 May 29, 2026
0ede9df
test(rust): harden Execution plan (WS3)
ggonzalez94 May 29, 2026
156365d
feat(rust): wire actions (actions list, actions show, actions estimate)
ggonzalez94 May 29, 2026
427dc0a
feat(rust): wire approvals-submit (approvals submit, approvals status)
ggonzalez94 May 29, 2026
4ef2c6e
feat(rust): wire transfer-submit (transfer submit, transfer status)
ggonzalez94 May 29, 2026
00507ab
feat(rust): wire lend-submit (lend supply/withdraw/borrow/repay submi…
ggonzalez94 May 29, 2026
6a94117
feat(rust): wire yield-submit (yield deposit/withdraw submit, yield .…
ggonzalez94 May 29, 2026
a11432e
feat(rust): wire rewards-submit (rewards claim/compound submit, rewar…
ggonzalez94 May 29, 2026
c7f637e
feat(rust): wire swap-submit (swap submit, swap status)
ggonzalez94 May 29, 2026
be8bb6f
feat(rust): wire bridge-submit (bridge submit, bridge status)
ggonzalez94 May 30, 2026
eed6efc
test(rust): harden WS4 submit/status
ggonzalez94 May 30, 2026
87b39df
test(ows): add WS4b e2e contract tests against the real ows CLI
ggonzalez94 May 30, 2026
6890389
feat(execution): pin Tempo type-0x76 byte parity vs tempo-go (WS4a)
ggonzalez94 May 30, 2026
39f7e8c
feat(rust): WS6 full schema-tree byte parity
ggonzalez94 May 30, 2026
77089f1
fix(rust): parity sweep — null-decode, flag names, golden parity
ggonzalez94 May 30, 2026
bc8d747
ci(rust): add Rust CI + cutover notes
ggonzalez94 May 30, 2026
a3bb0de
docs(rust): completion outcome + final verification
ggonzalez94 May 30, 2026
447cce8
feat(rust): complete CLI migration cutover
ggonzalez94 Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions .github/workflows/ci.yml

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/nightly-execution-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
- uses: dtolnay/rust-toolchain@stable
with:
go-version-file: go.mod
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2
with:
workspaces: rust

- name: execution smoke checks
run: bash scripts/nightly_execution_smoke.sh
33 changes: 26 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,44 @@ permissions:

jobs:
goreleaser:
runs-on: ubuntu-latest
runs-on: macos-latest
defaults:
run:
working-directory: rust
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
- uses: dtolnay/rust-toolchain@stable
with:
go-version-file: go.mod
components: rustfmt, clippy

- run: go test ./...
- run: go vet ./...
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust

- name: release
- uses: mlugg/setup-zig@v2

- run: cargo install --locked cargo-zigbuild
- run: cargo fmt --all --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo test --workspace
- run: cargo test --workspace --release

- name: install GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
install-only: true
workdir: .

- name: release
run: |
ulimit -n 8192
goreleaser release --clean --parallelism 1
working-directory: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ci

on:
push:
branches: ["**"]
pull_request:

defaults:
run:
working-directory: rust

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- run: cargo fmt --all --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo test --workspace
- run: cargo test --workspace --release
- run: cargo build --workspace --release
32 changes: 14 additions & 18 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ project_name: defi

builds:
- id: defi
main: ./cmd/defi
builder: rust
dir: rust
binary: defi
command: zigbuild
flags:
- --release
- -p=defi-cli
targets:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/ggonzalez94/defi-cli/internal/version.CLIVersion={{ if .IsSnapshot }}{{ .Version }}-snapshot{{ else }}{{ .Tag }}{{ end }}
- -X github.com/ggonzalez94/defi-cli/internal/version.Commit={{ .ShortCommit }}
- -X github.com/ggonzalez94/defi-cli/internal/version.BuildDate={{ .Date }}
- DEFI_CLI_VERSION={{ if .IsSnapshot }}{{ .Version }}-snapshot{{ else }}{{ .Tag }}{{ end }}
- DEFI_BUILD_COMMIT={{ .ShortCommit }}
- DEFI_BUILD_DATE={{ .Date }}

archives:
- id: default
Expand All @@ -28,10 +28,6 @@ archives:
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
formats:
- tar.gz
format_overrides:
- goos: windows
formats:
- zip

checksum:
name_template: checksums.txt
Expand Down
89 changes: 44 additions & 45 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,45 @@ Short guide for agents working on `defi-cli`.
## First 5 minutes

```bash
go build -o defi ./cmd/defi
go test ./...
go test -race ./...
go vet ./...

./defi providers list --results-only
./defi lend markets --provider aave --chain 1 --asset USDC --results-only
./defi lend positions --provider aave --chain 1 --address 0x000000000000000000000000000000000000dEaD --type all --limit 3 --results-only
./defi yield opportunities --chain 1 --asset USDC --providers aave,morpho --limit 5 --results-only
./defi yield positions --chain 1 --address 0x000000000000000000000000000000000000dEaD --providers aave,morpho --limit 5 --results-only
cargo build --manifest-path rust/Cargo.toml --release -p defi-cli
cargo fmt --manifest-path rust/Cargo.toml --all --check
cargo clippy --manifest-path rust/Cargo.toml --all-targets --all-features -- -D warnings
cargo test --manifest-path rust/Cargo.toml --workspace
cargo test --manifest-path rust/Cargo.toml --workspace --release

rust/target/release/defi providers list --results-only
rust/target/release/defi lend markets --provider aave --chain 1 --asset USDC --results-only
rust/target/release/defi lend positions --provider aave --chain 1 --address 0x000000000000000000000000000000000000dEaD --type all --limit 3 --results-only
rust/target/release/defi yield opportunities --chain 1 --asset USDC --providers aave,morpho --limit 5 --results-only
rust/target/release/defi yield positions --chain 1 --address 0x000000000000000000000000000000000000dEaD --providers aave,morpho --limit 5 --results-only
```

## Folder structure

```text
cmd/
defi/main.go # CLI entrypoint

internal/
app/runner.go # command wiring, provider routing, cache flow
providers/ # external adapters
aave/ morpho/ moonwell/ # lending + yield (read + execution)
defillama/ # market/yield normalization + fallback + bridge analytics
across/ lifi/ # bridge quotes + lifi execution planning
oneinch/ uniswap/ taikoswap/ tempo/ # swap quotes + execution planning providers
types.go # provider interfaces
execution/ # action persistence + planner helpers + signer abstraction + tx execution
registry/ # canonical execution endpoints/contracts/ABI fragments + default chain RPC map
config/ # defaults + file/env/flags precedence
cache/ # sqlite cache + file lock
id/ # CAIP parsing + amount normalization
model/ # output envelope + domain models
out/ # json/plain rendering and field selection
errors/ # typed errors -> exit codes
schema/ # machine-readable command schema
policy/ # command allowlist
httpx/ # shared HTTP client/retry behavior

.github/workflows/ci.yml # CI (test/vet/build)
rust/
Cargo.toml # 16-crate Rust workspace
crates/
defi-cli/ # thin binary entrypoint
defi-app/ # clap command tree, routing, cache flow, envelopes
defi-providers/ # external adapters
defi-execution/ # action persistence, planners, signers, tx execution
defi-registry/ # canonical endpoints/contracts/ABIs + default RPC map
defi-config/ # defaults + file/env/flags precedence
defi-cache/ # sqlite cache + file lock
defi-id/ # CAIP parsing + amount normalization
defi-model/ # output envelope + domain models
defi-out/ # json/plain rendering and field selection
defi-errors/ # typed errors -> exit codes
defi-schema/ # machine-readable command schema models
defi-policy/ # command allowlist
defi-httpx/ # shared HTTP client/retry behavior
defi-evm/ # EVM ABI/signing/RPC helpers
defi-ows/ # Open Wallet Standard command integration

.github/workflows/rust-ci.yml # CI (fmt/clippy/test/build)
.github/workflows/nightly-execution-smoke.yml # nightly execution planning drift checks
.github/workflows/release.yml # tagged release pipeline (GoReleaser)
.github/workflows/release.yml # tagged release pipeline (GoReleaser Rust builder)
scripts/install.sh # macOS/Linux installer from GitHub Releases
.goreleaser.yml # cross-platform release artifact config
assets/ # static assets (logo, images)
Expand Down Expand Up @@ -85,9 +83,9 @@ README.md # user-facing usage + caveats
- `--from-address` is the local signer identity input for planning; it produces `legacy_local` actions that use local key inputs for submit.
- `schema` now includes inherited flags plus command/flag metadata (`required`, `enum`, `format`, `input_modes`, `auth`, and request/response structure hints).
- Metadata ownership is split by intent:
- `internal/registry`: canonical execution endpoints/contracts/ABIs and default chain RPC map (used when no `--rpc-url` is provided).
- `internal/providers/*/client.go`: provider quote/read API base URLs.
- `internal/id/id.go`: bootstrap token symbol/address registry for deterministic asset parsing.
- `rust/crates/defi-registry`: canonical execution endpoints/contracts/ABIs and default chain RPC map (used when no `--rpc-url` is provided).
- `rust/crates/defi-providers/src/*`: provider quote/read API base URLs.
- `rust/crates/defi-id`: bootstrap token symbol/address registry for deterministic asset parsing.
- Execution commands currently available:
- `swap plan|submit|status`
- `bridge plan|submit|status` (Across, LiFi)
Expand Down Expand Up @@ -143,14 +141,14 @@ README.md # user-facing usage + caveats
## Change patterns

- New provider:
1. implement adapter in `internal/providers/<name>/client.go`
2. register routes/info in `internal/app/runner.go`
3. add `httptest`-based adapter tests
1. implement adapter in `rust/crates/defi-providers/src/<name>.rs`
2. register provider metadata/routes in `rust/crates/defi-app`
3. add `wiremock`-based adapter tests
4. update README caveats if data quality/semantics differ
5. document any command that requires an API key explicitly
- Contract changes:
1. treat as breaking unless explicitly intended
2. update `internal/model` + `internal/out` tests first
2. update `rust/crates/defi-model` + `rust/crates/defi-out` tests first
- Behavior changes:
1. keep cache keys deterministic
2. add runner-level tests for routing/fallback/strict mode
Expand All @@ -161,9 +159,10 @@ README.md # user-facing usage + caveats

## Quality bar

- `go test ./...` passes
- `go test -race ./...` passes
- `go vet ./...` passes
- `cargo fmt --manifest-path rust/Cargo.toml --all --check` passes
- `cargo clippy --manifest-path rust/Cargo.toml --all-targets --all-features -- -D warnings` passes
- `cargo test --manifest-path rust/Cargo.toml --workspace` passes
- `cargo test --manifest-path rust/Cargo.toml --workspace --release` passes
- smoke at least one command on each touched provider path
- README updated for user-visible changes
- CHANGELOG updated for user-visible changes
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Format:
- Group notes by section in this order: `Added`, `Changed`, `Deprecated`, `Fixed`, `Docs`, `Security`.
- Keep bullets short and focused on user impact.

## [Unreleased]

### Changed
- CLI implementation and release artifacts now build from the Rust workspace (`rust/`); JSON envelope, fields, ordering, exit codes, and identifiers are unchanged.

## [v0.5.0] - 2026-03-26

### Added
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
.PHONY: build test test-race vet fmt run release-check release-snapshot
.PHONY: build test test-release clippy fmt run release-check release-snapshot

build:
go build -o defi ./cmd/defi
cargo build --manifest-path rust/Cargo.toml --release -p defi-cli

test:
go test ./...
cargo test --manifest-path rust/Cargo.toml --workspace

test-race:
go test -race ./...
test-release:
cargo test --manifest-path rust/Cargo.toml --workspace --release

vet:
go vet ./...
clippy:
cargo clippy --manifest-path rust/Cargo.toml --all-targets --all-features -- -D warnings

fmt:
gofmt -w $$(find . -name '*.go' -type f)
cargo fmt --manifest-path rust/Cargo.toml --all

run:
go run ./cmd/defi $(ARGS)
cargo run --manifest-path rust/Cargo.toml -p defi-cli -- $(ARGS)

release-check:
goreleaser check

release-snapshot:
goreleaser release --snapshot --clean
ulimit -n 8192 && goreleaser release --snapshot --clean --parallelism 1
Loading
Loading