Skip to content

feat(shepherd-sdk): workspace + skeleton (BLEU-835)#12

Open
brunota20 wants to merge 1 commit into
dev/m3-basefrom
feat/shepherd-sdk-skeleton-bleu-835
Open

feat(shepherd-sdk): workspace + skeleton (BLEU-835)#12
brunota20 wants to merge 1 commit into
dev/m3-basefrom
feat/shepherd-sdk-skeleton-bleu-835

Conversation

@brunota20

Copy link
Copy Markdown
Collaborator

Summary

New library crate `crates/shepherd-sdk/` added as a workspace member. Built against both host target and `wasm32-wasip2` so helpers (BLEU-840) stay host-free unit-testable.

  • Deps: `cowprotocol` (default-features off), `alloy-primitives` 1.6, `alloy-sol-types` 1.5, `serde`, `serde_json` — same pattern as the modules.
  • Placeholder modules: `cow`, `chain`, `store` (populated by BLEU-840).
  • Prelude (the BLEU-835 deliverable): one-liner `use shepherd_sdk::prelude::*` covers alloy primitives (Address, B256, Bytes, U256, keccak256) and cowprotocol's order / signing / orderbook-error surface (OrderCreation, OrderData, OrderUid, OrderKind, Signature, Chain, GPv2OrderData, EMPTY_APP_DATA_{HASH,JSON}, ApiError, OrderPostErrorKind).

The wit-bindgen-generated types (`Guest`, `HostError`, `Event`, …) deliberately stay out of the prelude — they live in each module's own crate via per-module `wit_bindgen::generate!`. Helpers in BLEU-840 take primitive args so the SDK remains world-neutral.

Linear: BLEU-835. Ref ADR-0006 + ADR-0007.

Test plan

  • `cargo check -p shepherd-sdk` (host).
  • `cargo check --target wasm32-wasip2 -p shepherd-sdk`.
  • `cargo test -p shepherd-sdk` — 1 host test locking the prelude surface.
  • `cargo clippy --workspace -- -Dwarnings` + `--target wasm32-wasip2 -p shepherd-sdk` clean.

New library crate at crates/shepherd-sdk/ added as a workspace
member. The crate is a regular library (no cdylib), built against
both the host target and wasm32-wasip2 so helpers in BLEU-840 can
stay host-free unit-testable.

Deps follow the same default-features-off / 1.x-pinned pattern as
the modules:
- cowprotocol = "1.0.0-alpha.3", default-features = false
- alloy-primitives 1.6, alloy-sol-types 1.5
- serde 1, serde_json 1 (no_std-compat, alloc-only)

src/lib.rs lays out three placeholder modules (cow, chain, store)
that BLEU-840 will populate with the helpers currently duplicated
between twap-monitor and ethflow-watcher.

src/prelude.rs is the BLEU-835 deliverable proper: a single
`use shepherd_sdk::prelude::*` covers alloy primitives (Address,
B256, Bytes, U256, keccak256) and cowprotocol's order / signing /
orderbook-error surface (OrderCreation, OrderData, OrderUid,
OrderKind, Signature, Chain, GPv2OrderData,
EMPTY_APP_DATA_{HASH,JSON}, ApiError, OrderPostErrorKind).

The wit-bindgen-generated host types (Guest, HostError, Event,
Block, Log, …) deliberately stay *out* of the prelude — those
live in each module's own crate via the per-module
`wit_bindgen::generate!` invocation. Helpers added in BLEU-840
take primitive arguments (`&[u8]`, `Option<&str>`) so the SDK
remains world-neutral. Trade-off documented inline in lib.rs.

Builds + tests + clippy clean on host and wasm32-wasip2 (1 host
test locks the prelude surface).
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

BLEU-835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant